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 algebra.group.with_one.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.
Equations
- WithOne.instReprWithZero = { reprPrec := fun o x => match o with | none => Std.Format.text "0" | some a => Std.Format.text "↑" ++ repr a }
Equations
- WithZero.instReprWithZero.match_1 motive o h_1 h_2 = Option.casesOn o (h_1 ()) fun val => h_2 val
Instances For
Equations
- WithOne.instReprWithOne = { reprPrec := fun o x => match o with | none => Std.Format.text "1" | some a => Std.Format.text "↑" ++ repr a }
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 => Option.map Neg.neg a }
Equations
- WithOne.inv = { inv := fun a => Option.map Inv.inv a }
Equations
- WithZero.negZeroClass = let src := WithZero.zero; let src_1 := WithZero.neg; NegZeroClass.mk (_ : -0 = -0)
Equations
- WithOne.invOneClass = let src := WithOne.one; let src_1 := WithOne.inv; InvOneClass.mk (_ : 1⁻¹ = 1⁻¹)
Equations
- (_ : Nontrivial (WithZero α)) = (_ : Nontrivial (Option α))
Equations
- (_ : Nontrivial (WithOne α)) = (_ : Nontrivial (Option α))
Recursor for WithZero
using the preferred forms 0
and ↑a
.
Equations
- WithZero.recZeroCoe h₁ h₂ x = WithZero.instReprWithZero.match_1 (fun x => C x) x (fun _ => 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 hx = WithBot.unbot x hx
Instances For
Deconstruct an x : WithOne α
to the underlying value in α
, given a proof that x ≠ 1
.
Equations
- WithOne.unone hx = WithBot.unbot x hx
Instances For
Equations
Equations
Equations
- WithZero.addZeroClass = AddZeroClass.mk (_ : ∀ (a : Option α), Option.liftOrGet (fun x x_1 => x + x_1) none a = a) (_ : ∀ (a : Option α), Option.liftOrGet (fun x x_1 => x + x_1) a none = a)
Equations
- WithOne.mulOneClass = MulOneClass.mk (_ : ∀ (a : Option α), Option.liftOrGet (fun x x_1 => x * x_1) none a = a) (_ : ∀ (a : Option α), Option.liftOrGet (fun x x_1 => x * x_1) a none = a)
Equations
- One or more equations did not get rendered due to their size.
Equations
- WithOne.commMonoid = let src := WithOne.monoid; CommMonoid.mk (_ : ∀ (a b : Option α), Option.liftOrGet (fun x x_1 => x * x_1) a b = Option.liftOrGet (fun x x_1 => x * x_1) b a)
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Given an inverse operation on α
there is an inverse operation
on WithZero α
sending 0
to 0
.
Equations
- WithZero.inv = { inv := fun a => Option.map Inv.inv a }
Equations
- WithZero.invOneClass = let src := WithZero.one; let src_1 := WithZero.inv; InvOneClass.mk (_ : ↑1⁻¹ = 1)
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 => x ^ n
Equations
- WithZero.divInvOneMonoid = let src := WithZero.divInvMonoid; let src_1 := WithZero.invOneClass; DivInvOneMonoid.mk (_ : 1⁻¹ = 1)
if G
is a group then WithZero G
is a group with zero.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- WithZero.addMonoidWithOne = let src := WithZero.addMonoid; let src_1 := WithZero.one; AddMonoidWithOne.mk