The category of monoids has all colimits. #
We do this construction knowing nothing about monoids.
In particular, I want to claim that this file could be produced by a python script
that just looks at what Lean 3's #print monoid
printed a long time ago (it no longer looks like
this due to the addition of npow
fields):
structure monoid : Type u → Type u
fields:
monoid.mul : Π {M : Type u} [self : monoid M], M → M → M
monoid.mul_assoc : ∀ {M : Type u} [self : monoid M] (a b c : M), a * b * c = a * (b * c)
monoid.one : Π {M : Type u} [self : monoid M], M
monoid.one_mul : ∀ {M : Type u} [self : monoid M] (a : M), 1 * a = a
monoid.mul_one : ∀ {M : Type u} [self : monoid M] (a : M), a * 1 = a
and if we'd fed it the output of Lean 3's #print comm_ring
, this file would instead build
colimits of commutative rings.
A slightly bolder claim is that we could do this with tactics, as well.
Note: Monoid
and CommRing
are no longer flat structures in Mathlib4, and so #print Monoid
gives the less clear
inductive Monoid.{u} : Type u → Type u
number of parameters: 1
constructors:
Monoid.mk : {M : Type u} →
[toSemigroup : Semigroup M] →
[toOne : One M] →
(∀ (a : M), 1 * a = a) →
(∀ (a : M), a * 1 = a) →
(npow : ℕ → M → M) →
autoParam (∀ (x : M), npow 0 x = 1) _auto✝ →
autoParam (∀ (n : ℕ) (x : M), npow (n + 1) x = x * npow n x) _auto✝¹ → Monoid M
We build the colimit of a diagram in MonCat
by constructing the
free monoid on the disjoint union of all the monoids in the diagram,
then taking the quotient by the monoid laws within each monoid,
and the identifications given by the morphisms in the diagram.
An inductive type representing all monoid expressions (without relations)
on a collection of types indexed by the objects of J
.
- of: {J : Type v} → [inst : CategoryTheory.SmallCategory J] → {F : CategoryTheory.Functor J MonCat} → (j : J) → ↑(F.obj j) → MonCat.Colimits.Prequotient F
- one: {J : Type v} → [inst : CategoryTheory.SmallCategory J] → {F : CategoryTheory.Functor J MonCat} → MonCat.Colimits.Prequotient F
- mul: {J : Type v} → [inst : CategoryTheory.SmallCategory J] → {F : CategoryTheory.Functor J MonCat} → MonCat.Colimits.Prequotient F → MonCat.Colimits.Prequotient F → MonCat.Colimits.Prequotient F
Instances For
Equations
- MonCat.Colimits.instInhabitedPrequotient F = { default := MonCat.Colimits.Prequotient.one }
The relation on Prequotient
saying when two expressions are equal
because of the monoid laws, or
because one element is mapped to another by a morphism in the diagram.
- refl: ∀ {J : Type v} [inst : CategoryTheory.SmallCategory J] {F : CategoryTheory.Functor J MonCat} (x : MonCat.Colimits.Prequotient F), MonCat.Colimits.Relation F x x
- symm: ∀ {J : Type v} [inst : CategoryTheory.SmallCategory J] {F : CategoryTheory.Functor J MonCat} (x y : MonCat.Colimits.Prequotient F), MonCat.Colimits.Relation F x y → MonCat.Colimits.Relation F y x
- trans: ∀ {J : Type v} [inst : CategoryTheory.SmallCategory J] {F : CategoryTheory.Functor J MonCat} (x y z : MonCat.Colimits.Prequotient F), MonCat.Colimits.Relation F x y → MonCat.Colimits.Relation F y z → MonCat.Colimits.Relation F x z
- map: ∀ {J : Type v} [inst : CategoryTheory.SmallCategory J] {F : CategoryTheory.Functor J MonCat} (j j' : J) (f : j ⟶ j') (x : ↑(F.obj j)), MonCat.Colimits.Relation F (MonCat.Colimits.Prequotient.of j' ((F.map f) x)) (MonCat.Colimits.Prequotient.of j x)
- mul: ∀ {J : Type v} [inst : CategoryTheory.SmallCategory J] {F : CategoryTheory.Functor J MonCat} (j : J) (x y : ↑(F.obj j)), MonCat.Colimits.Relation F (MonCat.Colimits.Prequotient.of j (x * y)) ((MonCat.Colimits.Prequotient.of j x).mul (MonCat.Colimits.Prequotient.of j y))
- one: ∀ {J : Type v} [inst : CategoryTheory.SmallCategory J] {F : CategoryTheory.Functor J MonCat} (j : J), MonCat.Colimits.Relation F (MonCat.Colimits.Prequotient.of j 1) MonCat.Colimits.Prequotient.one
- mul_1: ∀ {J : Type v} [inst : CategoryTheory.SmallCategory J] {F : CategoryTheory.Functor J MonCat} (x x' y : MonCat.Colimits.Prequotient F), MonCat.Colimits.Relation F x x' → MonCat.Colimits.Relation F (x.mul y) (x'.mul y)
- mul_2: ∀ {J : Type v} [inst : CategoryTheory.SmallCategory J] {F : CategoryTheory.Functor J MonCat} (x y y' : MonCat.Colimits.Prequotient F), MonCat.Colimits.Relation F y y' → MonCat.Colimits.Relation F (x.mul y) (x.mul y')
- mul_assoc: ∀ {J : Type v} [inst : CategoryTheory.SmallCategory J] {F : CategoryTheory.Functor J MonCat} (x y z : MonCat.Colimits.Prequotient F), MonCat.Colimits.Relation F ((x.mul y).mul z) (x.mul (y.mul z))
- one_mul: ∀ {J : Type v} [inst : CategoryTheory.SmallCategory J] {F : CategoryTheory.Functor J MonCat} (x : MonCat.Colimits.Prequotient F), MonCat.Colimits.Relation F (MonCat.Colimits.Prequotient.one.mul x) x
- mul_one: ∀ {J : Type v} [inst : CategoryTheory.SmallCategory J] {F : CategoryTheory.Functor J MonCat} (x : MonCat.Colimits.Prequotient F), MonCat.Colimits.Relation F (x.mul MonCat.Colimits.Prequotient.one) x
Instances For
The setoid corresponding to monoid expressions modulo monoid relations and identifications.
Equations
- MonCat.Colimits.colimitSetoid F = { r := MonCat.Colimits.Relation F, iseqv := ⋯ }
The underlying type of the colimit of a diagram in MonCat
.
Equations
Instances For
Equations
- MonCat.Colimits.instInhabitedColimitType F = id inferInstance
Equations
- MonCat.Colimits.monoidColimitType F = Monoid.mk ⋯ ⋯ npowRecAuto ⋯ ⋯
The bundled monoid giving the colimit of a diagram.
Equations
- MonCat.Colimits.colimit F = { α := MonCat.Colimits.ColimitType F, str := inferInstance }
Instances For
The function from a given monoid in the diagram to the colimit monoid.
Equations
- MonCat.Colimits.coconeFun F j x = Quot.mk (⇑(MonCat.Colimits.colimitSetoid F)) (MonCat.Colimits.Prequotient.of j x)
Instances For
The monoid homomorphism from a given monoid in the diagram to the colimit monoid.
Equations
- MonCat.Colimits.coconeMorphism F j = { toFun := MonCat.Colimits.coconeFun F j, map_one' := ⋯, map_mul' := ⋯ }
Instances For
The cocone over the proposed colimit monoid.
Equations
- MonCat.Colimits.colimitCocone F = { pt := MonCat.Colimits.colimit F, ι := { app := MonCat.Colimits.coconeMorphism F, naturality := ⋯ } }
Instances For
The function from the free monoid on the diagram to the cone point of any other cocone.
Equations
- MonCat.Colimits.descFunLift F s (MonCat.Colimits.Prequotient.of j x_1) = (s.ι.app j) x_1
- MonCat.Colimits.descFunLift F s MonCat.Colimits.Prequotient.one = 1
- MonCat.Colimits.descFunLift F s (x_1.mul y) = MonCat.Colimits.descFunLift F s x_1 * MonCat.Colimits.descFunLift F s y
Instances For
The function from the colimit monoid to the cone point of any other cocone.
Equations
- MonCat.Colimits.descFun F s = Quot.lift (MonCat.Colimits.descFunLift F s) ⋯
Instances For
The monoid homomorphism from the colimit monoid to the cone point of any other cocone.
Equations
- MonCat.Colimits.descMorphism F s = { toFun := MonCat.Colimits.descFun F s, map_one' := ⋯, map_mul' := ⋯ }
Instances For
Evidence that the proposed colimit is the colimit.
Equations
- MonCat.Colimits.colimitIsColimit F = { desc := fun (s : CategoryTheory.Limits.Cocone F) => MonCat.Colimits.descMorphism F s, fac := ⋯, uniq := ⋯ }