Adjoining a zero/one to semigroups and related algebraic structures #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
This file contains different results about adjoining an element to an algebraic structure which then
behaves like a zero or a one. An example is adjoining a one to a semigroup to obtain a monoid. That
this provides an example of an adjunction is proved in algebra.category.Mon.adjunctions
.
Another result says that adjoining to a group an element zero
gives a group_with_zero
. For more
information about these structures (which are not that standard in informal mathematics, see
algebra.group_with_zero.basic
)
Implementation notes #
At various points in this file, id $
is used in at the start of a proof field in a structure. This
ensures that the generated _proof_1
lemmas are stated in terms of the algebraic operations and
not option.map
, as the latter does not typecheck once with_zero
/with_one
is irreducible.
Add an extra element 1
to a type
Add an extra element 0
to a type
Instances for with_zero
- with_one.with_zero.has_repr
- with_zero.has_repr
- with_zero.monad
- with_zero.has_zero
- with_zero.has_add
- with_zero.has_neg
- with_zero.has_involutive_neg
- with_zero.neg_zero_class
- with_zero.inhabited
- with_zero.nontrivial
- with_zero.has_coe_t
- with_zero.can_lift
- with_zero.add_zero_class
- with_zero.add_monoid
- with_zero.add_comm_monoid
- with_zero.has_one
- with_zero.mul_zero_class
- with_zero.no_zero_divisors
- with_zero.semigroup_with_zero
- with_zero.comm_semigroup
- with_zero.mul_zero_one_class
- with_zero.nat.has_pow
- with_zero.monoid_with_zero
- with_zero.comm_monoid_with_zero
- with_zero.has_inv
- with_zero.has_involutive_inv
- with_zero.inv_one_class
- with_zero.has_div
- with_zero.int.has_pow
- with_zero.div_inv_monoid
- with_zero.div_inv_one_monoid
- with_zero.division_monoid
- with_zero.division_comm_monoid
- with_zero.group_with_zero
- with_zero.comm_group_with_zero
- with_zero.add_monoid_with_one
- with_zero.semiring
- with_zero.preorder
- with_zero.partial_order
- with_zero.order_bot
- with_zero.lattice
- with_zero.linear_order
- with_zero.covariant_class_mul_le
- with_zero.ordered_comm_monoid
- with_zero.has_exists_add_of_le
- with_zero.canonically_ordered_add_monoid
- with_zero.canonically_linear_ordered_add_monoid
- with_zero.contravariant_class_mul_lt
- with_zero.linear_ordered_comm_monoid_with_zero
- with_zero.linear_ordered_comm_group_with_zero
- is_dedekind_domain.height_one_spectrum.valued_adic_completion
- function_field.valued_Fqt_infty
- counterexample.counterexample_not_prime_but_homogeneous_prime.two.linear_ordered_add_comm_monoid
Equations
- with_one.with_zero.has_repr = {repr := λ (o : with_zero α), with_one.with_zero.has_repr._match_1 o}
- with_one.with_zero.has_repr._match_1 (option.some a) = "↑" ++ repr a
- with_one.with_zero.has_repr._match_1 option.none = "0"
Equations
- with_one.has_repr = {repr := λ (o : with_one α), with_one.has_repr._match_1 o}
- with_one.has_repr._match_1 (option.some a) = "↑" ++ repr a
- with_one.has_repr._match_1 option.none = "1"
Equations
- with_zero.has_repr = {repr := λ (o : with_zero α), with_zero.has_repr._match_1 o}
- with_zero.has_repr._match_1 option.none = "1"
- with_zero.has_repr._match_1 (option.some a) = "↑" ++ repr a
Equations
Equations
Equations
- with_one.has_one = {one := option.none α}
Equations
- with_zero.has_zero = {zero := option.none α}
Equations
Equations
Equations
- with_one.has_inv = {inv := λ (a : with_one α), option.map has_inv.inv a}
Equations
- with_zero.has_neg = {neg := λ (a : with_zero α), option.map has_neg.neg a}
Equations
Equations
Equations
- with_one.inv_one_class = {one := 1, inv := has_inv.inv with_one.has_inv, inv_one := _}
Equations
- with_zero.neg_zero_class = {zero := 0, neg := has_neg.neg with_zero.has_neg, neg_zero := _}
Equations
- with_one.inhabited = {default := 1}
Equations
- with_zero.inhabited = {default := 0}
Equations
- with_zero.has_coe_t = {coe := option.some α}
Equations
- with_one.has_coe_t = {coe := option.some α}
Deconstruct a x : with_zero α
to the underlying value in α
, given a proof that x ≠ 0
.
Equations
- with_zero.unzero hx = with_bot.unbot x hx
Deconstruct a x : with_one α
to the underlying value in α
, given a proof that x ≠ 1
.
Equations
- with_one.unone hx = with_bot.unbot x hx
Equations
- with_zero.add_zero_class = {zero := 0, add := has_add.add with_zero.has_add, zero_add := _, add_zero := _}
Equations
- with_one.mul_one_class = {one := 1, mul := has_mul.mul with_one.has_mul, one_mul := _, mul_one := _}
Equations
- with_zero.add_monoid = {add := add_zero_class.add with_zero.add_zero_class, add_assoc := _, zero := add_zero_class.zero with_zero.add_zero_class, zero_add := _, add_zero := _, nsmul := nsmul_rec (add_zero_class.to_has_add (with_zero α)), nsmul_zero' := _, nsmul_succ' := _}
Equations
- with_one.monoid = {mul := mul_one_class.mul with_one.mul_one_class, mul_assoc := _, one := mul_one_class.one with_one.mul_one_class, one_mul := _, mul_one := _, npow := npow_rec (mul_one_class.to_has_mul (with_one α)), npow_zero' := _, npow_succ' := _}
Equations
- with_zero.add_comm_monoid = {add := add_monoid.add with_zero.add_monoid, add_assoc := _, zero := add_monoid.zero with_zero.add_monoid, zero_add := _, add_zero := _, nsmul := add_monoid.nsmul with_zero.add_monoid, nsmul_zero' := _, nsmul_succ' := _, add_comm := _}
Equations
- with_one.comm_monoid = {mul := monoid.mul with_one.monoid, mul_assoc := _, one := monoid.one with_one.monoid, one_mul := _, mul_one := _, npow := monoid.npow with_one.monoid, npow_zero' := _, npow_succ' := _, mul_comm := _}
Equations
- with_zero.mul_zero_class = {mul := option.map₂ has_mul.mul, zero := 0, zero_mul := _, mul_zero := _}
Equations
Equations
Equations
- with_zero.mul_zero_one_class = {one := 1, mul := mul_zero_class.mul with_zero.mul_zero_class, one_mul := _, mul_one := _, zero := mul_zero_class.zero with_zero.mul_zero_class, zero_mul := _, mul_zero := _}
Equations
- with_zero.nat.has_pow = {pow := λ (x : with_zero α) (n : ℕ), with_zero.nat.has_pow._match_1 x n}
- with_zero.nat.has_pow._match_1 (option.some x) n = ↑(x ^ n)
- with_zero.nat.has_pow._match_1 option.none (n + 1) = 0
- with_zero.nat.has_pow._match_1 option.none 0 = 1
Equations
- with_zero.monoid_with_zero = {mul := mul_zero_one_class.mul with_zero.mul_zero_one_class, mul_assoc := _, one := mul_zero_one_class.one with_zero.mul_zero_one_class, one_mul := _, mul_one := _, npow := λ (n : ℕ) (x : with_zero α), x ^ n, npow_zero' := _, npow_succ' := _, zero := mul_zero_one_class.zero with_zero.mul_zero_one_class, zero_mul := _, mul_zero := _}
Equations
- with_zero.comm_monoid_with_zero = {mul := monoid_with_zero.mul with_zero.monoid_with_zero, mul_assoc := _, one := monoid_with_zero.one with_zero.monoid_with_zero, one_mul := _, mul_one := _, npow := monoid_with_zero.npow with_zero.monoid_with_zero, npow_zero' := _, npow_succ' := _, mul_comm := _, zero := monoid_with_zero.zero with_zero.monoid_with_zero, zero_mul := _, mul_zero := _}
Given an inverse operation on α
there is an inverse operation
on with_zero α
sending 0
to 0
Equations
- with_zero.has_inv = {inv := λ (a : with_zero α), option.map has_inv.inv a}
Equations
Equations
- with_zero.inv_one_class = {one := 1, inv := has_inv.inv with_zero.has_inv, inv_one := _}
Equations
Equations
- with_zero.int.has_pow = {pow := λ (x : with_zero α) (n : ℤ), with_zero.int.has_pow._match_1 x n}
- with_zero.int.has_pow._match_1 (option.some x) n = ↑(x ^ n)
- with_zero.int.has_pow._match_1 option.none -[1+ n] = 0
- with_zero.int.has_pow._match_1 option.none (int.of_nat n.succ) = 0
- with_zero.int.has_pow._match_1 option.none (int.of_nat 0) = 1
Equations
- with_zero.div_inv_monoid = {mul := monoid_with_zero.mul with_zero.monoid_with_zero, mul_assoc := _, one := monoid_with_zero.one with_zero.monoid_with_zero, one_mul := _, mul_one := _, npow := monoid_with_zero.npow with_zero.monoid_with_zero, npow_zero' := _, npow_succ' := _, inv := has_inv.inv with_zero.has_inv, div := has_div.div with_zero.has_div, div_eq_mul_inv := _, zpow := λ (n : ℤ) (x : with_zero α), x ^ n, zpow_zero' := _, zpow_succ' := _, zpow_neg' := _}
Equations
- with_zero.div_inv_one_monoid = {mul := div_inv_monoid.mul with_zero.div_inv_monoid, mul_assoc := _, one := div_inv_monoid.one with_zero.div_inv_monoid, one_mul := _, mul_one := _, npow := div_inv_monoid.npow with_zero.div_inv_monoid, npow_zero' := _, npow_succ' := _, inv := div_inv_monoid.inv with_zero.div_inv_monoid, div := div_inv_monoid.div with_zero.div_inv_monoid, div_eq_mul_inv := _, zpow := div_inv_monoid.zpow with_zero.div_inv_monoid, zpow_zero' := _, zpow_succ' := _, zpow_neg' := _, inv_one := _}
Equations
- with_zero.division_monoid = {mul := div_inv_monoid.mul with_zero.div_inv_monoid, mul_assoc := _, one := div_inv_monoid.one with_zero.div_inv_monoid, one_mul := _, mul_one := _, npow := div_inv_monoid.npow with_zero.div_inv_monoid, npow_zero' := _, npow_succ' := _, inv := div_inv_monoid.inv with_zero.div_inv_monoid, div := div_inv_monoid.div with_zero.div_inv_monoid, div_eq_mul_inv := _, zpow := div_inv_monoid.zpow with_zero.div_inv_monoid, zpow_zero' := _, zpow_succ' := _, zpow_neg' := _, inv_inv := _, mul_inv_rev := _, inv_eq_of_mul := _}
Equations
- with_zero.division_comm_monoid = {mul := division_monoid.mul with_zero.division_monoid, mul_assoc := _, one := division_monoid.one with_zero.division_monoid, one_mul := _, mul_one := _, npow := division_monoid.npow with_zero.division_monoid, npow_zero' := _, npow_succ' := _, inv := division_monoid.inv with_zero.division_monoid, div := division_monoid.div with_zero.division_monoid, div_eq_mul_inv := _, zpow := division_monoid.zpow with_zero.division_monoid, zpow_zero' := _, zpow_succ' := _, zpow_neg' := _, inv_inv := _, mul_inv_rev := _, inv_eq_of_mul := _, mul_comm := _}
if G
is a group then with_zero G
is a group with zero.
Equations
- with_zero.group_with_zero = {mul := monoid_with_zero.mul with_zero.monoid_with_zero, mul_assoc := _, one := monoid_with_zero.one with_zero.monoid_with_zero, one_mul := _, mul_one := _, npow := monoid_with_zero.npow with_zero.monoid_with_zero, npow_zero' := _, npow_succ' := _, zero := monoid_with_zero.zero with_zero.monoid_with_zero, zero_mul := _, mul_zero := _, inv := div_inv_monoid.inv with_zero.div_inv_monoid, div := div_inv_monoid.div with_zero.div_inv_monoid, div_eq_mul_inv := _, zpow := div_inv_monoid.zpow with_zero.div_inv_monoid, zpow_zero' := _, zpow_succ' := _, zpow_neg' := _, exists_pair_ne := _, inv_zero := _, mul_inv_cancel := _}
Equations
- with_zero.comm_group_with_zero = {mul := group_with_zero.mul with_zero.group_with_zero, mul_assoc := _, one := group_with_zero.one with_zero.group_with_zero, one_mul := _, mul_one := _, npow := group_with_zero.npow with_zero.group_with_zero, npow_zero' := _, npow_succ' := _, mul_comm := _, zero := group_with_zero.zero with_zero.group_with_zero, zero_mul := _, mul_zero := _, inv := group_with_zero.inv with_zero.group_with_zero, div := group_with_zero.div with_zero.group_with_zero, div_eq_mul_inv := _, zpow := group_with_zero.zpow with_zero.group_with_zero, zpow_zero' := _, zpow_succ' := _, zpow_neg' := _, exists_pair_ne := _, inv_zero := _, mul_inv_cancel := _}
Equations
- with_zero.add_monoid_with_one = {nat_cast := λ (n : ℕ), ite (n = 0) 0 ↑(n.cast), add := add_monoid.add with_zero.add_monoid, add_assoc := _, zero := add_monoid.zero with_zero.add_monoid, zero_add := _, add_zero := _, nsmul := add_monoid.nsmul with_zero.add_monoid, nsmul_zero' := _, nsmul_succ' := _, one := 1, nat_cast_zero := _, nat_cast_succ := _}
Equations
- with_zero.semiring = {add := add_monoid_with_one.add with_zero.add_monoid_with_one, add_assoc := _, zero := add_monoid_with_one.zero with_zero.add_monoid_with_one, zero_add := _, add_zero := _, nsmul := add_monoid_with_one.nsmul with_zero.add_monoid_with_one, nsmul_zero' := _, nsmul_succ' := _, add_comm := _, mul := mul_zero_class.mul with_zero.mul_zero_class, left_distrib := _, right_distrib := _, zero_mul := _, mul_zero := _, mul_assoc := _, one := add_monoid_with_one.one with_zero.add_monoid_with_one, one_mul := _, mul_one := _, nat_cast := add_monoid_with_one.nat_cast with_zero.add_monoid_with_one, nat_cast_zero := _, nat_cast_succ := _, npow := monoid_with_zero.npow with_zero.monoid_with_zero, npow_zero' := _, npow_succ' := _}