# Algebras of endofunctors #

This file defines (co)algebras of an endofunctor, and provides the category instance for them. It also defines the forgetful functor from the category of (co)algebras. It is shown that the structure map of the initial algebra of an endofunctor is an isomorphism. Furthermore, it is shown that for an adjunction F ⊣ G the category of algebras over F is equivalent to the category of coalgebras over G.

## TODO #

• Prove the dual result about the structure map of the terminal coalgebra of an endofunctor.
• Prove that if the countable infinite product over the powers of the endofunctor exists, then algebras over the endofunctor coincide with algebras over the free monad on the endofunctor.
structure CategoryTheory.Endofunctor.Algebra {C : Type u} (F : ) :
Type (max u v)

An algebra of an endofunctor; str stands for "structure morphism"

• a : C

carrier of the algebra

• str : F.obj self.a self.a

structure morphism of the algebra

Instances For
Equations
theorem CategoryTheory.Endofunctor.Algebra.Hom.ext_iff {C : Type u} :
∀ {inst : } {F : } {A₀ A₁ : } {x y : A₀.Hom A₁}, x = y x.f = y.f
theorem CategoryTheory.Endofunctor.Algebra.Hom.ext {C : Type u} :
∀ {inst : } {F : } {A₀ A₁ : } {x y : A₀.Hom A₁}, x.f = y.fx = y

A morphism between algebras of endofunctor F

Instances For
@[simp]
theorem CategoryTheory.Endofunctor.Algebra.Hom.h {C : Type u} {F : } (self : A₀.Hom A₁) :

compatibility condition

@[simp]

The identity morphism of an algebra of endofunctor F

Equations
• = { f := , h := }
Instances For
Equations
• = { default := { f := , h := } }
def CategoryTheory.Endofunctor.Algebra.Hom.comp {C : Type u} {F : } (f : A₀.Hom A₁) (g : A₁.Hom A₂) :
A₀.Hom A₂

The composition of morphisms between algebras of endofunctor F

Equations
• f.comp g = { f := , h := }
Instances For
Equations
theorem CategoryTheory.Endofunctor.Algebra.ext_iff {C : Type u} {F : } {f : A B} {g : A B} :
f = g autoParam (f.f = g.f) _auto✝
theorem CategoryTheory.Endofunctor.Algebra.ext {C : Type u} {F : } {f : A B} {g : A B} (w : autoParam (f.f = g.f) _auto✝) :
f = g
@[simp]
@[simp]
@[simp]
theorem CategoryTheory.Endofunctor.Algebra.comp_eq_comp {C : Type u} {F : } (f : A₀ A₁) (g : A₁ A₂) :
@[simp]
theorem CategoryTheory.Endofunctor.Algebra.comp_f {C : Type u} {F : } (f : A₀ A₁) (g : A₁ A₂) :

Algebras of an endofunctor F form a category

Equations
@[simp]
theorem CategoryTheory.Endofunctor.Algebra.isoMk_inv_f {C : Type u} {F : } (h : A₀.a A₁.a) (w : autoParam (CategoryTheory.CategoryStruct.comp (F.map h.hom) A₁.str = CategoryTheory.CategoryStruct.comp A₀.str h.hom) _auto✝) :
.inv.f = h.inv
@[simp]
theorem CategoryTheory.Endofunctor.Algebra.isoMk_hom_f {C : Type u} {F : } (h : A₀.a A₁.a) (w : autoParam (CategoryTheory.CategoryStruct.comp (F.map h.hom) A₁.str = CategoryTheory.CategoryStruct.comp A₀.str h.hom) _auto✝) :
.hom.f = h.hom
def CategoryTheory.Endofunctor.Algebra.isoMk {C : Type u} {F : } (h : A₀.a A₁.a) (w : autoParam (CategoryTheory.CategoryStruct.comp (F.map h.hom) A₁.str = CategoryTheory.CategoryStruct.comp A₀.str h.hom) _auto✝) :
A₀ A₁

To construct an isomorphism of algebras, it suffices to give an isomorphism of the As which commutes with the structure morphisms.

Equations
• = { hom := { f := h.hom, h := }, inv := { f := h.inv, h := }, hom_inv_id := , inv_hom_id := }
Instances For
@[simp]
theorem CategoryTheory.Endofunctor.Algebra.forget_map {C : Type u} (F : ) :
∀ {X Y : } (self : X.Hom Y), self = self.f
@[simp]

The forgetful functor from the category of algebras, forgetting the algebraic structure.

Equations
• One or more equations did not get rendered due to their size.
Instances For
theorem CategoryTheory.Endofunctor.Algebra.iso_of_iso {C : Type u} {F : } (f : A₀ A₁) [] :

An algebra morphism with an underlying isomorphism hom in C is an algebra isomorphism.

instance CategoryTheory.Endofunctor.Algebra.forget_reflects_iso {C : Type u} {F : } :
.ReflectsIsomorphisms
Equations
• =
instance CategoryTheory.Endofunctor.Algebra.forget_faithful {C : Type u} {F : } :
.Faithful
Equations
• =
theorem CategoryTheory.Endofunctor.Algebra.epi_of_epi {C : Type u} {F : } (f : X Y) [h : ] :

An algebra morphism with an underlying epimorphism hom in C is an algebra epimorphism.

theorem CategoryTheory.Endofunctor.Algebra.mono_of_mono {C : Type u} {F : } (f : X Y) [h : ] :

An algebra morphism with an underlying monomorphism hom in C is an algebra monomorphism.

@[simp]
theorem CategoryTheory.Endofunctor.Algebra.functorOfNatTrans_obj_a {C : Type u} {F : } {G : } (α : G F) :
.a = A.a
@[simp]
theorem CategoryTheory.Endofunctor.Algebra.functorOfNatTrans_obj_str {C : Type u} {F : } {G : } (α : G F) :
.str = CategoryTheory.CategoryStruct.comp (α.app A.a) A.str
@[simp]
theorem CategoryTheory.Endofunctor.Algebra.functorOfNatTrans_map_f {C : Type u} {F : } {G : } (α : G F) :
∀ {X Y : } (f : X Y), .f = f.f
def CategoryTheory.Endofunctor.Algebra.functorOfNatTrans {C : Type u} {F : } {G : } (α : G F) :

From a natural transformation α : G → F we get a functor from algebras of F to algebras of G.

Equations
• One or more equations did not get rendered due to their size.
Instances For
@[simp]
theorem CategoryTheory.Endofunctor.Algebra.functorOfNatTransId_hom_app_f {C : Type u} {F : } :
(CategoryTheory.Endofunctor.Algebra.functorOfNatTransId.hom.app X).f =
@[simp]
theorem CategoryTheory.Endofunctor.Algebra.functorOfNatTransId_inv_app_f {C : Type u} {F : } :
(CategoryTheory.Endofunctor.Algebra.functorOfNatTransId.inv.app X).f =

The identity transformation induces the identity endofunctor on the category of algebras.

Equations
• One or more equations did not get rendered due to their size.
Instances For
@[simp]
theorem CategoryTheory.Endofunctor.Algebra.functorOfNatTransComp_inv_app_f {C : Type u} {F₀ : } {F₁ : } {F₂ : } (α : F₀ F₁) (β : F₁ F₂) :
(.app X).f =
@[simp]
theorem CategoryTheory.Endofunctor.Algebra.functorOfNatTransComp_hom_app_f {C : Type u} {F₀ : } {F₁ : } {F₂ : } (α : F₀ F₁) (β : F₁ F₂) :
(.app X).f =
def CategoryTheory.Endofunctor.Algebra.functorOfNatTransComp {C : Type u} {F₀ : } {F₁ : } {F₂ : } (α : F₀ F₁) (β : F₁ F₂) :

A composition of natural transformations gives the composition of corresponding functors.

Equations
• One or more equations did not get rendered due to their size.
Instances For
@[simp]
theorem CategoryTheory.Endofunctor.Algebra.functorOfNatTransEq_hom_app_f {C : Type u} {F : } {G : } {α : F G} {β : F G} (h : α = β) :
( X).f =
@[simp]
theorem CategoryTheory.Endofunctor.Algebra.functorOfNatTransEq_inv_app_f {C : Type u} {F : } {G : } {α : F G} {β : F G} (h : α = β) :
( X).f =
def CategoryTheory.Endofunctor.Algebra.functorOfNatTransEq {C : Type u} {F : } {G : } {α : F G} {β : F G} (h : α = β) :

If α and β are two equal natural transformations, then the functors of algebras induced by them are isomorphic. We define it like this as opposed to using eq_to_iso so that the components are nicer to prove lemmas about.

Equations
• One or more equations did not get rendered due to their size.
Instances For
@[simp]
theorem CategoryTheory.Endofunctor.Algebra.equivOfNatIso_inverse {C : Type u} {F : } {G : } (α : F G) :
@[simp]
theorem CategoryTheory.Endofunctor.Algebra.equivOfNatIso_unitIso {C : Type u} {F : } {G : } (α : F G) :
.unitIso = CategoryTheory.Endofunctor.Algebra.functorOfNatTransId.symm ≪≫
@[simp]
theorem CategoryTheory.Endofunctor.Algebra.equivOfNatIso_counitIso {C : Type u} {F : } {G : } (α : F G) :
.counitIso = .symm ≪≫ ≪≫ CategoryTheory.Endofunctor.Algebra.functorOfNatTransId
@[simp]
theorem CategoryTheory.Endofunctor.Algebra.equivOfNatIso_functor {C : Type u} {F : } {G : } (α : F G) :
def CategoryTheory.Endofunctor.Algebra.equivOfNatIso {C : Type u} {F : } {G : } (α : F G) :

Naturally isomorphic endofunctors give equivalent categories of algebras. Furthermore, they are equivalent as categories over C, that is, we have equiv_of_nat_iso hforget = forget.

Equations
• One or more equations did not get rendered due to their size.
Instances For

The inverse of the structure map of an initial algebra

Equations
• = (h.to { a := F.obj A.a, str := F.map A.str }).f
Instances For
theorem CategoryTheory.Endofunctor.Algebra.Initial.left_inv' {C : Type u} {F : } :
{ f := , h := } =

The structure map of the initial algebra is an isomorphism, hence endofunctors preserve their initial algebras

structure CategoryTheory.Endofunctor.Coalgebra {C : Type u} (F : ) :
Type (max u v)

A coalgebra of an endofunctor; str stands for "structure morphism"

• V : C

carrier of the coalgebra

• str : self.V F.obj self.V

structure morphism of the coalgebra

Instances For
Equations
• CategoryTheory.Endofunctor.instInhabitedCoalgebraId = { default := { V := default, str := } }
theorem CategoryTheory.Endofunctor.Coalgebra.Hom.ext_iff {C : Type u} :
∀ {inst : } {F : } {V₀ V₁ : } {x y : V₀.Hom V₁}, x = y x.f = y.f
theorem CategoryTheory.Endofunctor.Coalgebra.Hom.ext {C : Type u} :
∀ {inst : } {F : } {V₀ V₁ : } {x y : V₀.Hom V₁}, x.f = y.fx = y

A morphism between coalgebras of an endofunctor F

Instances For
@[simp]
theorem CategoryTheory.Endofunctor.Coalgebra.Hom.h {C : Type u} {F : } (self : V₀.Hom V₁) :

compatibility condition

@[simp]
theorem CategoryTheory.Endofunctor.Coalgebra.Hom.h_assoc {C : Type u} {F : } (self : V₀.Hom V₁) {Z : C} (h : F.obj V₁.V Z) :

The identity morphism of an algebra of endofunctor F

Equations
• = { f := , h := }
Instances For
Equations
• = { default := { f := , h := } }
def CategoryTheory.Endofunctor.Coalgebra.Hom.comp {C : Type u} {F : } (f : V₀.Hom V₁) (g : V₁.Hom V₂) :
V₀.Hom V₂

The composition of morphisms between algebras of endofunctor F

Equations
• f.comp g = { f := , h := }
Instances For
Equations
• One or more equations did not get rendered due to their size.
theorem CategoryTheory.Endofunctor.Coalgebra.ext_iff {C : Type u} {F : } {f : A B} {g : A B} :
f = g autoParam (f.f = g.f) _auto✝
theorem CategoryTheory.Endofunctor.Coalgebra.ext {C : Type u} {F : } {f : A B} {g : A B} (w : autoParam (f.f = g.f) _auto✝) :
f = g
@[simp]
@[simp]
@[simp]
theorem CategoryTheory.Endofunctor.Coalgebra.comp_eq_comp {C : Type u} {F : } (f : V₀ V₁) (g : V₁ V₂) :
@[simp]
theorem CategoryTheory.Endofunctor.Coalgebra.comp_f {C : Type u} {F : } (f : V₀ V₁) (g : V₁ V₂) :

Coalgebras of an endofunctor F form a category

Equations
@[simp]
theorem CategoryTheory.Endofunctor.Coalgebra.isoMk_hom_f {C : Type u} {F : } (h : V₀.V V₁.V) (w : autoParam (CategoryTheory.CategoryStruct.comp V₀.str (F.map h.hom) = CategoryTheory.CategoryStruct.comp h.hom V₁.str) _auto✝) :
.f = h.hom
@[simp]
theorem CategoryTheory.Endofunctor.Coalgebra.isoMk_inv_f {C : Type u} {F : } (h : V₀.V V₁.V) (w : autoParam (CategoryTheory.CategoryStruct.comp V₀.str (F.map h.hom) = CategoryTheory.CategoryStruct.comp h.hom V₁.str) _auto✝) :
.f = h.inv
def CategoryTheory.Endofunctor.Coalgebra.isoMk {C : Type u} {F : } (h : V₀.V V₁.V) (w : autoParam (CategoryTheory.CategoryStruct.comp V₀.str (F.map h.hom) = CategoryTheory.CategoryStruct.comp h.hom V₁.str) _auto✝) :
V₀ V₁

To construct an isomorphism of coalgebras, it suffices to give an isomorphism of the Vs which commutes with the structure morphisms.

Equations
• = { hom := { f := h.hom, h := }, inv := { f := h.inv, h := }, hom_inv_id := , inv_hom_id := }
Instances For
@[simp]
@[simp]
theorem CategoryTheory.Endofunctor.Coalgebra.forget_map {C : Type u} (F : ) :
∀ {X Y : } (f : X Y), = f.f

The forgetful functor from the category of coalgebras, forgetting the coalgebraic structure.

Equations
• One or more equations did not get rendered due to their size.
Instances For
theorem CategoryTheory.Endofunctor.Coalgebra.iso_of_iso {C : Type u} {F : } (f : V₀ V₁) [] :

A coalgebra morphism with an underlying isomorphism hom in C is a coalgebra isomorphism.

instance CategoryTheory.Endofunctor.Coalgebra.forget_reflects_iso {C : Type u} {F : } :
.ReflectsIsomorphisms
Equations
• =
Equations
• =
theorem CategoryTheory.Endofunctor.Coalgebra.epi_of_epi {C : Type u} {F : } (f : X Y) [h : ] :

An algebra morphism with an underlying epimorphism hom in C is an algebra epimorphism.

theorem CategoryTheory.Endofunctor.Coalgebra.mono_of_mono {C : Type u} {F : } (f : X Y) [h : ] :

An algebra morphism with an underlying monomorphism hom in C is an algebra monomorphism.

@[simp]
theorem CategoryTheory.Endofunctor.Coalgebra.functorOfNatTrans_obj_str {C : Type u} {F : } {G : } (α : F G) :
.str = CategoryTheory.CategoryStruct.comp V.str (α.app V.V)
@[simp]
theorem CategoryTheory.Endofunctor.Coalgebra.functorOfNatTrans_obj_V {C : Type u} {F : } {G : } (α : F G) :
.V = V.V
@[simp]
theorem CategoryTheory.Endofunctor.Coalgebra.functorOfNatTrans_map_f {C : Type u} {F : } {G : } (α : F G) :
∀ {X Y : } (f : X Y), .f = f.f
def CategoryTheory.Endofunctor.Coalgebra.functorOfNatTrans {C : Type u} {F : } {G : } (α : F G) :

From a natural transformation α : F → G we get a functor from coalgebras of F to coalgebras of G.

Equations
• One or more equations did not get rendered due to their size.
Instances For
@[simp]
theorem CategoryTheory.Endofunctor.Coalgebra.functorOfNatTransId_hom_app_f {C : Type u} {F : } :
(CategoryTheory.Endofunctor.Coalgebra.functorOfNatTransId.hom.app X).f =
@[simp]
theorem CategoryTheory.Endofunctor.Coalgebra.functorOfNatTransId_inv_app_f {C : Type u} {F : } :
(CategoryTheory.Endofunctor.Coalgebra.functorOfNatTransId.inv.app X).f =

The identity transformation induces the identity endofunctor on the category of coalgebras.

Equations
• One or more equations did not get rendered due to their size.
Instances For
@[simp]
theorem CategoryTheory.Endofunctor.Coalgebra.functorOfNatTransComp_hom_app_f {C : Type u} {F₀ : } {F₁ : } {F₂ : } (α : F₀ F₁) (β : F₁ F₂) :
( X).f =
@[simp]
theorem CategoryTheory.Endofunctor.Coalgebra.functorOfNatTransComp_inv_app_f {C : Type u} {F₀ : } {F₁ : } {F₂ : } (α : F₀ F₁) (β : F₁ F₂) :
( X).f =
def CategoryTheory.Endofunctor.Coalgebra.functorOfNatTransComp {C : Type u} {F₀ : } {F₁ : } {F₂ : } (α : F₀ F₁) (β : F₁ F₂) :

A composition of natural transformations gives the composition of corresponding functors.

Equations
• One or more equations did not get rendered due to their size.
Instances For
@[simp]
theorem CategoryTheory.Endofunctor.Coalgebra.functorOfNatTransEq_inv_app_f {C : Type u} {F : } {G : } {α : F G} {β : F G} (h : α = β) :
@[simp]
theorem CategoryTheory.Endofunctor.Coalgebra.functorOfNatTransEq_hom_app_f {C : Type u} {F : } {G : } {α : F G} {β : F G} (h : α = β) :
def CategoryTheory.Endofunctor.Coalgebra.functorOfNatTransEq {C : Type u} {F : } {G : } {α : F G} {β : F G} (h : α = β) :

If α and β are two equal natural transformations, then the functors of coalgebras induced by them are isomorphic. We define it like this as opposed to using eq_to_iso so that the components are nicer to prove lemmas about.

Equations
• One or more equations did not get rendered due to their size.
Instances For
@[simp]
theorem CategoryTheory.Endofunctor.Coalgebra.equivOfNatIso_functor {C : Type u} {F : } {G : } (α : F G) :
@[simp]
theorem CategoryTheory.Endofunctor.Coalgebra.equivOfNatIso_unitIso {C : Type u} {F : } {G : } (α : F G) :
= CategoryTheory.Endofunctor.Coalgebra.functorOfNatTransId.symm ≪≫
@[simp]
theorem CategoryTheory.Endofunctor.Coalgebra.equivOfNatIso_counitIso {C : Type u} {F : } {G : } (α : F G) :
.counitIso = .symm ≪≫ ≪≫ CategoryTheory.Endofunctor.Coalgebra.functorOfNatTransId
@[simp]
theorem CategoryTheory.Endofunctor.Coalgebra.equivOfNatIso_inverse {C : Type u} {F : } {G : } (α : F G) :
def CategoryTheory.Endofunctor.Coalgebra.equivOfNatIso {C : Type u} {F : } {G : } (α : F G) :

Naturally isomorphic endofunctors give equivalent categories of coalgebras. Furthermore, they are equivalent as categories over C, that is, we have equiv_of_nat_iso hforget = forget.

Equations
• One or more equations did not get rendered due to their size.
Instances For
theorem CategoryTheory.Endofunctor.Adjunction.Algebra.homEquiv_naturality_str {C : Type u} {F : } {G : } (adj : F G) (f : A₁ A₂) :
CategoryTheory.CategoryStruct.comp ((adj.homEquiv A₁.a A₁.a) A₁.str) (G.map f.f) = CategoryTheory.CategoryStruct.comp f.f ((adj.homEquiv A₂.a A₂.a) A₂.str)
theorem CategoryTheory.Endofunctor.Adjunction.Coalgebra.homEquiv_naturality_str_symm {C : Type u} {F : } {G : } (adj : F G) (f : V₁ V₂) :
CategoryTheory.CategoryStruct.comp (F.map f.f) ((adj.homEquiv V₂.V V₂.V).symm V₂.str) = CategoryTheory.CategoryStruct.comp ((adj.homEquiv V₁.V V₁.V).symm V₁.str) f.f

Given an adjunction F ⊣ G, the functor that associates to an algebra over F a coalgebra over G defined via adjunction applied to the structure map.

Equations
• One or more equations did not get rendered due to their size.
Instances For

Given an adjunction F ⊣ G, the functor that associates to a coalgebra over G an algebra over F defined via adjunction applied to the structure map.

Equations
• One or more equations did not get rendered due to their size.
Instances For

Given an adjunction, assigning to an algebra over the left adjoint a coalgebra over its right adjoint and going back is isomorphic to the identity functor.

Equations
• One or more equations did not get rendered due to their size.
Instances For

Given an adjunction, assigning to a coalgebra over the right adjoint an algebra over the left adjoint and going back is isomorphic to the identity functor.

Equations
• One or more equations did not get rendered due to their size.
Instances For

If F is left adjoint to G, then the category of algebras over F is equivalent to the category of coalgebras over G.

Equations
• One or more equations did not get rendered due to their size.
Instances For