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 monoidsMandN.AddMonoid.Coprod M N(no notation): the additive version ofMonoid.Coprod.
In other sections, we only list multiplicative definitions.
Instances #
MulOneClass,Monoid, andGroupstructures on the coproductM ∗ N.
Monoid homomorphisms #
Monoid.Coprod.mk: the projectionFreeMonoid (M ⊕ N) →* M ∗ N.Monoid.Coprod.inl,Monoid.Coprod.inr: canonical embeddingsM →* M ∗ NandN →* M ∗ N.Monoid.Coprod.lift: construct a monoid homomorphismM ∗ N →* Pfrom homomorphismsM →* PandN →* P; see alsoMonoid.Coprod.liftEquiv.Monoid.Coprod.clift: a constructor for homomorphismsM ∗ N →* Pthat allows the user to control the computational behavior.Monoid.Coprod.map: combine two homomorphismsf : M →* Nandg : 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: aMulEquivversion ofMonoid.Coprod.map.MulEquiv.coprodComm: aMulEquivversion ofMonoid.Coprod.swap.MulEquiv.coprodAssoc: associativity of the coproduct.MulEquiv.coprodPUnit,MulEquiv.punitCoprod: free product byPUniton 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
Conmakes it easy to define the required type and prove the universal property, so there is little overhead compared to transferring API fromMonoid.CoprodI. - If
MandNlive in different universes, then the definition has to addULifts; 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 bothMandN. - Using a list of
M ⊕ Ninstead of, e.g., a list ofΣ k : Fin 2, ![M, N] kas 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 1andMonoid.CoprodI (f : Bool → Type*) ≃* f false ∗ f true.
Tags #
group, monoid, coproduct, free product
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
Instances For
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
Instances For
Coproduct of two monoids or groups.
Equations
Instances For
Coproduct of two additive monoids or groups.
Equations
Instances For
Coproduct of two monoids or groups.
Equations
Instances For
Equations
Equations
The natural projection FreeMonoid (M ⊕ N) →* M ∗ N.
Equations
Instances For
The natural projection FreeAddMonoid (M ⊕ N) →+ AddMonoid.Coprod M N.
Equations
Instances For
The natural embedding M →* M ∗ N.
Equations
Instances For
The natural embedding M →+ AddMonoid.Coprod M N.
Equations
Instances For
The natural embedding N →* M ∗ N.
Equations
Instances For
The natural embedding N →+ AddMonoid.Coprod M N.
Equations
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
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
Instances For
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.
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.
Map M ∗ N to M' ∗ N' by applying Sum.map f g to each element of the underlying list.
Equations
Instances For
Map AddMonoid.Coprod M N to AddMonoid.Coprod M' N'
by applying Sum.map f g to each element of the underlying list.
Equations
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
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
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
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
Instances For
Coprod.lift as an equivalence.
Equations
Instances For
AddMonoid.Coprod.lift as an equivalence.
Equations
Instances For
The natural projection AddMonoid.Coprod M N →+ M × N.
Equations
Instances For
Alias of AddMonoid.Coprod.toProd.
The natural projection AddMonoid.Coprod M N →+ M × N.
Equations
Instances For
Alias of AddMonoid.Coprod.toProd_comp_inl.
Alias of AddMonoid.Coprod.toProd_comp_inr.
Alias of AddMonoid.Coprod.fst_comp_toProd.
Alias of AddMonoid.Coprod.snd_comp_toProd.
Alias of AddMonoid.Coprod.toProd_surjective.
Lift two monoid equivalences e : M ≃* N and e' : M' ≃* N' to a monoid equivalence
(M ∗ M') ≃* (N ∗ N').
Equations
Instances For
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
Instances For
A MulEquiv version of Coprod.swap.
Equations
Instances For
An AddEquiv version of AddMonoid.Coprod.swap.
Equations
Instances For
An additive equivalence between AddMonoid.Coprod (AddMonoid.Coprod M N) P and
AddMonoid.Coprod M (AddMonoid.Coprod N P).