mathlib documentation

algebra.group.defs

Typeclasses for (semi)groups and monoids #

In this file we define typeclasses for algebraic structures with one binary operation. The classes are named (add_)?(comm_)?(semigroup|monoid|group), where add_ means that the class uses additive notation and comm_ means that the class assumes that the binary operation is commutative.

The file does not contain any lemmas except for

For basic lemmas about these classes see algebra.group.basic.

We also introduce notation classes has_scalar and has_vadd for multiplicative and additive actions and register the following instances:

Notation #

@[class]
structure has_vadd (G : Type u_1) (P : Type u_2) :
Type (max u_1 u_2)
  • vadd : G → P → P

Type class for the +ᵥ notation.

Instances of this typeclass
Instances of other typeclasses for has_vadd
  • has_vadd.has_sizeof_inst
@[class]
structure has_vsub (G : out_param (Type u_1)) (P : Type u_2) :
Type (max u_1 u_2)
  • vsub : P → P → G

Type class for the -ᵥ notation.

Instances of this typeclass
Instances of other typeclasses for has_vsub
  • has_vsub.has_sizeof_inst
@[ext, class]
structure has_scalar (M : Type u_1) (α : Type u_2) :
Type (max u_1 u_2)
  • smul : M → α → α

Typeclass for types with a scalar multiplication operation, denoted (\bu)

Instances of this typeclass
Instances of other typeclasses for has_scalar
  • has_scalar.has_sizeof_inst
theorem has_scalar.ext {M : Type u_1} {α : Type u_2} (x y : has_scalar M α) (h : has_scalar.smul = has_scalar.smul) :
x = y
theorem has_scalar.ext_iff {M : Type u_1} {α : Type u_2} (x y : has_scalar M α) :

The simpset field_simps is used by the tactic field_simp to reduce an expression in a field to an expression of the form n / d where n and d are division-free.

def left_mul {G : Type u_1} [has_mul G] :
G → G → G

left_mul g denotes left multiplication by g

Equations
def left_add {G : Type u_1} [has_add G] :
G → G → G

left_add g denotes left addition by g

Equations
def right_add {G : Type u_1} [has_add G] :
G → G → G

right_add g denotes right addition by g

Equations
def right_mul {G : Type u_1} [has_mul G] :
G → G → G

right_mul g denotes right multiplication by g

Equations
theorem semigroup.ext_iff {G : Type u} (x y : semigroup G) :
theorem semigroup.ext {G : Type u} (x y : semigroup G) (h : semigroup.mul = semigroup.mul) :
x = y
@[instance]
def semigroup.to_has_mul (G : Type u) [self : semigroup G] :
Instances for semigroup.to_has_mul
@[instance]
def add_semigroup.to_has_add (G : Type u) [self : add_semigroup G] :
Instances for add_semigroup.to_has_add
theorem add_semigroup.ext {G : Type u} (x y : add_semigroup G) (h : add_semigroup.add = add_semigroup.add) :
x = y
theorem add_assoc {G : Type u_1} [add_semigroup G] (a b c : G) :
a + b + c = a + (b + c)
theorem mul_assoc {G : Type u_1} [semigroup G] (a b c : G) :
a * b * c = a * (b * c)
@[protected, instance]
@[protected, instance]
@[instance]
def comm_semigroup.to_semigroup (G : Type u) [self : comm_semigroup G] :
theorem comm_semigroup.ext {G : Type u} (x y : comm_semigroup G) (h : comm_semigroup.mul = comm_semigroup.mul) :
x = y
@[instance]
theorem add_comm {G : Type u_1} [add_comm_semigroup G] (a b : G) :
a + b = b + a
theorem mul_comm {G : Type u_1} [comm_semigroup G] (a b : G) :
a * b = b * a
@[protected, instance]
@[protected, instance]
@[instance]
@[ext, class]
structure left_cancel_semigroup (G : Type u) :
Type u
  • 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 * cb = 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
@[ext, class]
structure add_left_cancel_semigroup (G : Type u) :
Type u
  • 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 + cb = c

An add_left_cancel_semigroup is an additive semigroup such that a + b = a + c implies b = c.

Instances of this typeclass
Instances of other typeclasses for add_left_cancel_semigroup
  • add_left_cancel_semigroup.has_sizeof_inst
theorem mul_left_cancel {G : Type u_1} [left_cancel_semigroup G] {a b c : G} :
a * b = a * cb = c
theorem add_left_cancel {G : Type u_1} [add_left_cancel_semigroup G] {a b c : G} :
a + b = a + cb = c
theorem add_left_cancel_iff {G : Type u_1} [add_left_cancel_semigroup G] {a b c : G} :
a + b = a + c b = c
theorem mul_left_cancel_iff {G : Type u_1} [left_cancel_semigroup G] {a b c : G} :
a * b = a * c b = c
@[simp]
theorem mul_right_inj {G : Type u_1} [left_cancel_semigroup G] (a : G) {b c : G} :
a * b = a * c b = c
@[simp]
theorem add_right_inj {G : Type u_1} [add_left_cancel_semigroup G] (a : G) {b c : G} :
a + b = a + c b = c
theorem mul_ne_mul_right {G : Type u_1} [left_cancel_semigroup G] (a : G) {b c : G} :
a * b a * c b c
theorem add_ne_add_right {G : Type u_1} [add_left_cancel_semigroup G] (a : G) {b c : G} :
a + b a + c b c
@[ext, class]
structure right_cancel_semigroup (G : Type u) :
Type u
  • 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 * ba = 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
@[instance]
@[ext, class]
structure add_right_cancel_semigroup (G : Type u) :
Type u
  • 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 + ba = c

An add_right_cancel_semigroup is an additive semigroup such that a + b = c + b implies a = c.

Instances of this typeclass
Instances of other typeclasses for add_right_cancel_semigroup
  • add_right_cancel_semigroup.has_sizeof_inst
theorem mul_right_cancel {G : Type u_1} [right_cancel_semigroup G] {a b c : G} :
a * b = c * ba = c
theorem add_right_cancel {G : Type u_1} [add_right_cancel_semigroup G] {a b c : G} :
a + b = c + ba = c
theorem mul_right_cancel_iff {G : Type u_1} [right_cancel_semigroup G] {a b c : G} :
b * a = c * a b = c
theorem add_right_cancel_iff {G : Type u_1} [add_right_cancel_semigroup G] {a b c : G} :
b + a = c + a b = c
theorem add_left_injective {G : Type u_1} [add_right_cancel_semigroup G] (a : G) :
function.injective (λ (x : G), x + a)
theorem mul_left_injective {G : Type u_1} [right_cancel_semigroup G] (a : G) :
function.injective (λ (x : G), x * a)
@[simp]
theorem add_left_inj {G : Type u_1} [add_right_cancel_semigroup G] (a : G) {b c : G} :
b + a = c + a b = c
@[simp]
theorem mul_left_inj {G : Type u_1} [right_cancel_semigroup G] (a : G) {b c : G} :
b * a = c * a b = c
theorem mul_ne_mul_left {G : Type u_1} [right_cancel_semigroup G] (a : G) {b c : G} :
b * a c * a b c
theorem add_ne_add_left {G : Type u_1} [add_right_cancel_semigroup G] (a : G) {b c : G} :
b + a c + a b c
@[class]
structure mul_one_class (M : Type u) :
Type u
  • one : M
  • mul : M → M → M
  • one_mul : ∀ (a : M), 1 * a = a
  • mul_one : ∀ (a : M), a * 1 = a

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
Instances of other typeclasses for mul_one_class
  • mul_one_class.has_sizeof_inst
@[instance]
def mul_one_class.to_has_one (M : Type u) [self : mul_one_class M] :
@[instance]
def mul_one_class.to_has_mul (M : Type u) [self : mul_one_class M] :
@[instance]
def add_zero_class.to_has_add (M : Type u) [self : add_zero_class M] :
@[instance]
def add_zero_class.to_has_zero (M : Type u) [self : add_zero_class M] :
@[ext]
theorem mul_one_class.ext {M : Type u} ⦃m₁ m₂ : mul_one_class M⦄ :
theorem add_zero_class.ext {M : Type u} ⦃m₁ m₂ : add_zero_class M⦄ :
@[simp]
theorem one_mul {M : Type u} [mul_one_class M] (a : M) :
1 * a = a
@[simp]
theorem zero_add {M : Type u} [add_zero_class M] (a : M) :
0 + a = a
@[simp]
theorem add_zero {M : Type u} [add_zero_class M] (a : M) :
a + 0 = a
@[simp]
theorem mul_one {M : Type u} [mul_one_class M] (a : M) :
a * 1 = a
@[protected, instance]
@[protected, instance]
@[protected, instance]
@[protected, instance]
def npow_rec {M : Type u} [has_one M] [has_mul M] :
M → M

The fundamental power operation in a monoid. npow_rec n a = a*a*...*a n times. Use instead a ^ n, which has better definitional behavior.

Equations
def nsmul_rec {M : Type u} [has_zero M] [has_add M] :
M → M

The fundamental scalar multiplication in an additive monoid. nsmul_rec n a = a+a+...+a n times. Use instead n • a, which has better definitional behavior.

Equations
meta def try_refl_tac  :

try_refl_tac solves goals of the form ∀ a b, f a b = g a b, if they hold by definition.

Design note on add_monoid and monoid #

An add_monoid has a natural -action, defined by n • a = a + ... + a, that we want to declare as an instance as it makes it possible to use the language of linear algebra. However, there are often other natural -actions. For instance, for any semiring R, the space of polynomials polynomial R has a natural R-action defined by multiplication on the coefficients. This means that polynomial would have two natural -actions, which are equal but not defeq. The same goes for linear maps, tensor products, and so on (and even for itself).

To solve this issue, we embed an -action in the definition of an add_monoid (which is by default equal to the naive action a + ... + a, but can be adjusted when needed), and declare a has_scalar ℕ α instance using this action. See Note [forgetful inheritance] for more explanations on this pattern.

For example, when we define polynomial R, then we declare the -action to be by multiplication on each coefficient (using the -action on R that comes from the fact that R is an add_monoid). In this way, the two natural has_scalar ℕ (polynomial ℕ) instances are defeq.

The tactic to_additive transfers definitions and results from multiplicative monoids to additive monoids. To work, it has to map fields to fields. This means that we should also add corresponding fields to the multiplicative structure monoid, which could solve defeq problems for powers if needed. These problems do not come up in practice, so most of the time we will not need to adjust the npow field when defining multiplicative objects.

A basic theory for the power function on monoids and the -action on additive monoids is built in the file algebra.group_power.basic. For now, we only register the most basic properties that we need right away.

In the definition, we use n.succ instead of n + 1 in the nsmul_succ' and npow_succ' fields to make sure that to_additive is not confused (otherwise, it would try to convert 1 : ℕ to 0 : ℕ).

@[instance]
def add_monoid.to_add_semigroup (M : Type u) [self : add_monoid M] :
@[instance]
def add_monoid.to_add_zero_class (M : Type u) [self : add_monoid M] :
@[class]
structure add_monoid (M : Type u) :
Type u

An add_monoid is an add_semigroup with an element 0 such that 0 + a = a + 0 = a.

Instances of this typeclass
Instances of other typeclasses for add_monoid
  • add_monoid.has_sizeof_inst
@[instance]
def monoid.to_mul_one_class (M : Type u) [self : monoid M] :
@[instance]
def monoid.to_semigroup (M : Type u) [self : monoid M] :
@[class]
structure monoid (M : Type u) :
Type u
  • 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
Instances of other typeclasses for monoid
  • monoid.has_sizeof_inst
@[protected, instance]
def monoid.has_pow {M : Type u_1} [monoid M] :
Equations
@[protected, instance]
def add_monoid.has_scalar_nat {M : Type u_1} [add_monoid M] :
Equations
@[simp]
theorem npow_eq_pow {M : Type u_2} [monoid M] (n : ) (x : M) :
monoid.npow n x = x ^ n
@[simp]
theorem nsmul_eq_smul {M : Type u_2} [add_monoid M] (n : ) (x : M) :
theorem zero_nsmul {M : Type u_2} [add_monoid M] (a : M) :
0 a = 0
@[simp]
theorem pow_zero {M : Type u_2} [monoid M] (a : M) :
a ^ 0 = 1
theorem succ_nsmul {M : Type u_2} [add_monoid M] (a : M) (n : ) :
(n + 1) a = a + n a
theorem pow_succ {M : Type u_2} [monoid M] (a : M) (n : ) :
a ^ (n + 1) = a * a ^ n
theorem left_inv_eq_right_inv {M : Type u} [monoid M] {a b c : M} (hba : b * a = 1) (hac : a * c = 1) :
b = c
theorem left_neg_eq_right_neg {M : Type u} [add_monoid M] {a b c : M} (hba : b + a = 0) (hac : a + c = 0) :
b = c
@[instance]
def add_comm_monoid.to_add_monoid (M : Type u) [self : add_comm_monoid M] :
Instances for add_comm_monoid.to_add_monoid
@[class]
structure add_comm_monoid (M : Type u) :
Type u

An additive commutative monoid is an additive monoid with commutative (+).

Instances of this typeclass
Instances of other typeclasses for add_comm_monoid
  • add_comm_monoid.has_sizeof_inst
@[instance]
def comm_monoid.to_comm_semigroup (M : Type u) [self : comm_monoid M] :
@[class]
structure comm_monoid (M : Type u) :
Type u
  • 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
Instances of other typeclasses for comm_monoid
  • comm_monoid.has_sizeof_inst
@[instance]
def comm_monoid.to_monoid (M : Type u) [self : comm_monoid M] :
Instances for comm_monoid.to_monoid
@[instance]
@[class]
structure add_left_cancel_monoid (M : Type u) :
Type u

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
Instances of other typeclasses for add_left_cancel_monoid
  • add_left_cancel_monoid.has_sizeof_inst
@[class]
structure left_cancel_monoid (M : Type u) :
Type u

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
@[instance]
def left_cancel_monoid.to_monoid (M : Type u) [self : left_cancel_monoid M] :
@[class]
structure add_right_cancel_monoid (M : Type u) :
Type u

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
@[instance]
def right_cancel_monoid.to_monoid (M : Type u) [self : right_cancel_monoid M] :
@[class]
structure right_cancel_monoid (M : Type u) :
Type u

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
@[class]
structure add_cancel_monoid (M : Type u) :
Type u

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
@[instance]
@[class]
structure cancel_monoid (M : Type u) :
Type u
  • 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 * cb = 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 * ba = c

A monoid in which multiplication is cancellative.

Instances of this typeclass
Instances of other typeclasses for cancel_monoid
  • cancel_monoid.has_sizeof_inst
@[instance]
@[class]
structure add_cancel_comm_monoid (M : Type u) :
Type u

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
@[instance]
@[class]
structure cancel_comm_monoid (M : Type u) :
Type u

Commutative version of cancel_monoid.

Instances of this typeclass
Instances of other typeclasses for cancel_comm_monoid
  • cancel_comm_monoid.has_sizeof_inst
def zpow_rec {M : Type u_1} [has_one M] [has_mul M] [has_inv M] :
M → 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.

Equations
def zsmul_rec {M : Type u_1} [has_zero M] [has_add M] [has_neg M] :
M → M

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.

Equations
@[instance]
def has_involutive_neg.to_has_neg (A : Type u_2) [self : has_involutive_neg A] :
@[class]
structure has_involutive_inv (G : Type u_2) :
Type u_2

Auxiliary typeclass for types with an involutive has_inv.

Instances of this typeclass
Instances of other typeclasses for has_involutive_inv
  • has_involutive_inv.has_sizeof_inst
@[instance]
def has_involutive_inv.to_has_inv (G : Type u_2) [self : has_involutive_inv G] :
@[simp]
theorem inv_inv {G : Type u_1} [has_involutive_inv G] (a : G) :
@[simp]
theorem neg_neg {G : Type u_1} [has_involutive_neg G] (a : G) :
--a = a

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:

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.

@[instance]
def div_inv_monoid.to_monoid (G : Type u) [self : div_inv_monoid G] :
Instances for div_inv_monoid.to_monoid
@[instance]
def div_inv_monoid.to_has_div (G : Type u) [self : div_inv_monoid G] :
@[class]
structure div_inv_monoid (G : Type u) :
Type u

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
Instances of other typeclasses for div_inv_monoid
  • div_inv_monoid.has_sizeof_inst
@[instance]
def div_inv_monoid.to_has_inv (G : Type u) [self : div_inv_monoid G] :
@[instance]
def sub_neg_monoid.to_has_sub (G : Type u) [self : sub_neg_monoid G] :
@[instance]
def sub_neg_monoid.to_add_monoid (G : Type u) [self : sub_neg_monoid G] :
Instances for sub_neg_monoid.to_add_monoid
@[class]
structure sub_neg_monoid (G : Type u) :
Type u

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
Instances of other typeclasses for sub_neg_monoid
  • sub_neg_monoid.has_sizeof_inst
@[instance]
def sub_neg_monoid.to_has_neg (G : Type u) [self : sub_neg_monoid G] :
@[protected, instance]
def div_inv_monoid.has_pow {M : Type u_1} [div_inv_monoid M] :
Equations
@[protected, instance]
Equations
@[simp]
theorem zsmul_eq_smul {G : Type u_1} [sub_neg_monoid G] (n : ) (x : G) :
@[simp]
theorem zpow_eq_pow {G : Type u_1} [div_inv_monoid G] (n : ) (x : G) :
@[simp]
theorem zero_zsmul {G : Type u_1} [sub_neg_monoid G] (a : G) :
0 a = 0
@[simp]
theorem zpow_zero {G : Type u_1} [div_inv_monoid G] (a : G) :
a ^ 0 = 1
@[simp, norm_cast]
theorem coe_nat_zsmul {G : Type u_1} [sub_neg_monoid G] (a : G) (n : ) :
n a = n a
@[simp, norm_cast]
theorem zpow_coe_nat {G : Type u_1} [div_inv_monoid G] (a : G) (n : ) :
a ^ n = a ^ n
theorem of_nat_zsmul {G : Type u_1} [sub_neg_monoid G] (a : G) (n : ) :
theorem zpow_of_nat {G : Type u_1} [div_inv_monoid G] (a : G) (n : ) :
a ^ int.of_nat n = a ^ n
@[simp]
theorem zsmul_neg_succ_of_nat {G : Type u_1} [sub_neg_monoid G] (a : G) (n : ) :
-[1+ n] a = -((n + 1) a)
@[simp]
theorem zpow_neg_succ_of_nat {G : Type u_1} [div_inv_monoid G] (a : G) (n : ) :
a ^ -[1+ n] = (a ^ (n + 1))⁻¹
theorem div_eq_mul_inv {G : Type u_1} [div_inv_monoid G] (a b : G) :
a / b = a * b⁻¹

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.

theorem sub_eq_add_neg {G : Type u_1} [sub_neg_monoid G] (a b : G) :
a - b = a + -b

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.

theorem division_def {G : Type u_1} [div_inv_monoid G] (a b : G) :
a / b = a * b⁻¹

Alias of div_eq_mul_inv`.

@[instance]
@[class]
structure subtraction_monoid (G : Type u) :
Type u

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
@[class]
structure division_monoid (G : Type u) :
Type u

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
@[instance]
@[simp]
theorem mul_inv_rev {G : Type u_1} [division_monoid G] (a b : G) :
(a * b)⁻¹ = b⁻¹ * a⁻¹
@[simp]
theorem neg_add_rev {G : Type u_1} [subtraction_monoid G] (a b : G) :
-(a + b) = -b + -a
theorem neg_eq_of_add_eq_zero_right {G : Type u_1} [subtraction_monoid G] {a b : G} :
a + b = 0-a = b
theorem inv_eq_of_mul_eq_one_right {G : Type u_1} [division_monoid G] {a b : G} :
a * b = 1a⁻¹ = b
@[class]
structure subtraction_comm_monoid (G : Type u) :
Type u

Commutative subtraction_monoid.

Instances of this typeclass
Instances of other typeclasses for subtraction_comm_monoid
  • subtraction_comm_monoid.has_sizeof_inst
@[instance]
@[class]
structure division_comm_monoid (G : Type u) :
Type u

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
@[class]
structure group (G : Type u) :
Type u

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
Instances of other typeclasses for group
  • group.has_sizeof_inst
@[instance]
def group.to_div_inv_monoid (G : Type u) [self : group G] :
@[class]
structure add_group (A : Type u) :
Type u

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
Instances of other typeclasses for add_group
  • add_group.has_sizeof_inst
@[instance]
def add_group.to_sub_neg_monoid (A : Type u) [self : add_group A] :
def add_group.to_add_monoid (G : Type u) [add_group G] :

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
def group.to_monoid (G : Type u) [group G] :

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
@[simp]
theorem add_left_neg {G : Type u_1} [add_group G] (a : G) :
-a + a = 0
@[simp]
theorem mul_left_inv {G : Type u_1} [group G] (a : G) :
a⁻¹ * a = 1
theorem neg_add_self {G : Type u_1} [add_group G] (a : G) :
-a + a = 0
theorem inv_mul_self {G : Type u_1} [group G] (a : G) :
a⁻¹ * a = 1
@[simp]
theorem mul_right_inv {G : Type u_1} [group G] (a : G) :
a * a⁻¹ = 1
@[simp]
theorem add_right_neg {G : Type u_1} [add_group G] (a : G) :
a + -a = 0
theorem add_neg_self {G : Type u_1} [add_group G] (a : G) :
a + -a = 0
theorem mul_inv_self {G : Type u_1} [group G] (a : G) :
a * a⁻¹ = 1
@[simp]
theorem inv_mul_cancel_left {G : Type u_1} [group G] (a b : G) :
a⁻¹ * (a * b) = b
@[simp]
theorem neg_add_cancel_left {G : Type u_1} [add_group G] (a b : G) :
-a + (a + b) = b
@[simp]
theorem mul_inv_cancel_left {G : Type u_1} [group G] (a b : G) :
a * (a⁻¹ * b) = b
@[simp]
theorem add_neg_cancel_left {G : Type u_1} [add_group G] (a b : G) :
a + (-a + b) = b
@[simp]
theorem add_neg_cancel_right {G : Type u_1} [add_group G] (a b : G) :
a + b + -b = a
@[simp]
theorem mul_inv_cancel_right {G : Type u_1} [group G] (a b : G) :
a * b * b⁻¹ = a
@[simp]
theorem neg_add_cancel_right {G : Type u_1} [add_group G] (a b : G) :
a + -b + b = a
@[simp]
theorem inv_mul_cancel_right {G : Type u_1} [group G] (a b : G) :
a * b⁻¹ * b = a
@[protected, instance]
def group.to_division_monoid {G : Type u_1} [group G] :
Equations
@[protected, instance]
Equations
@[protected, instance]
def group.to_cancel_monoid {G : Type u_1} [group G] :
Equations
@[protected, instance]
Equations
@[instance]
def comm_group.to_group (G : Type u) [self : comm_group G] :
Instances for comm_group.to_group
@[class]
structure comm_group (G : Type u) :
Type u

A commutative group is a group with commutative (*).

Instances of this typeclass
Instances of other typeclasses for comm_group
  • comm_group.has_sizeof_inst
@[instance]
def comm_group.to_comm_monoid (G : Type u) [self : comm_group G] :
@[class]
structure add_comm_group (G : Type u) :
Type u

An additive commutative group is an additive group with commutative (+).

Instances of this typeclass
Instances of other typeclasses for add_comm_group
  • add_comm_group.has_sizeof_inst
@[instance]
@[instance]
def add_comm_group.to_add_group (G : Type u) [self : add_comm_group G] :
Instances for add_comm_group.to_add_group
@[protected, instance]
Equations
@[protected, instance]
Equations