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
- order_dual.has_vadd
- order_dual.has_vadd'
- lex.has_vadd
- lex.has_vadd'
- add_opposite.has_vadd
- additive.has_vadd
- add_units.has_vadd
- pi.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
- filter.germ.has_vadd
- filter.germ.has_vadd'
- continuous_map.has_vadd
- upper_set.has_vadd
- lower_set.has_vadd
- function.embedding.has_vadd
- option.has_vadd
- sum.has_vadd
- sigma.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
- mul_action.to_has_smul
- smul_zero_class.to_has_smul
- rat.smul_division_ring
- derivation.has_smul
- set_like.has_smul
- has_mul.to_has_smul
- add_monoid.has_smul_nat
- sub_neg_monoid.has_smul_int
- order_dual.has_smul
- order_dual.has_smul'
- lex.has_smul
- lex.has_smul'
- mul_opposite.has_smul
- multiplicative.has_smul
- units.has_smul
- pi.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
- localization.has_smul
- ring_con.quotient.has_smul
- ring_con.has_zsmul
- ring_con.has_nsmul
- self_adjoint.has_qsmul
- self_adjoint.has_smul
- skew_adjoint.has_smul
- matrix.has_smul
- multilinear_map.has_smul
- alternating_map.has_smul
- subfield_class.has_smul
- free_algebra.has_smul
- adjoin_root.has_smul
- polynomial.splitting_field.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
- measure_theory.outer_measure.has_smul
- measure_theory.measure.has_smul
- measure_theory.simple_func.has_smul
- bilin_form.has_smul
- seminorm.has_smul
- continuous_multilinear_map.has_smul
- box_integral.box_additive_map.has_smul
- filter.germ.has_smul
- filter.germ.has_smul'
- continuous_map.has_nsmul
- continuous_map.has_zsmul
- continuous_map.has_smul
- continuous_map.has_smul'
- bounded_continuous_function.has_nat_scalar
- bounded_continuous_function.has_int_scalar
- bounded_continuous_function.has_smul
- bounded_continuous_function.has_smul'
- measure_theory.ae_eq_fun.has_smul
- hahn_series.has_smul
- hahn_series.summable_family.has_smul
- ratfunc.has_smul
- measure_theory.vector_measure.has_smul
- measure_theory.jordan_decomposition.has_smul
- measure_theory.jordan_decomposition.has_smul_real
- homological_complex.has_nat_scalar
- homological_complex.has_int_scalar
- Group.surjective_of_epi_auxs.X_with_infinity.has_smul
- measure_theory.finite_measure.has_smul
- upper_set.has_smul
- lower_set.has_smul
- continuous_affine_map.has_smul
- triv_sq_zero_ext.has_smul
- locally_constant.has_smul
- zero_at_infty_continuous_map.has_nat_scalar
- zero_at_infty_continuous_map.has_int_scalar
- zero_at_infty_continuous_map.has_smul
- category_theory.Sheaf_hom_has_zsmul
- category_theory.Sheaf_hom_has_nsmul
- schwartz_map.has_smul
- schwartz_map.has_nsmul
- schwartz_map.has_zsmul
- quaternion_algebra.has_smul
- quaternion.has_smul
- double_centralizer.has_smul
- upper_half_plane.SL_on_GL_pos
- upper_half_plane.subgroup_GL_pos
- upper_half_plane.subgroup_SL
- convex_body.has_smul
- submodule.torsion'.has_smul
- fractional_ideal.has_smul
- graded_monoid.grade_zero.has_smul
- homogeneous_localization.num_denom_same_deg.has_smul
- homogeneous_localization.has_smul
- witt_vector.has_nat_scalar
- witt_vector.has_int_scalar
- truncated_witt_vector.has_nat_scalar
- truncated_witt_vector.has_int_scalar
- lie_module_hom.has_nsmul
- lie_module_hom.has_zsmul
- lie_module_hom.has_smul
- nat.arithmetic_function.has_smul
- slash_invariant_form.has_smul
- modular_form.has_smul
- cusp_form.has_smul
- smooth_map.has_smul
- smooth_map.has_smul'
- cont_mdiff_section.has_smul
- cont_mdiff_section.has_nsmul
- cont_mdiff_section.has_zsmul
- left_invariant_derivation.has_nat_scalar
- left_invariant_derivation.has_int_scalar
- left_invariant_derivation.has_smul
- ring_quot.has_smul
- sym_alg.has_smul
- graded_monoid.ghas_smul.to_has_smul
- localized_module.has_nat_smul
- localized_module.has_smul
- direct_sum.gmodule.direct_sum.has_smul
- free_lie_algebra.has_smul
- nonempty_interval.has_nsmul
- centroid_hom.has_nsmul
- centroid_hom.has_zsmul
- category_theory.Module.coextend_scalars.has_smul
- Module.filtered_colimits.colimit_has_smul
- unitization.has_smul
- pi_tensor_product.has_smul'
- pi_tensor_product.has_smul
- quadratic_form.has_smul
- holor.has_smul
- finsupp.pointwise_scalar
- hamming.has_smul
- function.embedding.has_smul
- option.has_smul
- sum.has_smul
- sigma.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
Instances for semigroup.to_has_mul
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
- order_dual.semigroup
- lex.semigroup
- multiplicative.semigroup
- nat.semigroup
- int.semigroup
- mul_opposite.semigroup
- add_opposite.semigroup
- pi.semigroup
- rat.semigroup
- prod.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
- filter.germ.semigroup
- continuous_map.semigroup
- metric.ball.semigroup
- metric.closed_ball.semigroup
- locally_constant.semigroup
- zsqrtd.semigroup
- smooth_map.semigroup
- magma.assoc_quotient.semigroup
- free_semigroup.semigroup
- semigroup_pempty
- tropical.semigroup
- Semigroup.semigroup
Instances of other typeclasses for semigroup
- semigroup.has_sizeof_inst
Instances for add_semigroup.to_has_add
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
- order_dual.add_semigroup
- lex.add_semigroup
- additive.add_semigroup
- nat.add_semigroup
- with_top.add_semigroup
- with_bot.add_semigroup
- int.add_semigroup
- mul_opposite.add_semigroup
- add_opposite.add_semigroup
- pi.add_semigroup
- rat.add_semigroup
- prod.add_semigroup
- ulift.add_semigroup
- add_mem_class.to_add_semigroup
- positive.subtype.add_semigroup
- add_con.add_semigroup
- matrix.add_semigroup
- dmatrix.add_semigroup
- real.add_semigroup
- filter.germ.add_semigroup
- continuous_map.add_semigroup
- triv_sq_zero_ext.add_semigroup
- locally_constant.add_semigroup
- zsqrtd.add_semigroup
- smooth_map.add_semigroup
- add_magma.free_add_semigroup.add_semigroup
- free_add_semigroup.add_semigroup
- add_semigroup_pempty
- AddSemigroup.add_semigroup
- unitization.add_semigroup
- holor.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
- order_dual.comm_semigroup
- lex.comm_semigroup
- multiplicative.comm_semigroup
- with_zero.comm_semigroup
- nat.comm_semigroup
- int.comm_semigroup
- mul_opposite.comm_semigroup
- add_opposite.comm_semigroup
- pi.comm_semigroup
- rat.comm_semigroup
- prod.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
- filter.germ.comm_semigroup
- continuous_map.comm_semigroup
- metric.ball.comm_semigroup
- upper_set.comm_semigroup
- lower_set.comm_semigroup
- locally_constant.comm_semigroup
- complex.unit_disc.comm_semigroup
- zsqrtd.comm_semigroup
- tropical.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
- order_dual.add_comm_semigroup
- lex.add_comm_semigroup
- additive.add_comm_semigroup
- nat.add_comm_semigroup
- with_top.add_comm_semigroup
- with_bot.add_comm_semigroup
- int.add_comm_semigroup
- mul_opposite.add_comm_semigroup
- add_opposite.add_comm_semigroup
- fin.add_comm_semigroup
- pi.add_comm_semigroup
- rat.add_comm_semigroup
- prod.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
- dmatrix.add_comm_semigroup
- real.add_comm_semigroup
- filter.germ.add_comm_semigroup
- continuous_map.add_comm_semigroup
- convex_cone.add_comm_semigroup
- pos_num.add_comm_semigroup
- upper_set.add_comm_semigroup
- lower_set.add_comm_semigroup
- triv_sq_zero_ext.add_comm_semigroup
- locally_constant.add_comm_semigroup
- zsqrtd.add_comm_semigroup
- sym_alg.add_comm_semigroup
- tropical.add_comm_semigroup
- free_lie_algebra.add_comm_semigroup
- unitization.add_comm_semigroup
- holor.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
- left_cancel_monoid.to_left_cancel_semigroup
- order_dual.left_cancel_semigroup
- lex.left_cancel_semigroup
- multiplicative.left_cancel_semigroup
- mul_opposite.left_cancel_semigroup
- add_opposite.left_cancel_semigroup
- pi.left_cancel_semigroup
- prod.left_cancel_semigroup
- ulift.left_cancel_semigroup
- filter.germ.left_cancel_semigroup
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
- order_dual.left_cancel_add_semigroup
- lex.left_cancel_add_semigroup
- additive.add_left_cancel_semigroup
- mul_opposite.add_left_cancel_semigroup
- add_opposite.left_cancel_add_semigroup
- fin.add_left_cancel_semigroup
- pi.add_left_cancel_semigroup
- rat.add_left_cancel_semigroup
- prod.left_cancel_add_semigroup
- ulift.add_left_cancel_semigroup
- positive.subtype.add_left_cancel_semigroup
- pnat.add_left_cancel_semigroup
- real.add_left_cancel_semigroup
- filter.germ.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
- right_cancel_monoid.to_right_cancel_semigroup
- order_dual.right_cancel_semigroup
- lex.right_cancel_semigroup
- multiplicative.right_cancel_semigroup
- mul_opposite.right_cancel_semigroup
- add_opposite.right_cancel_semigroup
- pi.right_cancel_semigroup
- prod.right_cancel_semigroup
- ulift.right_cancel_semigroup
- filter.germ.right_cancel_semigroup
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
- order_dual.right_cancel_add_semigroup
- lex.right_cancel_add_semigroup
- additive.add_right_cancel_semigroup
- mul_opposite.add_right_cancel_semigroup
- add_opposite.right_cancel_add_semigroup
- fin.add_right_cancel_semigroup
- pi.add_right_cancel_semigroup
- rat.add_right_cancel_semigroup
- prod.right_cancel_add_semigroup
- ulift.add_right_cancel_semigroup
- positive.subtype.add_right_cancel_semigroup
- pnat.add_right_cancel_semigroup
- real.add_right_cancel_semigroup
- filter.germ.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
- order_dual.mul_one_class
- lex.mul_one_class
- multiplicative.mul_one_class
- with_one.mul_one_class
- mul_opposite.mul_one_class
- add_opposite.mul_one_class
- pi.mul_one_class
- prod.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
- continuous_map.mul_one_class
- triv_sq_zero_ext.mul_one_class
- locally_constant.mul_one_class
- tropical.mul_one_class
- interval.mul_one_class
- unitization.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
- order_dual.add_zero_class
- lex.add_zero_class
- additive.add_zero_class
- with_zero.add_zero_class
- with_top.add_zero_class
- with_bot.add_zero_class
- mul_opposite.add_zero_class
- add_opposite.add_zero_class
- pi.add_zero_class
- prod.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
- continuous_map.add_zero_class
- convex_cone.add_zero_class
- triv_sq_zero_ext.add_zero_class
- locally_constant.add_zero_class
- zero_at_infty_continuous_map.add_zero_class
- interval.add_zero_class
- unitization.add_zero_class
- dfinsupp.add_zero_class'
- weierstrass_curve.point.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
- order_dual.add_monoid
- lex.add_monoid
- additive.add_monoid
- with_zero.add_monoid
- nat.add_monoid
- with_top.add_monoid
- with_bot.add_monoid
- int.add_monoid
- mul_opposite.add_monoid
- add_opposite.add_monoid
- pi.add_monoid
- rat.add_monoid
- prod.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
- dmatrix.add_monoid
- real.add_monoid
- ereal.add_monoid
- measure_theory.simple_func.add_monoid
- uniform_space.completion.add_monoid
- seminorm.add_monoid
- uniform_fun.add_monoid
- uniform_on_fun.add_monoid
- filter.germ.add_monoid
- continuous_map.add_monoid
- bounded_continuous_function.add_monoid
- measure_theory.ae_eq_fun.add_monoid
- mv_power_series.add_monoid
- power_series.add_monoid
- hahn_series.add_monoid
- num.add_monoid
- AddMon.add_monoid
- AddMon.add_monoid_obj
- AddMon.limit_add_monoid
- triv_sq_zero_ext.add_monoid
- locally_constant.add_monoid
- zero_at_infty_continuous_map.add_monoid
- AddMon.filtered_colimits.colimit_add_monoid
- convex_body.add_monoid
- nat.arithmetic_function.add_monoid
- zsqrtd.add_monoid
- smooth_map.add_monoid
- sym_alg.add_monoid
- unitization.add_monoid
- holor.add_monoid
- hamming.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
- order_dual.monoid
- lex.monoid
- monoid.End.monoid
- add_monoid.End.monoid
- multiplicative.monoid
- function.End.monoid
- ring_hom.monoid
- with_one.monoid
- nat.monoid
- int.monoid
- mul_opposite.monoid
- add_opposite.monoid
- pi.monoid
- rat.monoid
- prod.monoid
- ulift.monoid
- module.End.monoid
- submonoid.to_monoid
- positive.subtype.monoid
- alg_hom.End
- con.monoid
- add_submonoid.monoid
- sub_mul_action.monoid
- ordinal.monoid
- real.monoid
- linear_isometry.monoid
- non_unital_star_alg_hom.monoid
- star_alg_hom.monoid
- measure_theory.simple_func.monoid
- affine_map.monoid
- set.Ioc.monoid
- affine_isometry.monoid
- uniform_fun.monoid
- uniform_on_fun.monoid
- filter.germ.monoid
- continuous_map.monoid
- measure_theory.ae_eq_fun.monoid
- metric.closed_ball.monoid
- metric.sphere.monoid
- matrix.special_linear_group.monoid
- Mon.monoid
- category_theory.End.monoid
- Mon.monoid_obj
- Mon.limit_monoid
- triv_sq_zero_ext.monoid
- dilation.monoid
- locally_constant.monoid
- Mon.filtered_colimits.colimit_monoid
- category_theory.skeleton.monoid
- Mon_Type_equivalence_Mon.Mon_monoid
- circle_deg1_lift.monoid
- graded_monoid.gmonoid.to_monoid
- graded_monoid.grade_zero.monoid
- ore_localization.monoid
- nat.arithmetic_function.monoid
- zsqrtd.monoid
- lucas_lehmer.X.monoid
- smooth_map.monoid
- tropical.monoid
- Mon.colimits.monoid_colimit_type
- unitization.monoid
- free_product.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}
Instances for add_comm_monoid.to_add_monoid
- 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
- order_dual.add_comm_monoid
- lex.add_comm_monoid
- additive.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
- mul_opposite.add_comm_monoid
- add_opposite.add_comm_monoid
- fin.add_comm_monoid
- add_monoid_hom.add_comm_monoid
- add_monoid.End.add_comm_monoid
- pi.add_comm_monoid
- rat.add_comm_monoid
- prod.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
- monoid_algebra.add_comm_monoid
- add_monoid_algebra.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
- add_localization.add_comm_monoid
- restrict_scalars.add_comm_monoid
- dfinsupp.add_comm_monoid_of_linear_map
- direct_sum.add_comm_monoid
- matrix.add_comm_monoid
- multilinear_map.add_comm_monoid
- alternating_map.add_comm_monoid
- dmatrix.add_comm_monoid
- real.add_comm_monoid
- continuous_linear_map.add_comm_monoid
- measure_theory.outer_measure.add_comm_monoid
- measure_theory.measure.add_comm_monoid
- measure_theory.simple_func.add_comm_monoid
- bilin_form.add_comm_monoid
- uniform_fun.add_comm_monoid
- uniform_on_fun.add_comm_monoid
- continuous_multilinear_map.add_comm_monoid
- box_integral.box_additive_map.add_comm_monoid
- filter.germ.add_comm_monoid
- continuous_map.add_comm_monoid
- bounded_continuous_function.add_comm_monoid
- bounded_continuous_function.add_add_comm_monoid
- measure_theory.ae_eq_fun.add_comm_monoid
- weak_bilin.add_comm_monoid
- weak_dual.add_comm_monoid
- weak_space.add_comm_monoid
- mv_power_series.add_comm_monoid
- power_series.add_comm_monoid
- hahn_series.add_comm_monoid
- hahn_series.summable_family.add_comm_monoid
- measure_theory.vector_measure.add_comm_monoid
- representation.as_module.add_comm_monoid
- AddCommMon.add_comm_monoid
- AddCommMon.add_comm_monoid_obj
- AddCommMon.limit_add_comm_monoid
- Module.limit_add_comm_monoid
- measure_theory.finite_measure.add_comm_monoid
- upper_set.add_comm_monoid
- lower_set.add_comm_monoid
- triv_sq_zero_ext.add_comm_monoid
- vector_bundle_core.add_comm_monoid_fiber
- bundle.pullback.add_comm_monoid
- locally_constant.add_comm_monoid
- derivation.add_comm_monoid
- zero_at_infty_continuous_map.add_comm_monoid
- AddCommMon.filtered_colimits.colimit_add_comm_monoid
- convex_body.add_comm_monoid
- add_comm_monoid.of_submonoid_on_semiring
- ore_localization.add_comm_monoid
- lie_subalgebra.add_comm_monoid
- lie_submodule.add_comm_monoid
- nat.arithmetic_function.add_comm_monoid
- smooth_map.add_comm_monoid
- sym_alg.add_comm_monoid
- tropical.add_comm_monoid
- localized_module.add_comm_monoid
- nonempty_interval.add_comm_monoid
- interval.add_comm_monoid
- add_freiman_hom.add_comm_monoid
- centroid_hom.add_comm_monoid
- unitization.add_comm_monoid
- pi_tensor_product.add_comm_monoid
- quadratic_form.add_comm_monoid
- holor.add_comm_monoid
- hamming.add_comm_monoid
- counterexample.F.add_comm_monoid
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
- order_dual.comm_monoid
- lex.comm_monoid
- multiplicative.comm_monoid
- with_one.comm_monoid
- nat.comm_monoid
- int.comm_monoid
- mul_opposite.comm_monoid
- add_opposite.comm_monoid
- monoid_hom.comm_monoid
- pi.comm_monoid
- rat.comm_monoid
- prod.comm_monoid
- ulift.comm_monoid
- associates.comm_monoid
- submonoid.to_comm_monoid
- submonoid.center.comm_monoid
- con.comm_monoid
- localization.comm_monoid
- perfect_closure.comm_monoid
- real.comm_monoid
- measure_theory.simple_func.comm_monoid
- set.Ioc.comm_monoid
- uniform_fun.comm_monoid
- uniform_on_fun.comm_monoid
- filter.germ.comm_monoid
- continuous_map.comm_monoid
- measure_theory.ae_eq_fun.comm_monoid
- metric.closed_ball.comm_monoid
- pos_num.comm_monoid
- CommMon.comm_monoid
- CommMon.comm_monoid_obj
- CommMon.limit_comm_monoid
- upper_set.comm_monoid
- lower_set.comm_monoid
- triv_sq_zero_ext.comm_monoid
- locally_constant.comm_monoid
- CommMon.filtered_colimits.colimit_comm_monoid
- CommMon_Type_equivalence_CommMon.CommMon_comm_monoid
- graded_monoid.gcomm_monoid.to_comm_monoid
- graded_monoid.grade_zero.comm_monoid
- homogeneous_localization.num_denom_same_deg.comm_monoid
- ore_localization.comm_monoid
- zsqrtd.comm_monoid
- add_char.comm_monoid
- smooth_map.comm_monoid
- tropical.comm_monoid
- nonempty_interval.comm_monoid
- interval.comm_monoid
- freiman_hom.comm_monoid
- unitization.comm_monoid
- counterexample.foo.comm_monoid
Instances of other typeclasses for comm_monoid
- comm_monoid.has_sizeof_inst
Instances for comm_monoid.to_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.
Instances of this typeclass
- add_cancel_monoid.to_add_left_cancel_monoid
- add_cancel_comm_monoid.to_add_left_cancel_monoid
- order_dual.left_cancel_add_monoid
- lex.left_cancel_add_monoid
- additive.add_left_cancel_monoid
- add_opposite.left_cancel_add_monoid
- pi.add_left_cancel_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
- add_comm_group.to_cancel_add_comm_monoid
- ordered_cancel_add_comm_monoid.to_cancel_add_comm_monoid
- order_dual.cancel_add_comm_monoid
- lex.cancel_add_comm_monoid
- add_opposite.cancel_add_comm_monoid
- pi.add_cancel_comm_monoid
- prod.cancel_add_comm_monoid
- ulift.add_cancel_comm_monoid
- counterexample.Nxzmod_2.csrN2_1
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
- order_dual.has_involutive_neg
- lex.has_involutive_neg
- additive.has_involutive_neg
- mul_opposite.has_involutive_neg
- add_opposite.has_involutive_neg
- with_zero.has_involutive_neg
- fin.has_involutive_neg
- pi.has_involutive_neg
- prod.has_involutive_neg
- set.has_involutive_neg
- add_submonoid.has_involutive_neg
- ereal.has_involutive_neg
- ray_vector.has_involutive_neg
- module.ray.has_involutive_neg
- metric.sphere.has_involutive_neg
- metric.ball.has_involutive_neg
- metric.closed_ball.has_involutive_neg
- measure_theory.jordan_decomposition.has_involutive_neg
- pgame.has_involutive_neg
- weierstrass_curve.point.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
- order_dual.has_involutive_inv
- lex.has_involutive_inv
- multiplicative.has_involutive_inv
- mul_opposite.has_involutive_inv
- add_opposite.has_involutive_inv
- with_one.has_involutive_inv
- with_zero.has_involutive_inv
- pi.has_involutive_inv
- prod.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
.
Instances for div_inv_monoid.to_monoid
- 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
- order_dual.div_inv_monoid
- lex.div_inv_monoid
- multiplicative.div_inv_monoid
- with_zero.div_inv_monoid
- mul_opposite.div_inv_monoid
- add_opposite.div_inv_monoid
- pi.div_inv_monoid
- prod.div_inv_monoid
- ulift.div_inv_monoid
- conj_act.div_inv_monoid
- ennreal.div_inv_monoid
- filter.germ.div_inv_monoid
- matrix.div_inv_monoid
- rack.envel_group.div_inv_monoid
Instances of other typeclasses for div_inv_monoid
- div_inv_monoid.has_sizeof_inst
Instances for sub_neg_monoid.to_add_monoid
- 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
- order_dual.sub_neg_add_monoid
- lex.sub_neg_add_monoid
- additive.sub_neg_monoid
- mul_opposite.sub_neg_monoid
- add_opposite.sub_neg_monoid
- pi.sub_neg_monoid
- prod.sub_neg_monoid
- ulift.sub_neg_add_monoid
- uniform_space.completion.sub_neg_monoid
- filter.germ.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
- comm_group.to_division_comm_monoid
- comm_group_with_zero.to_division_comm_monoid
- order_dual.division_comm_monoid
- lex.division_comm_monoid
- multiplicative.division_comm_monoid
- with_zero.division_comm_monoid
- mul_opposite.division_comm_monoid
- pi.division_comm_monoid
- prod.division_comm_monoid
- nonempty_interval.division_comm_monoid
- interval.division_comm_monoid
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
- order_dual.group
- lex.group
- multiplicative.group
- mul_opposite.group
- add_opposite.group
- pi.group
- prod.group
- equiv.perm.perm_group
- mul_aut.group
- add_aut.group
- ulift.group
- ring_aut.group
- linear_equiv.automorphism_group
- subgroup.to_group
- alg_equiv.aut
- con.group
- conj_act.group
- quotient_group.quotient.group
- isometry_equiv.group
- continuous_linear_equiv.automorphism_group
- linear_isometry_equiv.group
- unitary.group
- measure_theory.simple_func.group
- affine_equiv.group
- affine_isometry_equiv.group
- uniform_fun.group
- uniform_on_fun.group
- filter.germ.group
- continuous_map.group
- measure_theory.ae_eq_fun.group
- metric.sphere.group
- matrix.special_linear_group.group
- polynomial.gal.group
- free_group.group
- Mon.of.group
- category_theory.End.group
- category_theory.Aut.group
- Group.group
- Group.group_obj
- Group.limit_group
- locally_constant.group
- fundamental_group.group
- homotopy_group.group
- Group.filtered_colimits.colimit_group
- semidirect_product.group
- category_theory.groupoid.vertex_group
- rel_iso.group
- submonoid.is_unit.submonoid.group
- smooth_map.group
- rack.envel_group.group
- tropical.group
- symplectic_group.matrix.symplectic_group.group
- free_product.group
- presented_group.group
- dihedral_group.group
- quaternion_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
- order_dual.add_group
- lex.add_group
- additive.add_group
- int.add_group
- mul_opposite.add_group
- add_opposite.add_group
- pi.add_group
- rat.add_group
- prod.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
- dmatrix.add_group
- cau_seq.add_group
- real.add_group
- measure_theory.simple_func.add_group
- uniform_space.completion.add_group
- uniform_fun.add_group
- uniform_on_fun.add_group
- filter.germ.add_group
- continuous_map.add_group
- measure_theory.ae_eq_fun.add_group
- mv_power_series.add_group
- power_series.add_group
- hahn_series.add_group
- free_add_group.add_group
- AddMon.of.add_group
- AddGroup.add_group
- AddGroup.add_group_obj
- AddGroup.limit_add_group
- triv_sq_zero_ext.add_group
- locally_constant.add_group
- zero_at_infty_continuous_map.add_group
- CommRing.colimits.colimit_type.add_group
- AddGroup.filtered_colimits.colimit_add_group
- add_submonoid.is_unit.submonoid.add_group
- nat.arithmetic_function.add_group
- smooth_map.add_group
- sym_alg.add_group
- free_lie_algebra.add_group
- unitization.add_group
- holor.add_group
Instances of other typeclasses for add_group
- add_group.has_sizeof_inst
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 := _}
Instances for comm_group.to_group
- 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
- order_dual.comm_group
- lex.comm_group
- multiplicative.comm_group
- mul_opposite.comm_group
- add_opposite.comm_group
- monoid_hom.comm_group
- pi.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
- abelianization.comm_group
- unitary.comm_group
- measure_theory.simple_func.comm_group
- uniform_fun.comm_group
- uniform_on_fun.comm_group
- filter.germ.comm_group
- continuous_map.comm_group
- measure_theory.ae_eq_fun.comm_group
- metric.sphere.comm_group
- circle.comm_group
- CommGroup.comm_group_instance
- CommGroup.comm_group_obj
- CommGroup.limit_comm_group
- locally_constant.comm_group
- homotopy_group.comm_group
- continuous_monoid_hom.comm_group
- pontryagin_dual.comm_group
- CommGroup.filtered_colimits.colimit_comm_group
- class_group.comm_group
- submonoid.is_unit.submonoid.comm_group
- pell.solution₁.comm_group
- mul_char.comm_group
- add_char.comm_group
- smooth_map.comm_group
- tropical.comm_group
- freiman_hom.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
- lie_ring.to_add_comm_group
- add_units.add_comm_group
- order_dual.add_comm_group
- lex.add_comm_group
- additive.add_comm_group
- int.add_comm_group
- mul_opposite.add_comm_group
- add_opposite.add_comm_group
- fin.add_comm_group
- add_monoid_hom.add_comm_group
- add_monoid.End.add_comm_group
- pi.add_comm_group
- rat.add_comm_group
- prod.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
- monoid_algebra.add_comm_group
- add_monoid_algebra.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
- multilinear_map.add_comm_group
- alternating_map.add_comm_group
- dmatrix.add_comm_group
- perfect_closure.add_comm_group
- real.add_comm_group
- complex.add_comm_group
- normed_add_group_hom.add_comm_group
- continuous_linear_map.add_comm_group
- measure_theory.simple_func.add_comm_group
- direct_sum.add_comm_group_set_like
- affine_map.add_comm_group
- bilin_form.add_comm_group
- uniform_space.completion.add_comm_group
- uniform_fun.add_comm_group
- uniform_on_fun.add_comm_group
- continuous_multilinear_map.add_comm_group
- add_circle.add_comm_group
- filter.germ.add_comm_group
- continuous_map.add_comm_group
- bounded_continuous_function.add_comm_group
- measure_theory.ae_eq_fun.add_comm_group
- formal_multilinear_series.add_comm_group
- weak_bilin.add_comm_group
- mv_power_series.add_comm_group
- power_series.add_comm_group
- hahn_series.add_comm_group
- hahn_series.summable_family.add_comm_group
- free_abelian_group.add_comm_group
- module.direct_limit.add_comm_group
- add_comm_group.direct_limit.add_comm_group
- mv_polynomial.R.add_comm_group
- znum.add_comm_group
- measure_theory.vector_measure.add_comm_group
- representation.as_module.add_comm_group
- AddCommGroup.add_comm_group_instance
- category_theory.preadditive.hom_group
- category_theory.preadditive.category_theory.End.add_comm_group
- Module.is_add_comm_group
- AddCommGroup.add_comm_group_obj
- AddCommGroup.limit_add_comm_group
- Module.add_comm_group_obj
- Module.limit_add_comm_group
- Module.colimits.colimit_type.add_comm_group
- Rep.add_comm_group
- fdRep.add_comm_group
- homological_complex.quiver.hom.add_comm_group
- category_theory.idempotents.quiver.hom.add_comm_group
- continuous_affine_map.add_comm_group
- triv_sq_zero_ext.add_comm_group
- pre_lp.add_comm_group
- vector_bundle_core.add_comm_group_fiber
- locally_constant.add_comm_group
- continuous_add_monoid_hom.add_comm_group
- derivation.add_comm_group
- zero_at_infty_continuous_map.add_comm_group
- category_theory.quiver.hom.add_comm_group
- AddCommGroup.filtered_colimits.colimit_add_comm_group
- schwartz_map.add_comm_group
- quaternion_algebra.add_comm_group
- polynomial_module.add_comm_group
- tangent_space.add_comm_group
- ideal.cotangent.add_comm_group
- kaehler_differential.add_comm_group
- fractional_ideal.add_comm_group
- add_comm_group.of_subgroup_on_ring
- witt_vector.standard_one_dim_isocrystal.add_comm_group
- padic.add_comm_group
- padic_int.add_comm_group
- add_submonoid.is_unit.submonoid.add_comm_group
- lie_module_hom.add_comm_group
- nat.arithmetic_function.add_comm_group
- zsqrtd.add_comm_group
- lucas_lehmer.X.add_comm_group
- poly.add_comm_group
- slash_invariant_form.add_comm_group
- modular_form.add_comm_group
- cusp_form.add_comm_group
- smooth_map.add_comm_group
- cont_mdiff_section.add_comm_group
- left_invariant_derivation.add_comm_group
- sym_alg.add_comm_group
- localized_module.add_comm_group
- lie_submodule.quotient.add_comm_group
- free_lie_algebra.add_comm_group
- add_freiman_hom.add_comm_group
- centroid_hom.add_comm_group
- AddCommGroup.colimits.colimit_type.add_comm_group
- unitization.add_comm_group
- pi_tensor_product.add_comm_group
- quadratic_form.add_comm_group
- holor.add_comm_group
- hamming.add_comm_group
- weierstrass_curve.point.add_comm_group
- sensitivity.V.add_comm_group
Instances of other typeclasses for add_comm_group
- add_comm_group.has_sizeof_inst
Instances for add_comm_group.to_add_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 := _}
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 := _}