Typeclasses for (semi)groups and monoids #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
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_smul
and has_vadd
for multiplicative and additive
actions and register the following instances:
has_pow M ℕ
, for monoidsM
, andhas_pow G ℤ
for groupsG
;has_smul ℕ M
for additive monoidsM
, andhas_smul ℤ 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_smul.smul a b
.a +ᵥ b
is used as notation forhas_vadd.vadd a b
.
Type class for the +ᵥ
notation.
Instances of this typeclass
- add_action.to_has_vadd
- set_like.has_vadd
- has_add.to_has_vadd
- pi.has_vadd
- add_opposite.has_vadd
- order_dual.has_vadd
- order_dual.has_vadd'
- lex.has_vadd
- lex.has_vadd'
- additive.has_vadd
- add_units.has_vadd
- has_add.to_has_opposite_vadd
- prod.has_vadd
- ulift.has_vadd
- pi.has_vadd'
- function.has_vadd
- ulift.has_vadd_left
- punit.has_vadd
- add_submonoid.has_vadd
- submodule.has_vadd
- add_con.has_vadd
- linear_pmap.has_vadd
- uniform_space.completion.has_vadd
Instances of other typeclasses for has_vadd
- has_vadd.has_sizeof_inst
Type class for the -ᵥ
notation.
Instances of this typeclass
Instances of other typeclasses for has_vsub
- has_vsub.has_sizeof_inst
Typeclass for types with a scalar multiplication operation, denoted •
(\bu
)
Instances of this typeclass
- algebra.to_has_smul
- rat.smul_division_ring
- mul_action.to_has_smul
- smul_zero_class.to_has_smul
- set_like.has_smul
- has_mul.to_has_smul
- add_monoid.has_smul_nat
- sub_neg_monoid.has_smul_int
- pi.has_smul
- mul_opposite.has_smul
- order_dual.has_smul
- order_dual.has_smul'
- lex.has_smul
- lex.has_smul'
- multiplicative.has_smul
- units.has_smul
- has_mul.to_has_opposite_smul
- prod.has_smul
- ulift.has_smul
- pi.has_smul'
- function.has_smul
- linear_map.has_smul
- ulift.has_smul_left
- punit.has_smul
- add_submonoid_class.has_nsmul
- submonoid.has_smul
- add_subgroup_class.has_zsmul
- add_subgroup.has_nsmul
- add_subgroup.has_zsmul
- sub_mul_action.has_smul
- sub_mul_action.has_smul'
- submodule.has_smul
- dfinsupp.has_nat_scalar
- dfinsupp.has_int_scalar
- dfinsupp.has_smul
- finsupp.has_nat_scalar
- finsupp.has_int_scalar
- subsemiring.has_smul
- subring.has_smul
- add_con.quotient.has_nsmul
- add_con.quotient.has_zsmul
- con.has_smul
- tensor_product.left_has_smul
- tensor_product.has_smul
- conj_act.has_smul
- conj_act.has_units_scalar
- conj_act.subgroup.conj_action
- linear_pmap.has_smul
- submodule.quotient.has_smul'
- submodule.quotient.has_smul
- submodule.has_smul'
- subalgebra.has_smul
- self_adjoint.has_qsmul
- self_adjoint.has_smul
- skew_adjoint.has_smul
- matrix.has_smul
- ring_con.quotient.has_smul
- ring_con.has_zsmul
- ring_con.has_nsmul
- bilin_form.has_smul
- subfield_class.has_smul
- nonneg.has_nsmul
- cau_seq.has_smul
- cau_seq.completion.Cauchy.has_smul
- uniform_space.completion.has_smul
- complex.has_smul
- add_group_seminorm.has_smul
- group_seminorm.has_smul
- nonarch_add_group_seminorm.has_smul
- normed_add_group_hom.has_smul
- normed_add_group_hom.has_nat_scalar
- normed_add_group_hom.has_int_scalar
- seminorm.has_smul
- multilinear_map.has_smul
- continuous_multilinear_map.has_smul
- alternating_map.has_smul
- localization.has_smul
- quadratic_form.has_smul
- is_bimodule_map.has_smul
- matrix.has_smul_block_diagonal
- _private.2022024685.has_smul.units_matrix_ne_zero
- multiset.has_smul
Instances of other typeclasses for has_smul
- has_smul.has_sizeof_inst
A mixin for left cancellative multiplication.
Instances of this typeclass
A mixin for right cancellative multiplication.
Instances of this typeclass
A mixin for left cancellative addition.
Instances of this typeclass
A mixin for right cancellative addition.
Instances of this typeclass
A semigroup is a type with an associative (*)
.
Instances of this typeclass
- comm_semigroup.to_semigroup
- left_cancel_semigroup.to_semigroup
- right_cancel_semigroup.to_semigroup
- monoid.to_semigroup
- semigroup_with_zero.to_semigroup
- mul_opposite.semigroup
- add_opposite.semigroup
- multiplicative.semigroup
- pi.semigroup
- order_dual.semigroup
- lex.semigroup
- prod.semigroup
- nat.semigroup
- int.semigroup
- rat.semigroup
- ulift.semigroup
- mul_mem_class.to_semigroup
- positive.subtype.semigroup
- con.semigroup
- add_submonoid.semigroup
- sub_mul_action.semigroup
- real.semigroup
- set.Ico.semigroup
- set.Ioc.semigroup
- set.Ioo.semigroup
Instances of other typeclasses for semigroup
- semigroup.has_sizeof_inst
An additive semigroup is a type with an associative (+)
.
Instances of this typeclass
- 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
- mul_opposite.add_semigroup
- add_opposite.add_semigroup
- additive.add_semigroup
- pi.add_semigroup
- order_dual.add_semigroup
- lex.add_semigroup
- prod.add_semigroup
- nat.add_semigroup
- with_top.add_semigroup
- with_bot.add_semigroup
- int.add_semigroup
- rat.add_semigroup
- ulift.add_semigroup
- add_mem_class.to_add_semigroup
- positive.subtype.add_semigroup
- add_con.add_semigroup
- matrix.add_semigroup
- real.add_semigroup
- dmatrix.add_semigroup
Instances of other typeclasses for add_semigroup
- add_semigroup.has_sizeof_inst
- mul : G → G → G
- mul_assoc : ∀ (a b c : G), a * b * c = a * (b * c)
- mul_comm : ∀ (a b : G), a * b = b * a
A commutative semigroup is a type with an associative commutative (*)
.
Instances of this typeclass
- comm_monoid.to_comm_semigroup
- non_unital_comm_semiring.to_comm_semigroup
- non_unital_comm_ring.to_comm_semigroup
- mul_opposite.comm_semigroup
- add_opposite.comm_semigroup
- multiplicative.comm_semigroup
- pi.comm_semigroup
- order_dual.comm_semigroup
- lex.comm_semigroup
- prod.comm_semigroup
- with_zero.comm_semigroup
- nat.comm_semigroup
- int.comm_semigroup
- rat.comm_semigroup
- ulift.comm_semigroup
- mul_mem_class.to_comm_semigroup
- subsemigroup.center.comm_semigroup
- con.comm_semigroup
- fin.comm_semigroup
- real.comm_semigroup
- set.Ico.comm_semigroup
- set.Ioc.comm_semigroup
- set.Ioo.comm_semigroup
Instances of other typeclasses for comm_semigroup
- comm_semigroup.has_sizeof_inst
- 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 of this typeclass
- add_comm_monoid.to_add_comm_semigroup
- mul_opposite.add_comm_semigroup
- add_opposite.add_comm_semigroup
- additive.add_comm_semigroup
- pi.add_comm_semigroup
- order_dual.add_comm_semigroup
- lex.add_comm_semigroup
- prod.add_comm_semigroup
- nat.add_comm_semigroup
- with_top.add_comm_semigroup
- with_bot.add_comm_semigroup
- int.add_comm_semigroup
- rat.add_comm_semigroup
- fin.add_comm_semigroup
- ulift.add_comm_semigroup
- add_mem_class.to_add_comm_semigroup
- add_subsemigroup.center.add_comm_semigroup
- positive.subtype.add_comm_semigroup
- pnat.add_comm_semigroup
- add_con.add_comm_semigroup
- tensor_product.add_comm_semigroup
- matrix.add_comm_semigroup
- real.add_comm_semigroup
- convex_cone.add_comm_semigroup
- dmatrix.add_comm_semigroup
Instances of other typeclasses for add_comm_semigroup
- add_comm_semigroup.has_sizeof_inst
Any comm_semigroup G
that satisfies is_right_cancel_mul G
also satisfies
is_left_cancel_mul G
.
Any
add_comm_semigroup G
that satisfies is_right_cancel_add G
also satisfies
is_right_cancel_add G
.
Any comm_semigroup G
that satisfies is_left_cancel_mul G
also satisfies
is_right_cancel_mul G
.
Any
add_comm_semigroup G
that satisfies is_left_cancel_add G
also satisfies
is_left_cancel_add G
.
Any add_comm_semigroup G
that satisfies is_left_cancel_add G
also satisfies is_cancel_add G
.
Any comm_semigroup G
that satisfies is_left_cancel_mul G
also satisfies
is_cancel_mul G
.
Any comm_semigroup G
that satisfies is_right_cancel_mul G
also satisfies
is_cancel_mul G
.
Any add_comm_semigroup G
that satisfies is_right_cancel_add G
also satisfies is_cancel_add G
.
- mul : G → G → G
- mul_assoc : ∀ (a b c : G), a * b * c = a * (b * c)
- mul_left_cancel : ∀ (a b c : G), a * b = a * c → b = c
A left_cancel_semigroup
is a semigroup such that a * b = a * c
implies b = c
.
Instances of this typeclass
Instances of other typeclasses for left_cancel_semigroup
- left_cancel_semigroup.has_sizeof_inst
- add : G → G → G
- add_assoc : ∀ (a b c : G), a + b + c = a + (b + c)
- add_left_cancel : ∀ (a b c : G), a + b = a + c → b = c
An add_left_cancel_semigroup
is an additive semigroup such that
a + b = a + c
implies b = c
.
Instances of this typeclass
- add_left_cancel_monoid.to_add_left_cancel_semigroup
- mul_opposite.add_left_cancel_semigroup
- add_opposite.left_cancel_add_semigroup
- additive.add_left_cancel_semigroup
- pi.add_left_cancel_semigroup
- order_dual.left_cancel_add_semigroup
- lex.left_cancel_add_semigroup
- prod.left_cancel_add_semigroup
- rat.add_left_cancel_semigroup
- fin.add_left_cancel_semigroup
- ulift.add_left_cancel_semigroup
- positive.subtype.add_left_cancel_semigroup
- pnat.add_left_cancel_semigroup
- real.add_left_cancel_semigroup
Instances of other typeclasses for add_left_cancel_semigroup
- add_left_cancel_semigroup.has_sizeof_inst
Any left_cancel_semigroup
satisfies is_left_cancel_mul
.
Any add_left_cancel_semigroup
satisfies is_left_cancel_add
.
- mul : G → G → G
- mul_assoc : ∀ (a b c : G), a * b * c = a * (b * c)
- mul_right_cancel : ∀ (a b c : G), a * b = c * b → a = c
A right_cancel_semigroup
is a semigroup such that a * b = c * b
implies a = c
.
Instances of this typeclass
Instances of other typeclasses for right_cancel_semigroup
- right_cancel_semigroup.has_sizeof_inst
- add : G → G → G
- add_assoc : ∀ (a b c : G), a + b + c = a + (b + c)
- add_right_cancel : ∀ (a b c : G), a + b = c + b → a = c
An add_right_cancel_semigroup
is an additive semigroup such that
a + b = c + b
implies a = c
.
Instances of this typeclass
- add_right_cancel_monoid.to_add_right_cancel_semigroup
- mul_opposite.add_right_cancel_semigroup
- add_opposite.right_cancel_add_semigroup
- additive.add_right_cancel_semigroup
- pi.add_right_cancel_semigroup
- order_dual.right_cancel_add_semigroup
- lex.right_cancel_add_semigroup
- prod.right_cancel_add_semigroup
- rat.add_right_cancel_semigroup
- fin.add_right_cancel_semigroup
- ulift.add_right_cancel_semigroup
- positive.subtype.add_right_cancel_semigroup
- pnat.add_right_cancel_semigroup
- real.add_right_cancel_semigroup
Instances of other typeclasses for add_right_cancel_semigroup
- add_right_cancel_semigroup.has_sizeof_inst
Any right_cancel_semigroup
satisfies is_right_cancel_mul
.
Any add_right_cancel_semigroup
satisfies is_right_cancel_add
.
Typeclass for expressing that a type M
with multiplication and a one satisfies
1 * a = a
and a * 1 = a
for all a : M
.
Instances of this typeclass
- submonoid_class.to_mul_one_class
- monoid.to_mul_one_class
- mul_zero_one_class.to_mul_one_class
- units.mul_one_class
- mul_opposite.mul_one_class
- add_opposite.mul_one_class
- multiplicative.mul_one_class
- pi.mul_one_class
- order_dual.mul_one_class
- lex.mul_one_class
- prod.mul_one_class
- with_one.mul_one_class
- ulift.mul_one_class
- submonoid.to_mul_one_class
- con.mul_one_class
- add_submonoid.mul_one_class
- sub_mul_action.mul_one_class
Instances of other typeclasses for mul_one_class
- mul_one_class.has_sizeof_inst
Typeclass for expressing that a type M
with addition and a zero satisfies
0 + a = a
and a + 0 = a
for all a : M
.
Instances of this typeclass
- add_submonoid_class.to_add_zero_class
- add_monoid.to_add_zero_class
- add_units.add_zero_class
- mul_opposite.add_zero_class
- add_opposite.add_zero_class
- additive.add_zero_class
- pi.add_zero_class
- order_dual.add_zero_class
- lex.add_zero_class
- prod.add_zero_class
- with_zero.add_zero_class
- with_top.add_zero_class
- with_bot.add_zero_class
- ulift.add_zero_class
- add_submonoid.to_add_zero_class
- dfinsupp.add_zero_class
- dfinsupp.add_zero_class₂
- finsupp.add_zero_class
- add_con.add_zero_class
- tensor_product.add_zero_class
- matrix.add_zero_class
- convex_cone.add_zero_class
Instances of other typeclasses for add_zero_class
- add_zero_class.has_sizeof_inst
Suppose that one can put two mathematical structures on a type, a rich one R
and a poor one
P
, and that one can deduce the poor structure from the rich structure through a map F
(called a
forgetful functor) (think R = metric_space
and P = topological_space
). A possible
implementation would be to have a type class rich
containing a field R
, a type class poor
containing a field P
, and an instance from rich
to poor
. However, this creates diamond
problems, and a better approach is to let rich
extend poor
and have a field saying that
F R = P
.
To illustrate this, consider the pair metric_space
/ topological_space
. Consider the topology
on a product of two metric spaces. With the first approach, it could be obtained by going first from
each metric space to its topology, and then taking the product topology. But it could also be
obtained by considering the product metric space (with its sup distance) and then the topology
coming from this distance. These would be the same topology, but not definitionally, which means
that from the point of view of Lean's kernel, there would be two different topological_space
instances on the product. This is not compatible with the way instances are designed and used:
there should be at most one instance of a kind on each type. This approach has created an instance
diamond that does not commute definitionally.
The second approach solves this issue. Now, a metric space contains both a distance, a topology, and a proof that the topology coincides with the one coming from the distance. When one defines the product of two metric spaces, one uses the sup distance and the product topology, and one has to give the proof that the sup distance induces the product topology. Following both sides of the instance diamond then gives rise (definitionally) to the product topology on the product space.
Another approach would be to have the rich type class take the poor type class as an instance parameter. It would solve the diamond problem, but it would lead to a blow up of the number of type classes one would need to declare to work with complicated classes, say a real inner product space, and would create exponential complexity when working with products of such complicated spaces, that are avoided by bundling things carefully as above.
Note that this description of this specific case of the product of metric spaces is oversimplified
compared to mathlib, as there is an intermediate typeclass between metric_space
and
topological_space
called uniform_space
. The above scheme is used at both levels, embedding a
topology in the uniform space structure, and a uniform structure in the metric space structure.
Note also that, when P
is a proposition, there is no such issue as any two proofs of P
are
definitionally equivalent in Lean.
To avoid boilerplate, there are some designs that can automatically fill the poor fields when
creating a rich structure if one doesn't want to do something special about them. For instance,
in the definition of metric spaces, default tactics fill the uniform space fields if they are
not given explicitly. One can also have a helper function creating the rich structure from a
structure with fewer fields, where the helper function fills the remaining fields. See for instance
uniform_space.of_core
or real_inner_product.of_core
.
For more details on this question, called the forgetful inheritance pattern, see Competing inheritance paths in dependent type theory: a case study in functional analysis.
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
R[X]
has a natural R
-action defined by multiplication on the coefficients. This means
that ℕ[X]
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_smul ℕ α
instance using this action. See Note [forgetful inheritance] for more
explanations on this pattern.
For example, when we define R[X]
, 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_smul ℕ ℕ[X]
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 of this typeclass
- add_submonoid_class.to_add_monoid
- 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
- add_monoid_with_one.to_add_monoid
- mul_opposite.add_monoid
- add_opposite.add_monoid
- additive.add_monoid
- pi.add_monoid
- order_dual.add_monoid
- lex.add_monoid
- prod.add_monoid
- with_zero.add_monoid
- nat.add_monoid
- with_top.add_monoid
- with_bot.add_monoid
- int.add_monoid
- rat.add_monoid
- ulift.add_monoid
- add_submonoid.to_add_monoid
- dfinsupp.add_monoid
- dfinsupp.add_monoid₂
- finsupp.add_monoid
- add_con.add_monoid
- matrix.add_monoid
- real.add_monoid
- uniform_space.completion.add_monoid
- seminorm.add_monoid
- uniform_fun.add_monoid
- uniform_on_fun.add_monoid
- dmatrix.add_monoid
Instances of other typeclasses for add_monoid
- add_monoid.has_sizeof_inst
- 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 of this typeclass
- submonoid_class.to_monoid
- 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
- mul_opposite.monoid
- add_opposite.monoid
- ring_hom.monoid
- multiplicative.monoid
- pi.monoid
- order_dual.monoid
- lex.monoid
- prod.monoid
- function.End.monoid
- with_one.monoid
- nat.monoid
- int.monoid
- rat.monoid
- ulift.monoid
- module.End.monoid
- submonoid.to_monoid
- positive.subtype.monoid
- alg_hom.End
- non_unital_star_alg_hom.monoid
- star_alg_hom.monoid
- con.monoid
- add_submonoid.monoid
- sub_mul_action.monoid
- ordinal.monoid
- affine_map.monoid
- real.monoid
- linear_isometry.monoid
- set.Ioc.monoid
- affine_isometry.monoid
- uniform_fun.monoid
- uniform_on_fun.monoid
- matrix.special_linear_group.monoid
Instances of other typeclasses for monoid
- monoid.has_sizeof_inst
Equations
- monoid.has_pow = {pow := λ (x : M) (n : ℕ), monoid.npow n x}
Equations
- add_monoid.has_smul_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 of this typeclass
- add_submonoid_class.to_add_comm_monoid
- add_cancel_comm_monoid.to_add_comm_monoid
- subtraction_comm_monoid.to_add_comm_monoid
- add_comm_monoid_with_one.to_add_comm_monoid
- non_unital_non_assoc_semiring.to_add_comm_monoid
- ordered_add_comm_monoid.to_add_comm_monoid
- ordered_cancel_add_comm_monoid.to_add_comm_monoid
- add_comm_group.to_add_comm_monoid
- mul_opposite.add_comm_monoid
- add_opposite.add_comm_monoid
- additive.add_comm_monoid
- add_monoid_hom.add_comm_monoid
- add_monoid.End.add_comm_monoid
- pi.add_comm_monoid
- order_dual.add_comm_monoid
- lex.add_comm_monoid
- prod.add_comm_monoid
- with_zero.add_comm_monoid
- nat.add_comm_monoid
- with_top.add_comm_monoid
- with_bot.add_comm_monoid
- int.add_comm_monoid
- rat.add_comm_monoid
- fin.add_comm_monoid
- ulift.add_comm_monoid
- linear_map.add_comm_monoid
- add_submonoid.to_add_comm_monoid
- submodule.add_comm_monoid
- dfinsupp.add_comm_monoid
- finsupp.add_comm_monoid
- add_con.add_comm_monoid
- tensor_product.add_comm_monoid
- submodule.pointwise_add_comm_monoid
- set_semiring.add_comm_monoid
- part_enat.add_comm_monoid
- restrict_scalars.add_comm_monoid
- dfinsupp.add_comm_monoid_of_linear_map
- direct_sum.add_comm_monoid
- matrix.add_comm_monoid
- bilin_form.add_comm_monoid
- real.add_comm_monoid
- continuous_linear_map.add_comm_monoid
- uniform_fun.add_comm_monoid
- uniform_on_fun.add_comm_monoid
- multilinear_map.add_comm_monoid
- continuous_multilinear_map.add_comm_monoid
- alternating_map.add_comm_monoid
- monoid_algebra.add_comm_monoid
- add_monoid_algebra.add_comm_monoid
- add_localization.add_comm_monoid
- weak_bilin.add_comm_monoid
- weak_dual.add_comm_monoid
- weak_space.add_comm_monoid
- dmatrix.add_comm_monoid
- quadratic_form.add_comm_monoid
- is_bimodule_map.add_comm_monoid
- matrix.add_comm_monoid_block_diagonal
Instances of other typeclasses for add_comm_monoid
- add_comm_monoid.has_sizeof_inst
- 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 of this typeclass
- submonoid_class.to_comm_monoid
- cancel_comm_monoid.to_comm_monoid
- division_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
- ordered_cancel_comm_monoid.to_comm_monoid
- linear_ordered_comm_ring.to_comm_monoid
- mul_opposite.comm_monoid
- add_opposite.comm_monoid
- multiplicative.comm_monoid
- monoid_hom.comm_monoid
- pi.comm_monoid
- order_dual.comm_monoid
- lex.comm_monoid
- prod.comm_monoid
- with_one.comm_monoid
- nat.comm_monoid
- int.comm_monoid
- rat.comm_monoid
- ulift.comm_monoid
- associates.comm_monoid
- submonoid.to_comm_monoid
- submonoid.center.comm_monoid
- con.comm_monoid
- real.comm_monoid
- set.Ioc.comm_monoid
- uniform_fun.comm_monoid
- uniform_on_fun.comm_monoid
- localization.comm_monoid
Instances of other typeclasses for comm_monoid
- comm_monoid.has_sizeof_inst
- 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.
Instances of this typeclass
- add_cancel_monoid.to_add_left_cancel_monoid
- add_cancel_comm_monoid.to_add_left_cancel_monoid
- add_opposite.left_cancel_add_monoid
- additive.add_left_cancel_monoid
- pi.add_left_cancel_monoid
- order_dual.left_cancel_add_monoid
- lex.left_cancel_add_monoid
- prod.left_cancel_add_monoid
- ulift.add_left_cancel_monoid
Instances of other typeclasses for add_left_cancel_monoid
- add_left_cancel_monoid.has_sizeof_inst
- 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.
Instances of this typeclass
Instances of other typeclasses for left_cancel_monoid
- left_cancel_monoid.has_sizeof_inst
- 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.
Instances of this typeclass
Instances of other typeclasses for add_right_cancel_monoid
- add_right_cancel_monoid.has_sizeof_inst
- 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.
Instances of this typeclass
Instances of other typeclasses for right_cancel_monoid
- right_cancel_monoid.has_sizeof_inst
- 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.
Instances of this typeclass
Instances of other typeclasses for add_cancel_monoid
- add_cancel_monoid.has_sizeof_inst
- 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.
Instances of this typeclass
Instances of other typeclasses for cancel_monoid
- cancel_monoid.has_sizeof_inst
- 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
.
Instances of this typeclass
Instances of other typeclasses for add_cancel_comm_monoid
- add_cancel_comm_monoid.has_sizeof_inst
- 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
.
Instances of this typeclass
Instances of other typeclasses for cancel_comm_monoid
- cancel_comm_monoid.has_sizeof_inst
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 := _}
Any cancel_monoid M
satisfies is_cancel_mul M
.
Any add_cancel_monoid M
satisfies is_cancel_add M
.
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.
Auxiliary typeclass for types with an involutive has_neg
.
Instances of this typeclass
- subtraction_monoid.to_has_involutive_neg
- has_distrib_neg.to_has_involutive_neg
- mul_opposite.has_involutive_neg
- add_opposite.has_involutive_neg
- additive.has_involutive_neg
- pi.has_involutive_neg
- order_dual.has_involutive_neg
- lex.has_involutive_neg
- prod.has_involutive_neg
- with_zero.has_involutive_neg
- fin.has_involutive_neg
- set.has_involutive_neg
- add_submonoid.has_involutive_neg
- ray_vector.has_involutive_neg
- module.ray.has_involutive_neg
Instances of other typeclasses for has_involutive_neg
- has_involutive_neg.has_sizeof_inst
Auxiliary typeclass for types with an involutive has_inv
.
Instances of this typeclass
- division_monoid.to_has_involutive_inv
- mul_opposite.has_involutive_inv
- add_opposite.has_involutive_inv
- multiplicative.has_involutive_inv
- pi.has_involutive_inv
- order_dual.has_involutive_inv
- lex.has_involutive_inv
- prod.has_involutive_inv
- with_one.has_involutive_inv
- with_zero.has_involutive_inv
- set.has_involutive_inv
- submonoid.has_involutive_inv
- ennreal.has_involutive_inv
Instances of other typeclasses for has_involutive_inv
- has_involutive_inv.has_sizeof_inst
Design note on div_inv_monoid
/sub_neg_monoid
and division_monoid
/subtraction_monoid
#
Those two pairs of made-up classes fulfill slightly different roles.
div_inv_monoid
/sub_neg_monoid
provides the minimum amount of information to define the
ℤ
action (zpow
or zsmul
). Further, it provides a div
field, matching the forgetful
inheritance pattern. This is useful to shorten extension clauses of stronger structures (group
,
group_with_zero
, division_ring
, field
) and for a few structures with a rather weak
pseudo-inverse (matrix
).
division_monoid
/subtraction_monoid
is targeted at structures with stronger pseudo-inverses. It
is an ad hoc collection of axioms that are mainly respected by three things:
It acts as a middle ground for structures with an inversion operator that plays well with
multiplication, except for the fact that it might not be a true inverse (a / a ≠ 1
in general).
The axioms are pretty arbitrary (many other combinations are equivalent to it), but they are
independent:
- Without
division_monoid.div_eq_mul_inv
, you can define/
arbitrarily. - Without
division_monoid.inv_inv
, you can considerwith_top unit
witha⁻¹ = ⊤
for alla
. - Without
division_monoid.mul_inv_rev
, you can considerwith_top α
witha⁻¹ = a
for alla
whereα
non commutative. - Without
division_monoid.inv_eq_of_mul
, you can consider anycomm_monoid
witha⁻¹ = a
for alla
.
As a consequence, a few natural structures do not fit in this framework. For example, ennreal
respects everything except for the fact that (0 * ∞)⁻¹ = 0⁻¹ = ∞
while ∞⁻¹ * 0⁻¹ = 0 * ∞ = 0
.
- 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 deduplicates 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.
Instances of this typeclass
- div_inv_one_monoid.to_div_inv_monoid
- division_monoid.to_div_inv_monoid
- group.to_div_inv_monoid
- group_with_zero.to_div_inv_monoid
- division_ring.to_div_inv_monoid
- mul_opposite.div_inv_monoid
- add_opposite.div_inv_monoid
- multiplicative.div_inv_monoid
- pi.div_inv_monoid
- order_dual.div_inv_monoid
- lex.div_inv_monoid
- prod.div_inv_monoid
- with_zero.div_inv_monoid
- ulift.div_inv_monoid
- conj_act.div_inv_monoid
- ennreal.div_inv_monoid
Instances of other typeclasses for div_inv_monoid
- div_inv_monoid.has_sizeof_inst
- 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.
Instances of this typeclass
- sub_neg_zero_monoid.to_sub_neg_monoid
- subtraction_monoid.to_sub_neg_monoid
- add_group.to_sub_neg_monoid
- linear_ordered_add_comm_group_with_top.to_sub_neg_monoid
- mul_opposite.sub_neg_monoid
- add_opposite.sub_neg_monoid
- additive.sub_neg_monoid
- pi.sub_neg_monoid
- order_dual.sub_neg_add_monoid
- lex.sub_neg_add_monoid
- prod.sub_neg_monoid
- ulift.sub_neg_add_monoid
- uniform_space.completion.sub_neg_monoid
Instances of other typeclasses for sub_neg_monoid
- sub_neg_monoid.has_sizeof_inst
Equations
- div_inv_monoid.has_pow = {pow := λ (x : M) (n : ℤ), div_inv_monoid.zpow n x}
Equations
- sub_neg_monoid.has_smul_int = {smul := sub_neg_monoid.zsmul _inst_1}
Dividing by an element is the same as multiplying by its inverse.
This is a duplicate of div_inv_monoid.div_eq_mul_inv
ensuring that the types unfold better.
Subtracting an element is the same as adding by its negative.
This is a duplicate of sub_neg_monoid.sub_eq_mul_neg
ensuring that the types unfold better.
Alias of div_eq_mul_inv
.
Typeclass for expressing that -0 = 0
.
Instances of this typeclass
Instances of other typeclasses for neg_zero_class
- neg_zero_class.has_sizeof_inst
- 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_zero_monoid.nsmul 0 x = 0) . "try_refl_tac"
- nsmul_succ' : (∀ (n : ℕ) (x : G), sub_neg_zero_monoid.nsmul n.succ x = x + sub_neg_zero_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_zero_monoid.zsmul 0 a = 0) . "try_refl_tac"
- zsmul_succ' : (∀ (n : ℕ) (a : G), sub_neg_zero_monoid.zsmul (int.of_nat n.succ) a = a + sub_neg_zero_monoid.zsmul (int.of_nat n) a) . "try_refl_tac"
- zsmul_neg' : (∀ (n : ℕ) (a : G), sub_neg_zero_monoid.zsmul -[1+ n] a = -sub_neg_zero_monoid.zsmul ↑(n.succ) a) . "try_refl_tac"
- neg_zero : -0 = 0
A sub_neg_monoid
where -0 = 0
.
Instances of this typeclass
Instances of other typeclasses for sub_neg_zero_monoid
- sub_neg_zero_monoid.has_sizeof_inst
Typeclass for expressing that 1⁻¹ = 1
.
Instances of this typeclass
Instances of other typeclasses for inv_one_class
- inv_one_class.has_sizeof_inst
- 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_one_monoid.npow 0 x = 1) . "try_refl_tac"
- npow_succ' : (∀ (n : ℕ) (x : G), div_inv_one_monoid.npow n.succ x = x * div_inv_one_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_one_monoid.zpow 0 a = 1) . "try_refl_tac"
- zpow_succ' : (∀ (n : ℕ) (a : G), div_inv_one_monoid.zpow (int.of_nat n.succ) a = a * div_inv_one_monoid.zpow (int.of_nat n) a) . "try_refl_tac"
- zpow_neg' : (∀ (n : ℕ) (a : G), div_inv_one_monoid.zpow -[1+ n] a = (div_inv_one_monoid.zpow ↑(n.succ) a)⁻¹) . "try_refl_tac"
- inv_one : 1⁻¹ = 1
A div_inv_monoid
where 1⁻¹ = 1
.
Instances of this typeclass
Instances of other typeclasses for div_inv_one_monoid
- div_inv_one_monoid.has_sizeof_inst
- 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), subtraction_monoid.nsmul 0 x = 0) . "try_refl_tac"
- nsmul_succ' : (∀ (n : ℕ) (x : G), subtraction_monoid.nsmul n.succ x = x + subtraction_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), subtraction_monoid.zsmul 0 a = 0) . "try_refl_tac"
- zsmul_succ' : (∀ (n : ℕ) (a : G), subtraction_monoid.zsmul (int.of_nat n.succ) a = a + subtraction_monoid.zsmul (int.of_nat n) a) . "try_refl_tac"
- zsmul_neg' : (∀ (n : ℕ) (a : G), subtraction_monoid.zsmul -[1+ n] a = -subtraction_monoid.zsmul ↑(n.succ) a) . "try_refl_tac"
- neg_neg : ∀ (x : G), --x = x
- neg_add_rev : ∀ (a b : G), -(a + b) = -b + -a
- neg_eq_of_add : ∀ (a b : G), a + b = 0 → -a = b
A subtraction_monoid
is a sub_neg_monoid
with involutive negation and such that
-(a + b) = -b + -a
and a + b = 0 → -a = b
.
Instances of this typeclass
Instances of other typeclasses for subtraction_monoid
- subtraction_monoid.has_sizeof_inst
- 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), division_monoid.npow 0 x = 1) . "try_refl_tac"
- npow_succ' : (∀ (n : ℕ) (x : G), division_monoid.npow n.succ x = x * division_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), division_monoid.zpow 0 a = 1) . "try_refl_tac"
- zpow_succ' : (∀ (n : ℕ) (a : G), division_monoid.zpow (int.of_nat n.succ) a = a * division_monoid.zpow (int.of_nat n) a) . "try_refl_tac"
- zpow_neg' : (∀ (n : ℕ) (a : G), division_monoid.zpow -[1+ n] a = (division_monoid.zpow ↑(n.succ) a)⁻¹) . "try_refl_tac"
- inv_inv : ∀ (x : G), x⁻¹⁻¹ = x
- mul_inv_rev : ∀ (a b : G), (a * b)⁻¹ = b⁻¹ * a⁻¹
- inv_eq_of_mul : ∀ (a b : G), a * b = 1 → a⁻¹ = b
A division_monoid
is a div_inv_monoid
with involutive inversion and such that
(a * b)⁻¹ = b⁻¹ * a⁻¹
and a * b = 1 → a⁻¹ = b
.
This is the immediate common ancestor of group
and group_with_zero
.
Instances of this typeclass
Instances of other typeclasses for division_monoid
- division_monoid.has_sizeof_inst
- 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), subtraction_comm_monoid.nsmul 0 x = 0) . "try_refl_tac"
- nsmul_succ' : (∀ (n : ℕ) (x : G), subtraction_comm_monoid.nsmul n.succ x = x + subtraction_comm_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), subtraction_comm_monoid.zsmul 0 a = 0) . "try_refl_tac"
- zsmul_succ' : (∀ (n : ℕ) (a : G), subtraction_comm_monoid.zsmul (int.of_nat n.succ) a = a + subtraction_comm_monoid.zsmul (int.of_nat n) a) . "try_refl_tac"
- zsmul_neg' : (∀ (n : ℕ) (a : G), subtraction_comm_monoid.zsmul -[1+ n] a = -subtraction_comm_monoid.zsmul ↑(n.succ) a) . "try_refl_tac"
- neg_neg : ∀ (x : G), --x = x
- neg_add_rev : ∀ (a b : G), -(a + b) = -b + -a
- neg_eq_of_add : ∀ (a b : G), a + b = 0 → -a = b
- add_comm : ∀ (a b : G), a + b = b + a
Commutative subtraction_monoid
.
Instances of this typeclass
Instances of other typeclasses for subtraction_comm_monoid
- subtraction_comm_monoid.has_sizeof_inst
- 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), division_comm_monoid.npow 0 x = 1) . "try_refl_tac"
- npow_succ' : (∀ (n : ℕ) (x : G), division_comm_monoid.npow n.succ x = x * division_comm_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), division_comm_monoid.zpow 0 a = 1) . "try_refl_tac"
- zpow_succ' : (∀ (n : ℕ) (a : G), division_comm_monoid.zpow (int.of_nat n.succ) a = a * division_comm_monoid.zpow (int.of_nat n) a) . "try_refl_tac"
- zpow_neg' : (∀ (n : ℕ) (a : G), division_comm_monoid.zpow -[1+ n] a = (division_comm_monoid.zpow ↑(n.succ) a)⁻¹) . "try_refl_tac"
- inv_inv : ∀ (x : G), x⁻¹⁻¹ = x
- mul_inv_rev : ∀ (a b : G), (a * b)⁻¹ = b⁻¹ * a⁻¹
- inv_eq_of_mul : ∀ (a b : G), a * b = 1 → a⁻¹ = b
- mul_comm : ∀ (a b : G), a * b = b * a
Commutative division_monoid
.
This is the immediate common ancestor of comm_group
and comm_group_with_zero
.
Instances of this typeclass
Instances of other typeclasses for division_comm_monoid
- division_comm_monoid.has_sizeof_inst
- 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 of this typeclass
- subgroup_class.to_group
- comm_group.to_group
- seminormed_group.to_group
- normed_group.to_group
- units.group
- mul_opposite.group
- add_opposite.group
- multiplicative.group
- pi.group
- order_dual.group
- lex.group
- prod.group
- equiv.perm.perm_group
- mul_aut.group
- add_aut.group
- ring_aut.group
- ulift.group
- linear_equiv.automorphism_group
- subgroup.to_group
- con.group
- alg_equiv.aut
- conj_act.group
- quotient_group.quotient.group
- affine_equiv.group
- isometry_equiv.group
- continuous_linear_equiv.automorphism_group
- linear_isometry_equiv.group
- unitary.group
- affine_isometry_equiv.group
- uniform_fun.group
- uniform_on_fun.group
- matrix.special_linear_group.group
Instances of other typeclasses for group
- group.has_sizeof_inst
- 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 of this typeclass
- add_subgroup_class.to_add_group
- add_comm_group.to_add_group
- add_group_with_one.to_add_group
- seminormed_add_group.to_add_group
- normed_add_group.to_add_group
- add_units.add_group
- mul_opposite.add_group
- add_opposite.add_group
- additive.add_group
- pi.add_group
- order_dual.add_group
- lex.add_group
- prod.add_group
- int.add_group
- rat.add_group
- ulift.add_group
- add_subgroup.to_add_group
- dfinsupp.add_group
- finsupp.add_group
- add_con.add_group
- quotient_add_group.quotient.add_group
- matrix.add_group
- cau_seq.add_group
- real.add_group
- uniform_space.completion.add_group
- uniform_fun.add_group
- uniform_on_fun.add_group
- dmatrix.add_group
Instances of other typeclasses for add_group
- add_group.has_sizeof_inst
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_division_monoid = {mul := group.mul _inst_1, mul_assoc := _, one := group.one _inst_1, one_mul := _, mul_one := _, npow := group.npow _inst_1, npow_zero' := _, npow_succ' := _, inv := group.inv _inst_1, div := group.div _inst_1, div_eq_mul_inv := _, zpow := group.zpow _inst_1, zpow_zero' := _, zpow_succ' := _, zpow_neg' := _, inv_inv := _, mul_inv_rev := _, inv_eq_of_mul := _}
Equations
- add_group.to_subtraction_monoid = {add := add_group.add _inst_1, add_assoc := _, zero := add_group.zero _inst_1, zero_add := _, add_zero := _, nsmul := add_group.nsmul _inst_1, nsmul_zero' := _, nsmul_succ' := _, neg := add_group.neg _inst_1, sub := add_group.sub _inst_1, sub_eq_add_neg := _, zsmul := add_group.zsmul _inst_1, zsmul_zero' := _, zsmul_succ' := _, zsmul_neg' := _, neg_neg := _, neg_add_rev := _, neg_eq_of_add := _}
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 of this typeclass
- subgroup_class.to_comm_group
- ordered_comm_group.to_comm_group
- seminormed_comm_group.to_comm_group
- normed_comm_group.to_comm_group
- units.comm_group
- mul_opposite.comm_group
- add_opposite.comm_group
- multiplicative.comm_group
- monoid_hom.comm_group
- pi.comm_group
- order_dual.comm_group
- lex.comm_group
- prod.comm_group
- ulift.comm_group
- punit.comm_group
- subgroup.to_comm_group
- subgroup.is_commutative.comm_group
- quotient_group.quotient.comm_group
- unitary.comm_group
- uniform_fun.comm_group
- uniform_on_fun.comm_group
Instances of other typeclasses for comm_group
- comm_group.has_sizeof_inst
- 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 of this typeclass
- add_subgroup_class.to_add_comm_group
- add_comm_group_with_one.to_add_comm_group
- non_unital_non_assoc_ring.to_add_comm_group
- ordered_add_comm_group.to_add_comm_group
- add_group_with_zero_nhd.to_add_comm_group
- seminormed_add_comm_group.to_add_comm_group
- normed_add_comm_group.to_add_comm_group
- add_units.add_comm_group
- mul_opposite.add_comm_group
- add_opposite.add_comm_group
- additive.add_comm_group
- add_monoid_hom.add_comm_group
- add_monoid.End.add_comm_group
- pi.add_comm_group
- order_dual.add_comm_group
- lex.add_comm_group
- prod.add_comm_group
- int.add_comm_group
- rat.add_comm_group
- fin.add_comm_group
- ulift.add_comm_group
- linear_map.add_comm_group
- punit.add_comm_group
- add_subgroup.to_add_comm_group
- add_subgroup.is_commutative.add_comm_group
- submodule.add_comm_group
- dfinsupp.add_comm_group
- finsupp.add_comm_group
- tensor_product.add_comm_group
- quotient_add_group.quotient.add_comm_group
- submodule.quotient.add_comm_group
- restrict_scalars.add_comm_group
- direct_sum.add_comm_group
- matrix.add_comm_group
- direct_sum.add_comm_group_set_like
- affine_map.add_comm_group
- bilin_form.add_comm_group
- real.add_comm_group
- complex.add_comm_group
- normed_add_group_hom.add_comm_group
- continuous_linear_map.add_comm_group
- uniform_space.completion.add_comm_group
- uniform_fun.add_comm_group
- uniform_on_fun.add_comm_group
- multilinear_map.add_comm_group
- continuous_multilinear_map.add_comm_group
- alternating_map.add_comm_group
- monoid_algebra.add_comm_group
- add_monoid_algebra.add_comm_group
- add_circle.add_comm_group
- formal_multilinear_series.add_comm_group
- weak_bilin.add_comm_group
- dmatrix.add_comm_group
- quadratic_form.add_comm_group
Instances of other typeclasses for add_comm_group
- add_comm_group.has_sizeof_inst
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 := _}
Equations
- add_comm_group.to_division_add_comm_monoid = {add := add_comm_group.add _inst_1, add_assoc := _, zero := add_comm_group.zero _inst_1, zero_add := _, add_zero := _, nsmul := add_comm_group.nsmul _inst_1, nsmul_zero' := _, nsmul_succ' := _, neg := add_comm_group.neg _inst_1, sub := add_comm_group.sub _inst_1, sub_eq_add_neg := _, zsmul := add_comm_group.zsmul _inst_1, zsmul_zero' := _, zsmul_succ' := _, zsmul_neg' := _, neg_neg := _, neg_add_rev := _, neg_eq_of_add := _, add_comm := _}
Equations
- comm_group.to_division_comm_monoid = {mul := comm_group.mul _inst_1, mul_assoc := _, one := comm_group.one _inst_1, one_mul := _, mul_one := _, npow := comm_group.npow _inst_1, npow_zero' := _, npow_succ' := _, inv := comm_group.inv _inst_1, div := comm_group.div _inst_1, div_eq_mul_inv := _, zpow := comm_group.zpow _inst_1, zpow_zero' := _, zpow_succ' := _, zpow_neg' := _, inv_inv := _, mul_inv_rev := _, inv_eq_of_mul := _, mul_comm := _}