# Documentation

Mathlib.CategoryTheory.Endofunctor.Algebra

# 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)
• a : C

carrier of the algebra

• str : F.obj s.a s.a

structure morphism of the algebra

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

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

A morphism between algebras of endofunctor F

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

The identity morphism of an algebra of endofunctor F

Instances For
def CategoryTheory.Endofunctor.Algebra.Hom.comp {C : Type u} {F : } (f : ) (g : ) :

The composition of morphisms between algebras of endofunctor F

Instances For
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

@[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✝) :
.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✝) :
.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.

Instances For
@[simp]
theorem CategoryTheory.Endofunctor.Algebra.forget_map {C : Type u} (F : ) :
∀ {X Y : } (self : ), ().map self = self.f
@[simp]

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

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.

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_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
@[simp]
theorem CategoryTheory.Endofunctor.Algebra.functorOfNatTrans_obj_a {C : Type u} {F : } {G : } (α : G F) :
().a = A.a
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.

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.

Instances For
@[simp]
theorem CategoryTheory.Endofunctor.Algebra.functorOfNatTransComp_hom_app_f {C : Type u} {F₀ : } {F₁ : } {F₂ : } (α : F₀ F₁) (β : F₁ F₂) :
(.app X).f =
@[simp]
theorem CategoryTheory.Endofunctor.Algebra.functorOfNatTransComp_inv_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.

Instances For
@[simp]
theorem CategoryTheory.Endofunctor.Algebra.functorOfNatTransEq_hom_app_f {C : Type u} {F : } {G : } {α : F G} {β : F G} (h : α = β) :
().f =
@[simp]
theorem CategoryTheory.Endofunctor.Algebra.functorOfNatTransEq_inv_app_f {C : Type u} {F : } {G : } {α : F G} {β : F G} (h : α = β) :
().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.

Instances For
@[simp]
theorem CategoryTheory.Endofunctor.Algebra.equivOfNatIso_inverse {C : Type u} {F : } {G : } (α : F G) :
@[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_unitIso {C : Type u} {F : } {G : } (α : F G) :
().unitIso = CategoryTheory.Endofunctor.Algebra.functorOfNatTransId.symm ≪≫
@[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 h ⋙ forget = forget.

Instances For

The inverse of the structure map of an initial algebra

Instances For

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)
• V : C

carrier of the coalgebra

• str : s.V F.obj s.V

structure morphism of the coalgebra

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

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

A morphism between coalgebras of an endofunctor F

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

The identity morphism of an algebra of endofunctor F

Instances For
def CategoryTheory.Endofunctor.Coalgebra.Hom.comp {C : Type u} {F : } (f : ) (g : ) :

The composition of morphisms between algebras of endofunctor F

Instances For
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

@[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✝) :
= h.inv
@[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✝) :
= h.hom
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.

Instances For
@[simp]
theorem CategoryTheory.Endofunctor.Coalgebra.forget_map {C : Type u} (F : ) :
∀ {X Y : } (f : X Y), = f.f
@[simp]

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

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.

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_map_f {C : Type u} {F : } {G : } (α : F G) :
∀ {X Y : } (f : X Y), ().f = f.f
@[simp]
theorem CategoryTheory.Endofunctor.Coalgebra.functorOfNatTrans_obj_V {C : Type u} {F : } {G : } (α : F G) :
().V = V.V
@[simp]
theorem CategoryTheory.Endofunctor.Coalgebra.functorOfNatTrans_obj_str {C : Type u} {F : } {G : } (α : F G) :
().str = CategoryTheory.CategoryStruct.comp V.str (α.app V.V)
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.

Instances For
@[simp]
theorem CategoryTheory.Endofunctor.Coalgebra.functorOfNatTransId_inv_app_f {C : Type u} {F : } :
(CategoryTheory.Endofunctor.Coalgebra.functorOfNatTransId.inv.app X).f =
@[simp]
theorem CategoryTheory.Endofunctor.Coalgebra.functorOfNatTransId_hom_app_f {C : Type u} {F : } :
(CategoryTheory.Endofunctor.Coalgebra.functorOfNatTransId.hom.app X).f =

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

Instances For
@[simp]
theorem CategoryTheory.Endofunctor.Coalgebra.functorOfNatTransComp_hom_app_f {C : Type u} {F₀ : } {F₁ : } {F₂ : } (α : F₀ F₁) (β : F₁ F₂) :
(.app X).f =
@[simp]
theorem CategoryTheory.Endofunctor.Coalgebra.functorOfNatTransComp_inv_app_f {C : Type u} {F₀ : } {F₁ : } {F₂ : } (α : F₀ F₁) (β : F₁ F₂) :
(.app 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.

Instances For
@[simp]
theorem CategoryTheory.Endofunctor.Coalgebra.functorOfNatTransEq_hom_app_f {C : Type u} {F : } {G : } {α : F G} {β : F G} (h : α = β) :
@[simp]
theorem CategoryTheory.Endofunctor.Coalgebra.functorOfNatTransEq_inv_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.

Instances For
@[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_inverse {C : Type u} {F : } {G : } (α : F G) :
@[simp]
theorem CategoryTheory.Endofunctor.Coalgebra.equivOfNatIso_functor {C : Type u} {F : } {G : } (α : F G) :
@[simp]
theorem CategoryTheory.Endofunctor.Coalgebra.equivOfNatIso_counitIso {C : Type u} {F : } {G : } (α : F G) :
().counitIso = ().symm ≪≫ ≪≫ CategoryTheory.Endofunctor.Coalgebra.functorOfNatTransId
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 h ⋙ forget = forget.

Instances For
theorem CategoryTheory.Endofunctor.Adjunction.Algebra.homEquiv_naturality_str {C : Type u} {F : } {G : } (adj : F G) (f : A₁ A₂) :
theorem CategoryTheory.Endofunctor.Adjunction.Coalgebra.homEquiv_naturality_str_symm {C : Type u} {F : } {G : } (adj : F G) (f : V₁ V₂) :

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.

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.

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.

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.

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.

Instances For