Coproduct (free product) of two monoids or groups #
In this file we define Monoid.Coprod M N
(notation: M ∗ N
)
to be the coproduct (a.k.a. free product) of two monoids.
The same type is used for the coproduct of two monoids and for the coproduct of two groups.
The coproduct M ∗ N
has the following universal property:
for any monoid P
and homomorphisms f : M →* P
, g : N →* P
,
there exists a unique homomorphism fg : M ∗ N →* P
such that fg ∘ Monoid.Coprod.inl = f
and fg ∘ Monoid.Coprod.inr = g
,
where Monoid.Coprod.inl : M →* M ∗ N
and Monoid.Coprod.inr : N →* M ∗ N
are canonical embeddings.
This homomorphism fg
is given by Monoid.Coprod.lift f g
.
We also define some homomorphisms and isomorphisms about M ∗ N
,
and provide additive versions of all definitions and theorems.
Main definitions #
Types #
Monoid.Coprod M N
(a.k.a.M ∗ N
): the free product (a.k.a. coproduct) of two monoidsM
andN
.AddMonoid.Coprod M N
(no notation): the additive version ofMonoid.Coprod
.
In other sections, we only list multiplicative definitions.
Instances #
MulOneClass
,Monoid
, andGroup
structures on the coproductM ∗ N
.
Monoid homomorphisms #
-
Monoid.Coprod.mk
: the projectionFreeMonoid (M ⊕ N) →* M ∗ N
. -
Monoid.Coprod.inl
,Monoid.Coprod.inr
: canonical embeddingsM →* M ∗ N
andN →* M ∗ N
. -
Monoid.Coprod.lift
: construct a monoid homomorphismM ∗ N →* P
from homomorphismsM →* P
andN →* P
; see alsoMonoid.Coprod.liftEquiv
. -
Monoid.Coprod.clift
: a constructor for homomorphismsM ∗ N →* P
that allows the user to control the computational behavior. -
Monoid.Coprod.map
: combine two homomorphismsf : M →* N
andg : M' →* N'
intoM ∗ M' →* N ∗ N'
. -
Monoid.Coprod.swap
: the natural homomorphismM ∗ N →* N ∗ M
. -
Monoid.Coprod.fst
,Monoid.Coprod.snd
, andMonoid.Coprod.toProd
: natural projectionsM ∗ N →* M
,M ∗ N →* N
, andM ∗ N →* M × N
.
Monoid isomorphisms #
MulEquiv.coprodCongr
: aMulEquiv
version ofMonoid.Coprod.map
.MulEquiv.coprodComm
: aMulEquiv
version ofMonoid.Coprod.swap
.MulEquiv.coprodAssoc
: associativity of the coproduct.MulEquiv.coprodPUnit
,MulEquiv.punitCoprod
: free product byPUnit
on the left or on the right is isomorphic to the original monoid.
Main results #
The universal property of the coproduct
is given by the definition Monoid.Coprod.lift
and the lemma Monoid.Coprod.lift_unique
.
We also prove a slightly more general extensionality lemma Monoid.Coprod.hom_ext
for homomorphisms M ∗ N →* P
and prove lots of basic lemmas like Monoid.Coprod.fst_comp_inl
.
Implementation details #
The definition of the coproduct of an indexed family of monoids is formalized in Monoid.CoprodI
.
While mathematically M ∗ N
is a particular case
of the coproduct of an indexed family of monoids,
it is easier to build API from scratch instead of using something like
def Monoid.Coprod M N := Monoid.CoprodI ![M, N]
or
def Monoid.Coprod M N := Monoid.CoprodI (fun b : Bool => cond b M N)
There are several reasons to build an API from scratch.
- API about
Con
makes it easy to define the required type and prove the universal property, so there is little overhead compared to transferring API fromMonoid.CoprodI
. - If
M
andN
live in different universes, then the definition has to addULift
s; this makes it harder to transfer API and definitions. - As of now, we have no way
to automatically build an instance of
(k : Fin 2) → Monoid (![M, N] k)
from[Monoid M]
and[Monoid N]
, not even speaking about more advanced typeclass assumptions that involve bothM
andN
. - Using a list of
M ⊕ N
instead of, e.g., a list ofΣ k : Fin 2, ![M, N] k
as the underlying type makes it possible to write computationally effective code (though this point is not tested yet).
TODO #
- Prove
Monoid.CoprodI (f : Fin 2 → Type*) ≃* f 0 ∗ f 1
andMonoid.CoprodI (f : Bool → Type*) ≃* f false ∗ f true
.
Tags #
group, monoid, coproduct, free product
The minimal additive congruence relation c
on FreeAddMonoid (M ⊕ N)
such that FreeAddMonoid.of ∘ Sum.inl
and FreeAddMonoid.of ∘ Sum.inr
are additive monoid homomorphisms to the quotient by c
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The minimal congruence relation c
on FreeMonoid (M ⊕ N)
such that FreeMonoid.of ∘ Sum.inl
and FreeMonoid.of ∘ Sum.inr
are monoid homomorphisms
to the quotient by c
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Coproduct of two additive monoids or groups.
Equations
- AddMonoid.Coprod M N = AddCon.Quotient (AddMonoid.coprodCon M N)
Instances For
Coproduct of two monoids or groups.
Equations
- Monoid.Coprod M N = Con.Quotient (Monoid.coprodCon M N)
Instances For
Coproduct of two monoids or groups.
Equations
- Monoid.Coprod.«term_∗_» = Lean.ParserDescr.trailingNode `Monoid.Coprod.term_∗_ 30 31 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " ∗ ") (Lean.ParserDescr.cat `term 31))
Instances For
Equations
- AddMonoid.Coprod.instAddZeroClassCoprod = AddCon.addZeroClass (AddMonoid.coprodCon M N)
Equations
- Monoid.Coprod.instMulOneClassCoprod = Con.mulOneClass (Monoid.coprodCon M N)
The natural projection FreeAddMonoid (M ⊕ N) →+ AddMonoid.Coprod M N
.
Equations
- AddMonoid.Coprod.mk = AddCon.mk' (AddMonoid.coprodCon M N)
Instances For
The natural projection FreeMonoid (M ⊕ N) →* M ∗ N
.
Equations
- Monoid.Coprod.mk = Con.mk' (Monoid.coprodCon M N)
Instances For
The natural embedding M →+ AddMonoid.Coprod M N
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The natural embedding M →* M ∗ N
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The natural embedding N →+ AddMonoid.Coprod M N
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The natural embedding N →* M ∗ N
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Lift an additive monoid homomorphism FreeAddMonoid (M ⊕ N) →+ P
satisfying
additional properties to AddMonoid.Coprod M N →+ P
.
Compared to AddMonoid.Coprod.lift
,
this definition allows a user to provide a custom computational behavior.
Also, it only needs AddZeroclass
assumptions
while AddMonoid.Coprod.lift
needs an AddMonoid
structure.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Lift a monoid homomorphism FreeMonoid (M ⊕ N) →* P
satisfying additional properties to
M ∗ N →* P
. In many cases, Coprod.lift
is more convenient.
Compared to Coprod.lift
,
this definition allows a user to provide a custom computational behavior.
Also, it only needs MulOneclass
assumptions while Coprod.lift
needs a Monoid
structure.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Extensionality lemma for additive monoid homomorphisms AddMonoid.Coprod M N →+ P
.
If two homomorphisms agree on the ranges of AddMonoid.Coprod.inl
and AddMonoid.Coprod.inr
,
then they are equal.
Extensionality lemma for monoid homomorphisms M ∗ N →* P
.
If two homomorphisms agree on the ranges of Monoid.Coprod.inl
and Monoid.Coprod.inr
,
then they are equal.
Map AddMonoid.Coprod M N
to AddMonoid.Coprod M' N'
by applying Sum.map f g
to each element of the underlying list.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Map M ∗ N
to M' ∗ N'
by applying Sum.map f g
to each element of the underlying list.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Map AddMonoid.Coprod M N
to AddMonoid.Coprod N M
by applying Sum.swap
to each element of the underlying list.
See also AddEquiv.coprodComm
for an AddEquiv
version.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Map M ∗ N
to N ∗ M
by applying Sum.swap
to each element of the underlying list.
See also MulEquiv.coprodComm
for a MulEquiv
version.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Lift a pair of additive monoid homomorphisms f : M →+ P
, g : N →+ P
to an additive monoid homomorphism AddMonoid.Coprod M N →+ P
.
See also AddMonoid.Coprod.clift
for a version that allows custom computational behavior
and works for an AddZeroClass
codomain.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Lift a pair of monoid homomorphisms f : M →* P
, g : N →* P
to a monoid homomorphism M ∗ N →* P
.
See also Coprod.clift
for a version that allows custom computational behavior
and works for a MulOneClass
codomain.
Equations
Instances For
AddMonoid.Coprod.lift
as an equivalence.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Coprod.lift
as an equivalence.
Equations
- One or more equations did not get rendered due to their size.
Instances For
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.
The natural projection AddMonoid.Coprod M N →+ M
.
Equations
- AddMonoid.Coprod.fst = AddMonoid.Coprod.lift (AddMonoidHom.id M) 0
Instances For
The natural projection M ∗ N →* M
.
Equations
- Monoid.Coprod.fst = Monoid.Coprod.lift (MonoidHom.id M) 1
Instances For
The natural projection AddMonoid.Coprod M N →+ N
.
Equations
- AddMonoid.Coprod.snd = AddMonoid.Coprod.lift 0 (AddMonoidHom.id N)
Instances For
The natural projection M ∗ N →* N
.
Equations
- Monoid.Coprod.snd = Monoid.Coprod.lift 1 (MonoidHom.id N)
Instances For
The natural projection AddMonoid.Coprod M N →+ M × N
.
Equations
- AddMonoid.Coprod.toSum = AddMonoid.Coprod.lift (AddMonoidHom.inl M N) (AddMonoidHom.inr M N)
Instances For
The natural projection M ∗ N →* M × N
.
Equations
- Monoid.Coprod.toProd = Monoid.Coprod.lift (MonoidHom.inl M N) (MonoidHom.inr M N)
Instances For
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
- AddMonoid.Coprod.instAddGroupCoprodToAddZeroClassToAddMonoidToSubNegAddMonoidToAddZeroClassToAddMonoidToSubNegAddMonoid = AddGroup.mk (_ : ∀ (y : AddMonoid.Coprod G H), -y + y = 0)
Lift two additive monoid
equivalences e : M ≃+ N
and e' : M' ≃+ N'
to an additive monoid equivalence
(AddMonoid.Coprod M M') ≃+ (AddMonoid.Coprod N N')
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Lift two monoid equivalences e : M ≃* N
and e' : M' ≃* N'
to a monoid equivalence
(M ∗ M') ≃* (N ∗ N')
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
An AddEquiv
version of AddMonoid.Coprod.swap
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A MulEquiv
version of Coprod.swap
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
An additive equivalence between AddMonoid.Coprod (AddMonoid.Coprod M N) P
and
AddMonoid.Coprod M (AddMonoid.Coprod N P)
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A multiplicative equivalence between (M ∗ N) ∗ P
and M ∗ (N ∗ P)
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Isomorphism between M ∗ PUnit
and M
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Isomorphism between PUnit ∗ M
and M
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Isomorphism between M ∗ PUnit
and M
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Isomorphism between PUnit ∗ M
and M
.
Equations
- One or more equations did not get rendered due to their size.