# Eilenberg-Moore (co)algebras for a (co)monad

This file defines Eilenberg-Moore (co)algebras for a (co)monad, and provides the category instance for them.

Further it defines the adjoint pair of free and forgetful functors, respectively from and to the original category, as well as the adjoint pair of forgetful and cofree functors, respectively from and to the original category.

## References

• [Riehl, Category theory in context, Section 5.2.4][riehl2017]
structure category_theory.monad.algebra {C : Type u₁} (T : C C)  :
Type (max u₁ v₁)

An Eilenberg-Moore algebra for a monad T. cf Definition 5.2.3 in [Riehl][riehl2017].

@[ext]
structure category_theory.monad.algebra.hom {C : Type u₁} {T : C C}  :
Type v₁

A morphism of Eilenberg–Moore algebras for the monad T.

theorem category_theory.monad.algebra.hom.ext {C : Type u₁} {_inst_1 : category_theory.category C} {T : C C} {_inst_2 : category_theory.monad T} {A B : category_theory.monad.algebra T} (x y : A.hom B) :
x.f = y.fx = y

theorem category_theory.monad.algebra.hom.ext_iff {C : Type u₁} {_inst_1 : category_theory.category C} {T : C C} {_inst_2 : category_theory.monad T} {A B : category_theory.monad.algebra T} (x y : A.hom B) :
x = y x.f = y.f

def category_theory.monad.algebra.hom.id {C : Type u₁} {T : C C}  :
A.hom A

The identity homomorphism for an Eilenberg–Moore algebra.

Equations
@[simp]
theorem category_theory.monad.algebra.hom.id_f {C : Type u₁} {T : C C}  :

@[instance]
def category_theory.monad.algebra.hom.inhabited {C : Type u₁} {T : C C}  :

Equations
def category_theory.monad.algebra.hom.comp {C : Type u₁} {T : C C} {P Q R : category_theory.monad.algebra T} :
P.hom QQ.hom RP.hom R

Composition of Eilenberg–Moore algebra homomorphisms.

Equations
@[simp]
theorem category_theory.monad.algebra.hom.comp_f {C : Type u₁} {T : C C} {P Q R : category_theory.monad.algebra T} (f : P.hom Q) (g : Q.hom R) :
(f.comp g).f = f.f g.f

@[simp]
theorem category_theory.monad.algebra.EilenbergMoore_to_category_struct_comp {C : Type u₁} {T : C C} {P Q R : category_theory.monad.algebra T} (f : P.hom Q) (g : Q.hom R) :
f g = f.comp g

@[instance]
def category_theory.monad.algebra.EilenbergMoore {C : Type u₁} {T : C C}  :

The category of Eilenberg-Moore algebras for a monad. cf Definition 5.2.4 in [Riehl][riehl2017].

Equations
@[simp]

@[simp]
theorem category_theory.monad.forget_map {C : Type u₁} (T : C C) (A B : category_theory.monad.algebra T) (f : A B) :
= f.f

@[simp]
theorem category_theory.monad.forget_obj {C : Type u₁} (T : C C)  :
= A.A

def category_theory.monad.forget {C : Type u₁} (T : C C)  :

The forgetful functor from the Eilenberg-Moore category, forgetting the algebraic structure.

Equations
@[simp]
theorem category_theory.monad.free_obj_A {C : Type u₁} (T : C C) (X : C) :
X).A = T.obj X

def category_theory.monad.free {C : Type u₁} (T : C C)  :

The free functor from the Eilenberg-Moore category, constructing an algebra for any object.

Equations
@[simp]
theorem category_theory.monad.free_obj_a {C : Type u₁} (T : C C) (X : C) :
X).a = (μ_ T).app X

@[simp]
theorem category_theory.monad.free_map_f {C : Type u₁} (T : C C) (X Y : C) (f : X Y) :
f).f = T.map f

@[instance]
def category_theory.monad.inhabited {C : Type u₁} (T : C C) [inhabited C] :

Equations

The adjunction between the free and forgetful constructions for Eilenberg-Moore algebras for a monad. cf Lemma 5.2.8 of [Riehl][riehl2017].

Equations
def category_theory.monad.algebra_iso_of_iso {C : Type u₁} (T : C C) {A B : category_theory.monad.algebra T} (f : A B) [i : category_theory.is_iso f.f] :

Given an algebra morphism whose carrier part is an isomorphism, we get an algebra isomorphism.

Equations
@[instance]
def category_theory.monad.forget_reflects_iso {C : Type u₁} (T : C C)  :

Equations
@[instance]
def category_theory.monad.forget_faithful {C : Type u₁} (T : C C)  :

@[nolint]
structure category_theory.comonad.coalgebra {C : Type u₁} (G : C C)  :
Type (max u₁ v₁)

An Eilenberg-Moore coalgebra for a comonad T.

theorem category_theory.comonad.coalgebra.hom.ext_iff {C : Type u₁} {_inst_1 : category_theory.category C} {G : C C} {_inst_2 : category_theory.comonad G} (x y : A.hom B) :
x = y x.f = y.f

@[nolint, ext]
structure category_theory.comonad.coalgebra.hom {C : Type u₁} {G : C C}  :

A morphism of Eilenberg-Moore coalgebras for the comonad G.

theorem category_theory.comonad.coalgebra.hom.ext {C : Type u₁} {_inst_1 : category_theory.category C} {G : C C} {_inst_2 : category_theory.comonad G} (x y : A.hom B) :
x.f = y.fx = y

@[simp]
theorem category_theory.comonad.coalgebra.hom.id_f {C : Type u₁} {G : C C}  :

def category_theory.comonad.coalgebra.hom.id {C : Type u₁} {G : C C}  :
A.hom A

The identity homomorphism for an Eilenberg–Moore coalgebra.

Equations
@[simp]
theorem category_theory.comonad.coalgebra.hom.comp_f {C : Type u₁} {G : C C} {P Q R : category_theory.comonad.coalgebra G} (f : P.hom Q) (g : Q.hom R) :
(f.comp g).f = f.f g.f

def category_theory.comonad.coalgebra.hom.comp {C : Type u₁} {G : C C} {P Q R : category_theory.comonad.coalgebra G} :
P.hom QQ.hom RP.hom R

Composition of Eilenberg–Moore coalgebra homomorphisms.

Equations
@[simp]
theorem category_theory.comonad.coalgebra.EilenbergMoore_to_category_struct_comp {C : Type u₁} {G : C C} {P Q R : category_theory.comonad.coalgebra G} (f : P.hom Q) (g : Q.hom R) :
f g = f.comp g

@[instance]
def category_theory.comonad.coalgebra.EilenbergMoore {C : Type u₁} {G : C C}  :

The category of Eilenberg-Moore coalgebras for a comonad.

Equations
@[simp]
theorem category_theory.comonad.forget_map {C : Type u₁} (G : C C) (f : A B) :
= f.f

@[simp]
theorem category_theory.comonad.forget_obj {C : Type u₁} (G : C C)  :
= A.A

def category_theory.comonad.forget {C : Type u₁} (G : C C)  :

The forgetful functor from the Eilenberg-Moore category, forgetting the coalgebraic structure.

Equations
@[simp]
theorem category_theory.comonad.cofree_map_f {C : Type u₁} (G : C C) (X Y : C) (f : X Y) :
.f = G.map f

@[simp]
theorem category_theory.comonad.cofree_obj_a {C : Type u₁} (G : C C) (X : C) :
.a = (δ_ G).app X

@[simp]
theorem category_theory.comonad.cofree_obj_A {C : Type u₁} (G : C C) (X : C) :
.A = G.obj X

def category_theory.comonad.cofree {C : Type u₁} (G : C C)  :

The cofree functor from the Eilenberg-Moore category, constructing a coalgebra for any object.

Equations