Groups with an adjoined zero element #
This file describes structures that are not usually studied on their own right in mathematics, namely a special sort of monoid: apart from a distinguished “zero element” they form a group, or in other words, they are groups with an adjoined zero element.
Examples are:
- division rings;
- the value monoid of a multiplicative valuation;
- in particular, the non-negative real numbers.
Main definitions #
Various lemmas about group_with_zero
and comm_group_with_zero
.
To reduce import dependencies, the type-classes themselves are in
algebra.group_with_zero.defs
.
Implementation details #
As is usual in mathlib, we extend the inverse function to the zero element,
and require 0⁻¹ = 0
.
Pullback a mul_zero_class
instance along an injective function.
See note [reducible non-instances].
Equations
- function.injective.mul_zero_class f hf zero mul = {mul := has_mul.mul _inst_2, zero := 0, zero_mul := _, mul_zero := _}
Pushforward a mul_zero_class
instance along an surjective function.
See note [reducible non-instances].
Equations
- function.surjective.mul_zero_class f hf zero mul = {mul := has_mul.mul _inst_2, zero := 0, zero_mul := _, mul_zero := _}
To match one_mul_eq_id
.
To match mul_one_eq_id
.
Pushforward a no_zero_divisors
instance along an injective function.
If α
has no zero divisors, then the product of two elements equals zero iff one of them
equals zero.
If α
has no zero divisors, then the product of two elements equals zero iff one of them
equals zero.
If α
has no zero divisors, then the product of two elements is nonzero iff both of them
are nonzero.
If α
has no zero divisors, then for elements a, b : α
, a * b
equals zero iff so is
b * a
.
If α
has no zero divisors, then for elements a, b : α
, a * b
is nonzero iff so is
b * a
.
Pullback a mul_zero_one_class
instance along an injective function.
See note [reducible non-instances].
Equations
- function.injective.mul_zero_one_class f hf zero one mul = {one := mul_one_class.one (function.injective.mul_one_class f hf one mul), mul := mul_zero_class.mul (function.injective.mul_zero_class f hf zero mul), one_mul := _, mul_one := _, zero := mul_zero_class.zero (function.injective.mul_zero_class f hf zero mul), zero_mul := _, mul_zero := _}
Pushforward a mul_zero_one_class
instance along an surjective function.
See note [reducible non-instances].
Equations
- function.surjective.mul_zero_one_class f hf zero one mul = {one := mul_one_class.one (function.surjective.mul_one_class f hf one mul), mul := mul_zero_class.mul (function.surjective.mul_zero_class f hf zero mul), one_mul := _, mul_one := _, zero := mul_zero_class.zero (function.surjective.mul_zero_class f hf zero mul), zero_mul := _, mul_zero := _}
In a monoid with zero, if zero equals one, then zero is the only element.
In a monoid with zero, if zero equals one, then zero is the unique element.
Somewhat arbitrarily, we define the default element to be 0
.
All other elements will be provably equal to it, but not necessarily definitionally equal.
Equations
- unique_of_zero_eq_one h = {to_inhabited := {default := 0}, uniq := _}
In a monoid with zero, zero equals one if and only if all elements of that semiring are equal.
Alias of subsingleton_iff_zero_eq_one
.
In a monoid with zero, either zero and one are nonequal, or zero is the only element.
In a nontrivial monoid with zero, zero and one are different.
Pullback a nontrivial
instance along a function sending 0
to 0
and 1
to 1
.
Pullback a semigroup_with_zero
class along an injective function.
See note [reducible non-instances].
Equations
- function.injective.semigroup_with_zero f hf zero mul = {mul := mul_zero_class.mul (function.injective.mul_zero_class f hf zero mul), mul_assoc := _, zero := mul_zero_class.zero (function.injective.mul_zero_class f hf zero mul), zero_mul := _, mul_zero := _}
Pushforward a semigroup_with_zero
class along an surjective function.
See note [reducible non-instances].
Equations
- function.surjective.semigroup_with_zero f hf zero mul = {mul := mul_zero_class.mul (function.surjective.mul_zero_class f hf zero mul), mul_assoc := _, zero := mul_zero_class.zero (function.surjective.mul_zero_class f hf zero mul), zero_mul := _, mul_zero := _}
Pullback a monoid_with_zero
class along an injective function.
See note [reducible non-instances].
Equations
- function.injective.monoid_with_zero f hf zero one mul npow = {mul := monoid.mul (function.injective.monoid f hf one mul npow), mul_assoc := _, one := monoid.one (function.injective.monoid f hf one mul npow), one_mul := _, mul_one := _, npow := monoid.npow (function.injective.monoid f hf one mul npow), npow_zero' := _, npow_succ' := _, zero := mul_zero_class.zero (function.injective.mul_zero_class f hf zero mul), zero_mul := _, mul_zero := _}
Pushforward a monoid_with_zero
class along a surjective function.
See note [reducible non-instances].
Equations
- function.surjective.monoid_with_zero f hf zero one mul npow = {mul := monoid.mul (function.surjective.monoid f hf one mul npow), mul_assoc := _, one := monoid.one (function.surjective.monoid f hf one mul npow), one_mul := _, mul_one := _, npow := monoid.npow (function.surjective.monoid f hf one mul npow), npow_zero' := _, npow_succ' := _, zero := mul_zero_class.zero (function.surjective.mul_zero_class f hf zero mul), zero_mul := _, mul_zero := _}
Pullback a monoid_with_zero
class along an injective function.
See note [reducible non-instances].
Equations
- function.injective.comm_monoid_with_zero f hf zero one mul npow = {mul := comm_monoid.mul (function.injective.comm_monoid f hf one mul npow), mul_assoc := _, one := comm_monoid.one (function.injective.comm_monoid f hf one mul npow), one_mul := _, mul_one := _, npow := comm_monoid.npow (function.injective.comm_monoid f hf one mul npow), npow_zero' := _, npow_succ' := _, mul_comm := _, zero := mul_zero_class.zero (function.injective.mul_zero_class f hf zero mul), zero_mul := _, mul_zero := _}
Pushforward a monoid_with_zero
class along a surjective function.
See note [reducible non-instances].
Equations
- function.surjective.comm_monoid_with_zero f hf zero one mul npow = {mul := comm_monoid.mul (function.surjective.comm_monoid f hf one mul npow), mul_assoc := _, one := comm_monoid.one (function.surjective.comm_monoid f hf one mul npow), one_mul := _, mul_one := _, npow := comm_monoid.npow (function.surjective.comm_monoid f hf one mul npow), npow_zero' := _, npow_succ' := _, mul_comm := _, zero := mul_zero_class.zero (function.surjective.mul_zero_class f hf zero mul), zero_mul := _, mul_zero := _}
An element of the unit group of a nonzero monoid with zero represented as an element of the monoid is nonzero.
Introduce a function inverse
on a monoid with zero M₀
, which sends x
to x⁻¹
if x
is
invertible and to 0
otherwise. This definition is somewhat ad hoc, but one needs a fully (rather
than partially) defined inverse function for some purposes, including for calculus.
Note that while this is in the ring
namespace for brevity, it requires the weaker assumption
monoid_with_zero M₀
instead of ring M₀
.
By definition, if x
is invertible then inverse x = x⁻¹
.
By definition, if x
is not invertible then inverse x = 0
.
Pullback a monoid_with_zero
class along an injective function.
See note [reducible non-instances].
Equations
- function.injective.cancel_monoid_with_zero f hf zero one mul npow = {mul := monoid.mul (function.injective.monoid f hf one mul npow), mul_assoc := _, one := monoid.one (function.injective.monoid f hf one mul npow), one_mul := _, mul_one := _, npow := monoid.npow (function.injective.monoid f hf one mul npow), npow_zero' := _, npow_succ' := _, zero := mul_zero_class.zero (function.injective.mul_zero_class f hf zero mul), zero_mul := _, mul_zero := _, mul_left_cancel_of_ne_zero := _, mul_right_cancel_of_ne_zero := _}
An element of a cancel_monoid_with_zero
fixed by right multiplication by an element other
than one must be zero.
An element of a cancel_monoid_with_zero
fixed by left multiplication by an element other
than one must be zero.
Pullback a cancel_comm_monoid_with_zero
class along an injective function.
See note [reducible non-instances].
Equations
- function.injective.cancel_comm_monoid_with_zero f hf zero one mul npow = {mul := comm_monoid_with_zero.mul (function.injective.comm_monoid_with_zero f hf zero one mul npow), mul_assoc := _, one := comm_monoid_with_zero.one (function.injective.comm_monoid_with_zero f hf zero one mul npow), one_mul := _, mul_one := _, npow := comm_monoid_with_zero.npow (function.injective.comm_monoid_with_zero f hf zero one mul npow), npow_zero' := _, npow_succ' := _, mul_comm := _, zero := comm_monoid_with_zero.zero (function.injective.comm_monoid_with_zero f hf zero one mul npow), zero_mul := _, mul_zero := _, mul_left_cancel_of_ne_zero := _, mul_right_cancel_of_ne_zero := _}
Alias of div_eq_mul_inv
.
Pullback a group_with_zero
class along an injective function.
See note [reducible non-instances].
Equations
- function.injective.group_with_zero f hf zero one mul inv div npow zpow = {mul := monoid_with_zero.mul (function.injective.monoid_with_zero f hf zero one mul npow), mul_assoc := _, one := monoid_with_zero.one (function.injective.monoid_with_zero f hf zero one mul npow), one_mul := _, mul_one := _, npow := monoid_with_zero.npow (function.injective.monoid_with_zero f hf zero one mul npow), npow_zero' := _, npow_succ' := _, zero := monoid_with_zero.zero (function.injective.monoid_with_zero f hf zero one mul npow), zero_mul := _, mul_zero := _, inv := div_inv_monoid.inv (function.injective.div_inv_monoid f hf one mul inv div npow zpow), div := div_inv_monoid.div (function.injective.div_inv_monoid f hf one mul inv div npow zpow), div_eq_mul_inv := _, zpow := div_inv_monoid.zpow (function.injective.div_inv_monoid f hf one mul inv div npow zpow), zpow_zero' := _, zpow_succ' := _, zpow_neg' := _, exists_pair_ne := _, inv_zero := _, mul_inv_cancel := _}
Pushforward a group_with_zero
class along an surjective function.
See note [reducible non-instances].
Equations
- function.surjective.group_with_zero h01 f hf zero one mul inv div npow zpow = {mul := monoid_with_zero.mul (function.surjective.monoid_with_zero f hf zero one mul npow), mul_assoc := _, one := monoid_with_zero.one (function.surjective.monoid_with_zero f hf zero one mul npow), one_mul := _, mul_one := _, npow := monoid_with_zero.npow (function.surjective.monoid_with_zero f hf zero one mul npow), npow_zero' := _, npow_succ' := _, zero := monoid_with_zero.zero (function.surjective.monoid_with_zero f hf zero one mul npow), zero_mul := _, mul_zero := _, inv := div_inv_monoid.inv (function.surjective.div_inv_monoid f hf one mul inv div npow zpow), div := div_inv_monoid.div (function.surjective.div_inv_monoid f hf one mul inv div npow zpow), div_eq_mul_inv := _, zpow := div_inv_monoid.zpow (function.surjective.div_inv_monoid f hf one mul inv div npow zpow), zpow_zero' := _, zpow_succ' := _, zpow_neg' := _, exists_pair_ne := _, inv_zero := _, mul_inv_cancel := _}
Equations
Multiplying a
by itself and then by its inverse results in a
(whether or not a
is zero).
Multiplying a
by its inverse and then by itself results in a
(whether or not a
is zero).
Multiplying a⁻¹
by a
twice results in a
(whether or not a
is zero).
Multiplying a
by itself and then dividing by itself results in
a
(whether or not a
is zero).
Dividing a
by itself and then multiplying by itself results in
a
(whether or not a
is zero).
Embed a non-zero element of a group_with_zero
into the unit group.
By combining this function with the operations on units,
or the /ₚ
operation, it is possible to write a division
as a partial function with three arguments.
In a group with zero, an existential over a unit can be rewritten in terms of units.mk0
.
An alternative version of units.exists0
. This one is useful if Lean cannot
figure out p
when using units.exists0
from right to left.
Equations
- group_with_zero.cancel_monoid_with_zero = {mul := group_with_zero.mul _inst_1, mul_assoc := _, one := group_with_zero.one _inst_1, one_mul := _, mul_one := _, npow := group_with_zero.npow _inst_1, npow_zero' := _, npow_succ' := _, zero := group_with_zero.zero _inst_1, zero_mul := _, mul_zero := _, mul_left_cancel_of_ne_zero := _, mul_right_cancel_of_ne_zero := _}
Dividing a
by the result of dividing a
by itself results in
a
(whether or not a
is zero).
Equations
- comm_group_with_zero.cancel_comm_monoid_with_zero = {mul := cancel_monoid_with_zero.mul group_with_zero.cancel_monoid_with_zero, mul_assoc := _, one := cancel_monoid_with_zero.one group_with_zero.cancel_monoid_with_zero, one_mul := _, mul_one := _, npow := cancel_monoid_with_zero.npow group_with_zero.cancel_monoid_with_zero, npow_zero' := _, npow_succ' := _, mul_comm := _, zero := cancel_monoid_with_zero.zero group_with_zero.cancel_monoid_with_zero, zero_mul := _, mul_zero := _, mul_left_cancel_of_ne_zero := _, mul_right_cancel_of_ne_zero := _}
Pullback a comm_group_with_zero
class along an injective function.
See note [reducible non-instances].
Equations
- function.injective.comm_group_with_zero f hf zero one mul inv div npow zpow = {mul := group_with_zero.mul (function.injective.group_with_zero f hf zero one mul inv div npow zpow), mul_assoc := _, one := group_with_zero.one (function.injective.group_with_zero f hf zero one mul inv div npow zpow), one_mul := _, mul_one := _, npow := group_with_zero.npow (function.injective.group_with_zero f hf zero one mul inv div npow zpow), npow_zero' := _, npow_succ' := _, mul_comm := _, zero := group_with_zero.zero (function.injective.group_with_zero f hf zero one mul inv div npow zpow), zero_mul := _, mul_zero := _, inv := group_with_zero.inv (function.injective.group_with_zero f hf zero one mul inv div npow zpow), div := group_with_zero.div (function.injective.group_with_zero f hf zero one mul inv div npow zpow), div_eq_mul_inv := _, zpow := group_with_zero.zpow (function.injective.group_with_zero f hf zero one mul inv div npow zpow), zpow_zero' := _, zpow_succ' := _, zpow_neg' := _, exists_pair_ne := _, inv_zero := _, mul_inv_cancel := _}
Pushforward a comm_group_with_zero
class along a surjective function.
Equations
- function.surjective.comm_group_with_zero h01 f hf zero one mul inv div npow zpow = {mul := group_with_zero.mul (function.surjective.group_with_zero h01 f hf zero one mul inv div npow zpow), mul_assoc := _, one := group_with_zero.one (function.surjective.group_with_zero h01 f hf zero one mul inv div npow zpow), one_mul := _, mul_one := _, npow := group_with_zero.npow (function.surjective.group_with_zero h01 f hf zero one mul inv div npow zpow), npow_zero' := _, npow_succ' := _, mul_comm := _, zero := group_with_zero.zero (function.surjective.group_with_zero h01 f hf zero one mul inv div npow zpow), zero_mul := _, mul_zero := _, inv := group_with_zero.inv (function.surjective.group_with_zero h01 f hf zero one mul inv div npow zpow), div := group_with_zero.div (function.surjective.group_with_zero h01 f hf zero one mul inv div npow zpow), div_eq_mul_inv := _, zpow := group_with_zero.zpow (function.surjective.group_with_zero h01 f hf zero one mul inv div npow zpow), zpow_zero' := _, zpow_succ' := _, zpow_neg' := _, exists_pair_ne := _, inv_zero := _, mul_inv_cancel := _}
A monoid homomorphism between groups with zeros sending 0
to 0
sends a⁻¹
to (f a)⁻¹
.
Inversion on a commutative group with zero, considered as a monoid with zero homomorphism.
Equations
- inv_monoid_with_zero_hom = {to_fun := has_inv.inv (div_inv_monoid.to_has_inv G₀), map_zero' := _, map_one' := _, map_mul' := _}
Constructs a group_with_zero
structure on a monoid_with_zero
consisting only of units and 0.
Equations
- group_with_zero_of_is_unit_or_eq_zero h = {mul := monoid_with_zero.mul hM, mul_assoc := _, one := monoid_with_zero.one hM, one_mul := _, mul_one := _, npow := monoid_with_zero.npow hM, npow_zero' := _, npow_succ' := _, zero := monoid_with_zero.zero hM, zero_mul := _, mul_zero := _, inv := λ (a : M), dite (a = 0) (λ (h0 : a = 0), 0) (λ (h0 : ¬a = 0), ↑(_.unit)⁻¹), div := div_inv_monoid.div._default monoid_with_zero.mul monoid_with_zero.mul_assoc monoid_with_zero.one monoid_with_zero.one_mul monoid_with_zero.mul_one monoid_with_zero.npow monoid_with_zero.npow_zero' monoid_with_zero.npow_succ' (λ (a : M), dite (a = 0) (λ (h0 : a = 0), 0) (λ (h0 : ¬a = 0), ↑(_.unit)⁻¹)), div_eq_mul_inv := _, zpow := div_inv_monoid.zpow._default monoid_with_zero.mul monoid_with_zero.mul_assoc monoid_with_zero.one monoid_with_zero.one_mul monoid_with_zero.mul_one monoid_with_zero.npow monoid_with_zero.npow_zero' monoid_with_zero.npow_succ' (λ (a : M), dite (a = 0) (λ (h0 : a = 0), 0) (λ (h0 : ¬a = 0), ↑(_.unit)⁻¹)), zpow_zero' := _, zpow_succ' := _, zpow_neg' := _, exists_pair_ne := _, inv_zero := _, mul_inv_cancel := _}
Constructs a comm_group_with_zero
structure on a comm_monoid_with_zero
consisting only of units and 0.
Equations
- comm_group_with_zero_of_is_unit_or_eq_zero h = {mul := group_with_zero.mul (group_with_zero_of_is_unit_or_eq_zero h), mul_assoc := _, one := group_with_zero.one (group_with_zero_of_is_unit_or_eq_zero h), one_mul := _, mul_one := _, npow := group_with_zero.npow (group_with_zero_of_is_unit_or_eq_zero h), npow_zero' := _, npow_succ' := _, mul_comm := _, zero := group_with_zero.zero (group_with_zero_of_is_unit_or_eq_zero h), zero_mul := _, mul_zero := _, inv := group_with_zero.inv (group_with_zero_of_is_unit_or_eq_zero h), div := group_with_zero.div (group_with_zero_of_is_unit_or_eq_zero h), div_eq_mul_inv := _, zpow := group_with_zero.zpow (group_with_zero_of_is_unit_or_eq_zero h), zpow_zero' := _, zpow_succ' := _, zpow_neg' := _, exists_pair_ne := _, inv_zero := _, mul_inv_cancel := _}