Adjoining a zero/one to semigroups and related algebraic structures #
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.MonCat.Adjunctions
.
Another result says that adjoining to a group an element zero
gives a GroupWithZero
. For more
information about these structures (which are not that standard in informal mathematics, see
Algebra.GroupWithZero.Basic
)
Porting notes #
In Lean 3, we use id
here and there to get correct types of proofs. This is required because
WithOne
and WithZero
are marked as Irreducible
at the end of
Mathlib.Algebra.Group.WithOne.Defs
, so proofs that use Option α
instead of WithOne α
no
longer typecheck. In Lean 4, both types are plain def
s, so we don't need these id
s.
TODO #
WithOne.coe_mul
and WithZero.coe_mul
have inconsistent use of implicit parameters
Equations
- WithZero.instReprWithZero.match_1 motive o h_1 h_2 = Option.casesOn o (h_1 ()) fun (val : α) => h_2 val
Instances For
Equations
- WithZero.add = { add := Option.liftOrGet fun (x x_1 : α) => x + x_1 }
Equations
- WithOne.mul = { mul := Option.liftOrGet fun (x x_1 : α) => x * x_1 }
Equations
- WithZero.neg = { neg := fun (a : WithZero α) => Option.map Neg.neg a }
Equations
- WithOne.inv = { inv := fun (a : WithOne α) => Option.map Inv.inv a }
Equations
- WithZero.negZeroClass = let __src := WithZero.zero; let __src_1 := WithZero.neg; NegZeroClass.mk ⋯
Equations
- WithOne.invOneClass = let __src := WithOne.one; let __src_1 := WithOne.inv; InvOneClass.mk ⋯
Recursor for WithZero
using the preferred forms 0
and ↑a
.
Equations
- WithZero.recZeroCoe h₁ h₂ x = WithZero.instReprWithZero.match_1 (fun (x : WithZero α) => C x) x (fun (_ : Unit) => h₁) fun (x : α) => h₂ x
Instances For
Deconstruct an x : WithZero α
to the underlying value in α
, given a proof that x ≠ 0
.
Equations
- WithZero.unzero x = WithZero.unzero.match_1 (fun (x : WithZero α) (x : x ≠ 0) => α) x✝ x fun (x : α) (x_1 : ↑x ≠ 0) => x
Instances For
Deconstruct an x : WithOne α
to the underlying value in α
, given a proof that x ≠ 1
.
Equations
- WithOne.unone x = match x✝, x with | some x, x_1 => x
Instances For
Equations
- WithZero.addZeroClass = AddZeroClass.mk ⋯ ⋯
Equations
- WithOne.mulOneClass = MulOneClass.mk ⋯ ⋯
Equations
- WithZero.addMonoid = let __spread.0 := WithZero.addZeroClass; AddMonoid.mk ⋯ ⋯ nsmulRec ⋯ ⋯
Equations
- WithZero.addCommMonoid = AddCommMonoid.mk ⋯
Equations
- WithOne.commMonoid = CommMonoid.mk ⋯
Equations
- WithZero.mulZeroClass = let __src := WithZero.zero; MulZeroClass.mk ⋯ ⋯
Equations
- ⋯ = ⋯
Equations
- WithZero.semigroupWithZero = let __src := WithZero.mulZeroClass; SemigroupWithZero.mk ⋯ ⋯
Equations
- WithZero.commSemigroup = let __src := WithZero.semigroupWithZero; CommSemigroup.mk ⋯
Equations
- WithZero.mulZeroOneClass = let __src := WithZero.mulZeroClass; let __src_1 := WithZero.one; MulZeroOneClass.mk ⋯ ⋯
Equations
- WithZero.monoidWithZero = let __src := WithZero.mulZeroOneClass; let __src_1 := WithZero.semigroupWithZero; MonoidWithZero.mk ⋯ ⋯
Equations
- WithZero.commMonoidWithZero = let __src := WithZero.monoidWithZero; let __src_1 := WithZero.commSemigroup; CommMonoidWithZero.mk ⋯ ⋯
Given an inverse operation on α
there is an inverse operation
on WithZero α
sending 0
to 0
.
Equations
- WithZero.inv = { inv := fun (a : WithZero α) => Option.map Inv.inv a }
Equations
- WithZero.invOneClass = let __src := WithZero.one; let __src_1 := WithZero.inv; InvOneClass.mk ⋯
Equations
- WithZero.div = { div := Option.map₂ fun (x x_1 : α) => x / x_1 }
Equations
- WithZero.divInvMonoid = let __src := WithZero.div; let __src_1 := WithZero.inv; let __src_2 := WithZero.monoidWithZero; DivInvMonoid.mk ⋯ (fun (n : ℤ) (x : WithZero α) => x ^ n) ⋯ ⋯ ⋯
Equations
- WithZero.divInvOneMonoid = let __src := WithZero.divInvMonoid; let __src_1 := WithZero.invOneClass; DivInvOneMonoid.mk ⋯
if G
is a group then WithZero G
is a group with zero.
Equations
- WithZero.groupWithZero = let __src := WithZero.monoidWithZero; let __src_1 := WithZero.divInvMonoid; let __src_2 := ⋯; GroupWithZero.mk ⋯ DivInvMonoid.zpow ⋯ ⋯ ⋯ ⋯ ⋯
Equations
- WithZero.commGroupWithZero = let __src := WithZero.groupWithZero; let __src_1 := WithZero.commMonoidWithZero; CommGroupWithZero.mk ⋯ GroupWithZero.zpow ⋯ ⋯ ⋯ ⋯ ⋯
Equations
- WithZero.addMonoidWithOne = let __src := WithZero.addMonoid; let __src_1 := WithZero.one; AddMonoidWithOne.mk ⋯ ⋯