Algebras of endofunctors #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
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.
An algebra of an endofunctor; str
stands for "structure morphism"
Instances for category_theory.endofunctor.algebra
- category_theory.endofunctor.algebra.has_sizeof_inst
- category_theory.endofunctor.algebra.inhabited
- category_theory.endofunctor.algebra.category_theory.category_struct
- category_theory.endofunctor.algebra.category_theory.category
- category_theory.endofunctor.algebra_preadditive
Equations
- category_theory.endofunctor.algebra.inhabited = {default := {A := inhabited.default _inst_2, str := 𝟙 ((𝟭 C).obj inhabited.default)}}
A morphism between algebras of endofunctor F
Instances for category_theory.endofunctor.algebra.hom
- category_theory.endofunctor.algebra.hom.has_sizeof_inst
- category_theory.endofunctor.algebra.hom.inhabited
The identity morphism of an algebra of endofunctor F
The composition of morphisms between algebras of endofunctor F
Algebras of an endofunctor F
form a category
To construct an isomorphism of algebras, it suffices to give an isomorphism of the As which commutes with the structure morphisms.
Equations
- category_theory.endofunctor.algebra.iso_mk h w = {hom := {f := h.hom, h' := w}, inv := {f := h.inv, h' := _}, hom_inv_id' := _, inv_hom_id' := _}
The forgetful functor from the category of algebras, forgetting the algebraic structure.
Equations
- category_theory.endofunctor.algebra.forget F = {obj := λ (A : category_theory.endofunctor.algebra F), A.A, map := λ (A B : category_theory.endofunctor.algebra F) (f : A ⟶ B), f.f, map_id' := _, map_comp' := _}
Instances for category_theory.endofunctor.algebra.forget
An algebra morphism with an underlying isomorphism hom in C
is an algebra isomorphism.
An algebra morphism with an underlying epimorphism hom in C
is an algebra epimorphism.
An algebra morphism with an underlying monomorphism hom in C
is an algebra monomorphism.
From a natural transformation α : G → F
we get a functor from
algebras of F
to algebras of G
.
The identity transformation induces the identity endofunctor on the category of algebras.
Equations
- category_theory.endofunctor.algebra.functor_of_nat_trans_id = category_theory.nat_iso.of_components (λ (X : category_theory.endofunctor.algebra F), category_theory.endofunctor.algebra.iso_mk (category_theory.iso.refl ((category_theory.endofunctor.algebra.functor_of_nat_trans (𝟙 F)).obj X).A) _) category_theory.endofunctor.algebra.functor_of_nat_trans_id._proof_2
A composition of natural transformations gives the composition of corresponding functors.
Equations
- category_theory.endofunctor.algebra.functor_of_nat_trans_comp α β = category_theory.nat_iso.of_components (λ (X : category_theory.endofunctor.algebra F₂), category_theory.endofunctor.algebra.iso_mk (category_theory.iso.refl ((category_theory.endofunctor.algebra.functor_of_nat_trans (α ≫ β)).obj X).A) _) _
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
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
.
Equations
- category_theory.endofunctor.algebra.equiv_of_nat_iso α = {functor := category_theory.endofunctor.algebra.functor_of_nat_trans α.inv, inverse := category_theory.endofunctor.algebra.functor_of_nat_trans α.hom, unit_iso := category_theory.endofunctor.algebra.functor_of_nat_trans_id.symm ≪≫ category_theory.endofunctor.algebra.functor_of_nat_trans_eq _ ≪≫ category_theory.endofunctor.algebra.functor_of_nat_trans_comp α.hom α.inv, counit_iso := (category_theory.endofunctor.algebra.functor_of_nat_trans_comp α.inv α.hom).symm ≪≫ category_theory.endofunctor.algebra.functor_of_nat_trans_eq _ ≪≫ category_theory.endofunctor.algebra.functor_of_nat_trans_id, functor_unit_iso_comp' := _}
The inverse of the structure map of an initial algebra
The structure map of the inital algebra is an isomorphism, hence endofunctors preserve their initial algebras
A coalgebra of an endofunctor; str
stands for "structure morphism"
Instances for category_theory.endofunctor.coalgebra
- category_theory.endofunctor.coalgebra.has_sizeof_inst
- category_theory.endofunctor.coalgebra.inhabited
- category_theory.endofunctor.coalgebra.category_theory.category_struct
- category_theory.endofunctor.coalgebra.category_theory.category
- category_theory.endofunctor.coalgebra_preadditive
Equations
- category_theory.endofunctor.coalgebra.inhabited = {default := {V := inhabited.default _inst_2, str := 𝟙 inhabited.default}}
A morphism between coalgebras of an endofunctor F
Instances for category_theory.endofunctor.coalgebra.hom
- category_theory.endofunctor.coalgebra.hom.has_sizeof_inst
- category_theory.endofunctor.coalgebra.hom.inhabited
The identity morphism of an algebra of endofunctor F
The composition of morphisms between algebras of endofunctor F
Coalgebras of an endofunctor F
form a category
To construct an isomorphism of coalgebras, it suffices to give an isomorphism of the Vs which commutes with the structure morphisms.
Equations
- category_theory.endofunctor.coalgebra.iso_mk h w = {hom := {f := h.hom, h' := w}, inv := {f := h.inv, h' := _}, hom_inv_id' := _, inv_hom_id' := _}
The forgetful functor from the category of coalgebras, forgetting the coalgebraic structure.
Equations
- category_theory.endofunctor.coalgebra.forget F = {obj := λ (A : category_theory.endofunctor.coalgebra F), A.V, map := λ (A B : category_theory.endofunctor.coalgebra F) (f : A ⟶ B), f.f, map_id' := _, map_comp' := _}
Instances for category_theory.endofunctor.coalgebra.forget
A coalgebra morphism with an underlying isomorphism hom in C
is a coalgebra isomorphism.
An algebra morphism with an underlying epimorphism hom in C
is an algebra epimorphism.
An algebra morphism with an underlying monomorphism hom in C
is an algebra monomorphism.
From a natural transformation α : F → G
we get a functor from
coalgebras of F
to coalgebras of G
.
The identity transformation induces the identity endofunctor on the category of coalgebras.
Equations
- category_theory.endofunctor.coalgebra.functor_of_nat_trans_id = category_theory.nat_iso.of_components (λ (X : category_theory.endofunctor.coalgebra F), category_theory.endofunctor.coalgebra.iso_mk (category_theory.iso.refl ((category_theory.endofunctor.coalgebra.functor_of_nat_trans (𝟙 F)).obj X).V) _) category_theory.endofunctor.coalgebra.functor_of_nat_trans_id._proof_2
A composition of natural transformations gives the composition of corresponding functors.
Equations
- category_theory.endofunctor.coalgebra.functor_of_nat_trans_comp α β = category_theory.nat_iso.of_components (λ (X : category_theory.endofunctor.coalgebra F₀), category_theory.endofunctor.coalgebra.iso_mk (category_theory.iso.refl ((category_theory.endofunctor.coalgebra.functor_of_nat_trans (α ≫ β)).obj X).V) _) _
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
- category_theory.endofunctor.coalgebra.functor_of_nat_trans_eq h = category_theory.nat_iso.of_components (λ (X : category_theory.endofunctor.coalgebra F), category_theory.endofunctor.coalgebra.iso_mk (category_theory.iso.refl ((category_theory.endofunctor.coalgebra.functor_of_nat_trans α).obj X).V) _) _
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
.
Equations
- category_theory.endofunctor.coalgebra.equiv_of_nat_iso α = {functor := category_theory.endofunctor.coalgebra.functor_of_nat_trans α.hom, inverse := category_theory.endofunctor.coalgebra.functor_of_nat_trans α.inv, unit_iso := category_theory.endofunctor.coalgebra.functor_of_nat_trans_id.symm ≪≫ category_theory.endofunctor.coalgebra.functor_of_nat_trans_eq _ ≪≫ category_theory.endofunctor.coalgebra.functor_of_nat_trans_comp α.hom α.inv, counit_iso := (category_theory.endofunctor.coalgebra.functor_of_nat_trans_comp α.inv α.hom).symm ≪≫ category_theory.endofunctor.coalgebra.functor_of_nat_trans_eq _ ≪≫ category_theory.endofunctor.coalgebra.functor_of_nat_trans_id, functor_unit_iso_comp' := _}
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
- category_theory.endofunctor.adjunction.algebra.to_coalgebra_of adj = {obj := λ (A : category_theory.endofunctor.algebra F), {V := A.A, str := (adj.hom_equiv A.A A.A).to_fun A.str}, map := λ (A₁ A₂ : category_theory.endofunctor.algebra F) (f : A₁ ⟶ A₂), {f := f.f, h' := _}, map_id' := _, map_comp' := _}
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
- category_theory.endofunctor.adjunction.coalgebra.to_algebra_of adj = {obj := λ (V : category_theory.endofunctor.coalgebra G), {A := V.V, str := (adj.hom_equiv V.V V.V).inv_fun V.str}, map := λ (V₁ V₂ : category_theory.endofunctor.coalgebra G) (f : V₁ ⟶ V₂), {f := f.f, h' := _}, map_id' := _, map_comp' := _}
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
- category_theory.endofunctor.adjunction.alg_coalg_equiv.unit_iso adj = {hom := {app := λ (A : category_theory.endofunctor.algebra F), {f := 𝟙 A.A, h' := _}, naturality' := _}, inv := {app := λ (A : category_theory.endofunctor.algebra F), {f := 𝟙 A.A, h' := _}, naturality' := _}, hom_inv_id' := _, inv_hom_id' := _}
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
- category_theory.endofunctor.adjunction.alg_coalg_equiv.counit_iso adj = {hom := {app := λ (V : category_theory.endofunctor.coalgebra G), {f := 𝟙 V.V, h' := _}, naturality' := _}, inv := {app := λ (V : category_theory.endofunctor.coalgebra G), {f := 𝟙 V.V, h' := _}, naturality' := _}, hom_inv_id' := _, inv_hom_id' := _}
If F
is left adjoint to G
, then the category of algebras over F
is equivalent to the
category of coalgebras over G
.
Equations
- category_theory.endofunctor.adjunction.algebra_coalgebra_equiv adj = {functor := category_theory.endofunctor.adjunction.algebra.to_coalgebra_of adj, inverse := category_theory.endofunctor.adjunction.coalgebra.to_algebra_of adj, unit_iso := category_theory.endofunctor.adjunction.alg_coalg_equiv.unit_iso adj, counit_iso := category_theory.endofunctor.adjunction.alg_coalg_equiv.counit_iso adj, functor_unit_iso_comp' := _}