Documentation

Mathlib.CategoryTheory.Monad.Algebra

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 #

structure CategoryTheory.Monad.Algebra {C : Type u₁} [Category.{v₁, u₁} C] (T : Monad C) :
Type (max u₁ v₁)

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

Instances For
    structure CategoryTheory.Comonad.Coalgebra {C : Type u₁} [Category.{v₁, u₁} C] (T : Comonad C) :
    Type (max u₁ v₁)

    An Eilenberg-Moore coalgebra for a comonad T.

    Instances For
      theorem CategoryTheory.Monad.Algebra.unit_assoc {C : Type u₁} [Category.{v₁, u₁} C] {T : Monad C} (self : T.Algebra) {Z : C} (h : self.A ⟶ Z) :

      The unit axiom associated to an algebra.

      theorem CategoryTheory.Monad.Algebra.assoc_assoc {C : Type u₁} [Category.{v₁, u₁} C] {T : Monad C} (self : T.Algebra) {Z : C} (h : self.A ⟶ Z) :

      The associativity axiom associated to an algebra.

      theorem CategoryTheory.Comonad.Coalgebra.counit_assoc {C : Type u₁} [Category.{v₁, u₁} C] {T : Comonad C} (self : T.Coalgebra) {Z : C} (h : self.A ⟶ Z) :

      The counit axiom associated to a coalgebra.

      theorem CategoryTheory.Comonad.Coalgebra.coassoc_assoc {C : Type u₁} [Category.{v₁, u₁} C] {T : Comonad C} (self : T.Coalgebra) {Z : C} (h : T.obj (T.obj self.A) ⟶ Z) :

      The coassociativity axiom associated to a coalgebra.

      structure CategoryTheory.Monad.Algebra.Hom {C : Type u₁} [Category.{v₁, u₁} C] {T : Monad C} (A B : T.Algebra) :
      Type v₁

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

      Instances For
        theorem CategoryTheory.Monad.Algebra.Hom.ext {C : Type u₁} {inst✝ : Category.{v₁, u₁} C} {T : Monad C} {A B : T.Algebra} {x y : A.Hom B} (f : x.f = y.f) :
        x = y
        theorem CategoryTheory.Monad.Algebra.Hom.ext_iff {C : Type u₁} {inst✝ : Category.{v₁, u₁} C} {T : Monad C} {A B : T.Algebra} {x y : A.Hom B} :
        x = y ↔ x.f = y.f
        structure CategoryTheory.Comonad.Coalgebra.Hom {C : Type u₁} [Category.{v₁, u₁} C] {T : Comonad C} (A B : T.Coalgebra) :
        Type v₁

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

        Instances For
          theorem CategoryTheory.Comonad.Coalgebra.Hom.ext_iff {C : Type u₁} {inst✝ : Category.{v₁, u₁} C} {T : Comonad C} {A B : T.Coalgebra} {x y : A.Hom B} :
          x = y ↔ x.f = y.f
          theorem CategoryTheory.Comonad.Coalgebra.Hom.ext {C : Type u₁} {inst✝ : Category.{v₁, u₁} C} {T : Comonad C} {A B : T.Coalgebra} {x y : A.Hom B} (f : x.f = y.f) :
          x = y
          @[simp]

          Compatibility with the structure morphism, for a morphism of coalgebras.

          @[simp]
          theorem CategoryTheory.Monad.Algebra.Hom.h_assoc {C : Type u₁} [Category.{v₁, u₁} C] {T : Monad C} {A B : T.Algebra} (self : A.Hom B) {Z : C} (h : B.A ⟶ Z) :

          Compatibility with the structure morphism, for a morphism of algebras.

          The identity homomorphism for an Eilenberg–Moore algebra.

          Equations
          Instances For

            The identity homomorphism for an Eilenberg–Moore coalgebra.

            Equations
            Instances For
              def CategoryTheory.Monad.Algebra.Hom.comp {C : Type u₁} [Category.{v₁, u₁} C] {T : Monad C} {P Q R : T.Algebra} (f : P.Hom Q) (g : Q.Hom R) :
              P.Hom R

              Composition of Eilenberg–Moore algebra homomorphisms.

              Equations
              Instances For
                def CategoryTheory.Comonad.Coalgebra.Hom.comp {C : Type u₁} [Category.{v₁, u₁} C] {T : Comonad C} {P Q R : T.Coalgebra} (g : R.Hom Q) (f : Q.Hom P) :
                R.Hom P

                Composition of Eilenberg–Moore coalgebra homomorphisms.

                Equations
                Instances For
                  @[instance_reducible]
                  Equations
                  • One or more equations did not get rendered due to their size.
                  @[instance_reducible]
                  Equations
                  • One or more equations did not get rendered due to their size.
                  theorem CategoryTheory.Monad.Algebra.Hom.ext' {C : Type u₁} [Category.{v₁, u₁} C] {T : Monad C} (X Y : T.Algebra) (f g : X ⟶ Y) (h : f.f = g.f) :
                  f = g
                  theorem CategoryTheory.Comonad.Coalgebra.Hom.ext' {C : Type u₁} [Category.{v₁, u₁} C] {T : Comonad C} (X Y : T.Coalgebra) (f g : Y ⟶ X) (h : f.f = g.f) :
                  f = g
                  theorem CategoryTheory.Comonad.Coalgebra.Hom.ext'_iff {C : Type u₁} [Category.{v₁, u₁} C] {T : Comonad C} {X Y : T.Coalgebra} {f g : Y ⟶ X} :
                  f = g ↔ f.f = g.f
                  theorem CategoryTheory.Monad.Algebra.Hom.ext'_iff {C : Type u₁} [Category.{v₁, u₁} C] {T : Monad C} {X Y : T.Algebra} {f g : X ⟶ Y} :
                  f = g ↔ f.f = g.f
                  @[simp]
                  theorem CategoryTheory.Monad.Algebra.comp_eq_comp {C : Type u₁} [Category.{v₁, u₁} C] {T : Monad C} {A A' A'' : T.Algebra} (f : A ⟶ A') (g : A' ⟶ A'') :
                  @[simp]
                  theorem CategoryTheory.Comonad.Coalgebra.comp_eq_comp {C : Type u₁} [Category.{v₁, u₁} C] {T : Comonad C} {A A' A'' : T.Coalgebra} (g : A'' ⟶ A') (f : A' ⟶ A) :
                  @[simp]
                  theorem CategoryTheory.Monad.Algebra.comp_f {C : Type u₁} [Category.{v₁, u₁} C] {T : Monad C} {A A' A'' : T.Algebra} (f : A ⟶ A') (g : A' ⟶ A'') :
                  @[simp]
                  theorem CategoryTheory.Comonad.Coalgebra.comp_f {C : Type u₁} [Category.{v₁, u₁} C] {T : Comonad C} {A A' A'' : T.Coalgebra} (g : A'' ⟶ A') (f : A' ⟶ A) :
                  @[instance_reducible]

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

                  Equations
                  @[instance_reducible]

                  The category of Eilenberg-Moore coalgebras for a comonad.

                  Equations
                  def CategoryTheory.Monad.Algebra.isoMk {C : Type u₁} [Category.{v₁, u₁} C] {T : Monad C} {A B : T.Algebra} (h : A.A ≅ B.A) (w : CategoryStruct.comp (T.map h.hom) B.a = CategoryStruct.comp A.a h.hom := by cat_disch) :
                  A ≅ B

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

                  Equations
                  Instances For
                    @[simp]
                    theorem CategoryTheory.Monad.Algebra.isoMk_inv_f {C : Type u₁} [Category.{v₁, u₁} C] {T : Monad C} {A B : T.Algebra} (h : A.A ≅ B.A) (w : CategoryStruct.comp (T.map h.hom) B.a = CategoryStruct.comp A.a h.hom := by cat_disch) :
                    (isoMk h w).inv.f = h.inv
                    @[simp]
                    theorem CategoryTheory.Monad.Algebra.isoMk_hom_f {C : Type u₁} [Category.{v₁, u₁} C] {T : Monad C} {A B : T.Algebra} (h : A.A ≅ B.A) (w : CategoryStruct.comp (T.map h.hom) B.a = CategoryStruct.comp A.a h.hom := by cat_disch) :
                    (isoMk h w).hom.f = h.hom
                    def CategoryTheory.Comonad.Coalgebra.isoMk {C : Type u₁} [Category.{v₁, u₁} C] {T : Comonad C} {A B : T.Coalgebra} (h : A.A ≅ B.A) (w : CategoryStruct.comp A.a (T.map h.hom) = CategoryStruct.comp h.hom B.a := by cat_disch) :
                    A ≅ B

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

                    Equations
                    Instances For
                      @[simp]
                      theorem CategoryTheory.Comonad.Coalgebra.isoMk_inv_f {C : Type u₁} [Category.{v₁, u₁} C] {T : Comonad C} {A B : T.Coalgebra} (h : A.A ≅ B.A) (w : CategoryStruct.comp A.a (T.map h.hom) = CategoryStruct.comp h.hom B.a := by cat_disch) :
                      (isoMk h w).inv.f = h.inv
                      @[simp]
                      theorem CategoryTheory.Comonad.Coalgebra.isoMk_hom_f {C : Type u₁} [Category.{v₁, u₁} C] {T : Comonad C} {A B : T.Coalgebra} (h : A.A ≅ B.A) (w : CategoryStruct.comp A.a (T.map h.hom) = CategoryStruct.comp h.hom B.a := by cat_disch) :
                      (isoMk h w).hom.f = h.hom
                      @[implicit_reducible]

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

                      Equations
                      Instances For
                        @[implicit_reducible]

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

                        Equations
                        Instances For
                          @[simp]
                          theorem CategoryTheory.Comonad.forget_map {C : Type u₁} [Category.{v₁, u₁} C] (T : Comonad C) {Y✝ X✝ : T.Coalgebra} (f : Y✝ ⟶ X✝) :
                          T.forget.map f = f.f
                          @[simp]
                          theorem CategoryTheory.Monad.forget_map {C : Type u₁} [Category.{v₁, u₁} C] (T : Monad C) {X✝ Y✝ : T.Algebra} (f : X✝ ⟶ Y✝) :
                          T.forget.map f = f.f
                          @[simp]
                          @[simp]
                          theorem CategoryTheory.Monad.forget_obj {C : Type u₁} [Category.{v₁, u₁} C] (T : Monad C) (A : T.Algebra) :
                          T.forget.obj A = A.A
                          @[implicit_reducible]

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

                          Equations
                          • T.free = { obj := fun (X : C) => { A := T.obj X, a := T.μ.app X, unit := ⋯, assoc := ⋯ }, map := fun {X Y : C} (f : X ⟶ Y) => { f := T.map f, h := ⋯ }, map_id := ⋯, map_comp := ⋯ }
                          Instances For
                            @[implicit_reducible]

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

                            Equations
                            • T.cofree = { obj := fun (X : C) => { A := T.obj X, a := T.δ.app X, counit := ⋯, coassoc := ⋯ }, map := fun {Y X : C} (f : Y ⟶ X) => { f := T.map f, h := ⋯ }, map_id := ⋯, map_comp := ⋯ }
                            Instances For
                              @[simp]
                              theorem CategoryTheory.Comonad.cofree_obj_a {C : Type u₁} [Category.{v₁, u₁} C] (T : Comonad C) (X : C) :
                              (T.cofree.obj X).a = T.δ.app X
                              @[simp]
                              theorem CategoryTheory.Monad.free_obj_a {C : Type u₁} [Category.{v₁, u₁} C] (T : Monad C) (X : C) :
                              (T.free.obj X).a = T.μ.app X
                              @[simp]
                              theorem CategoryTheory.Comonad.cofree_map_f {C : Type u₁} [Category.{v₁, u₁} C] (T : Comonad C) {Y✝ X✝ : C} (f : Y✝ ⟶ X✝) :
                              (T.cofree.map f).f = T.map f
                              @[simp]
                              theorem CategoryTheory.Monad.free_map_f {C : Type u₁} [Category.{v₁, u₁} C] (T : Monad C) {X✝ Y✝ : C} (f : X✝ ⟶ Y✝) :
                              (T.free.map f).f = T.map f
                              @[simp]
                              theorem CategoryTheory.Monad.free_obj_A {C : Type u₁} [Category.{v₁, u₁} C] (T : Monad C) (X : C) :
                              (T.free.obj X).A = T.obj X
                              @[simp]
                              theorem CategoryTheory.Comonad.cofree_obj_A {C : Type u₁} [Category.{v₁, u₁} C] (T : Comonad C) (X : C) :
                              (T.cofree.obj X).A = T.obj X
                              @[instance_reducible]
                              Equations

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

                              Equations
                              • One or more equations did not get rendered due to their size.
                              Instances For
                                @[simp]
                                theorem CategoryTheory.Monad.adj_counit {C : Type u₁} [Category.{v₁, u₁} C] (T : Monad C) :
                                T.adj.counit = { app := fun (Y : T.Algebra) => { f := Y.a, h := ⋯ }, naturality := ⋯ }
                                @[simp]
                                theorem CategoryTheory.Monad.adj_unit {C : Type u₁} [Category.{v₁, u₁} C] (T : Monad C) :
                                T.adj.unit = { app := fun (X : C) => T.η.app X, naturality := ⋯ }

                                The adjunction between the cofree and forgetful constructions for Eilenberg-Moore coalgebras for a comonad.

                                Equations
                                • One or more equations did not get rendered due to their size.
                                Instances For
                                  @[simp]
                                  theorem CategoryTheory.Comonad.adj_counit {C : Type u₁} [Category.{v₁, u₁} C] (T : Comonad C) :
                                  T.adj.counit = { app := fun (Y : C) => T.ε.app Y, naturality := ⋯ }
                                  @[simp]
                                  theorem CategoryTheory.Comonad.adj_unit {C : Type u₁} [Category.{v₁, u₁} C] (T : Comonad C) :
                                  T.adj.unit = { app := fun (X : T.Coalgebra) => { f := X.a, h := ⋯ }, naturality := ⋯ }
                                  theorem CategoryTheory.Monad.algebra_iso_of_iso {C : Type u₁} [Category.{v₁, u₁} C] (T : Monad C) {A B : T.Algebra} (f : A ⟶ B) [IsIso f.f] :

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

                                  theorem CategoryTheory.Comonad.coalgebra_iso_of_iso {C : Type u₁} [Category.{v₁, u₁} C] (T : Comonad C) {A B : T.Coalgebra} (f : B ⟶ A) [IsIso f.f] :

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

                                  theorem CategoryTheory.Monad.algebra_epi_of_epi {C : Type u₁} [Category.{v₁, u₁} C] (T : Monad C) {X Y : T.Algebra} (f : X ⟶ Y) [h : Epi f.f] :
                                  Epi f

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

                                  theorem CategoryTheory.Comonad.coalgebra_mono_of_mono {C : Type u₁} [Category.{v₁, u₁} C] (T : Comonad C) {X Y : T.Coalgebra} (f : Y ⟶ X) [h : Mono f.f] :

                                  Given a coalgebra morphism whose carrier part is a monomorphism, we get an algebra monomorphism.

                                  theorem CategoryTheory.Monad.algebra_mono_of_mono {C : Type u₁} [Category.{v₁, u₁} C] (T : Monad C) {X Y : T.Algebra} (f : X ⟶ Y) [h : Mono f.f] :

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

                                  theorem CategoryTheory.Comonad.coalgebra_epi_of_epi {C : Type u₁} [Category.{v₁, u₁} C] (T : Comonad C) {X Y : T.Coalgebra} (f : Y ⟶ X) [h : Epi f.f] :
                                  Epi f

                                  Given a coalgebra morphism whose carrier part is an epimorphism, we get an algebra epimorphism.

                                  def CategoryTheory.Monad.algebraFunctorOfMonadHom {C : Type u₁} [Category.{v₁, u₁} C] {T₁ T₂ : Monad C} (h : T₂ ⟶ T₁) :

                                  Given a monad morphism from T₂ to T₁, we get a functor from the algebras of T₁ to algebras of T₂.

                                  Equations
                                  • One or more equations did not get rendered due to their size.
                                  Instances For
                                    @[simp]
                                    theorem CategoryTheory.Monad.algebraFunctorOfMonadHom_obj_A {C : Type u₁} [Category.{v₁, u₁} C] {T₁ T₂ : Monad C} (h : T₂ ⟶ T₁) (A : T₁.Algebra) :
                                    @[simp]
                                    theorem CategoryTheory.Monad.algebraFunctorOfMonadHom_map_f {C : Type u₁} [Category.{v₁, u₁} C] {T₁ T₂ : Monad C} (h : T₂ ⟶ T₁) {X✝ Y✝ : T₁.Algebra} (f : X✝ ⟶ Y✝) :
                                    @[simp]
                                    theorem CategoryTheory.Monad.algebraFunctorOfMonadHom_obj_a {C : Type u₁} [Category.{v₁, u₁} C] {T₁ T₂ : Monad C} (h : T₂ ⟶ T₁) (A : T₁.Algebra) :

                                    The identity monad morphism induces the identity functor from the category of algebras to itself.

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

                                      A composition of monad morphisms gives the composition of corresponding functors.

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

                                        If f and g are two equal morphisms of monads, then the functors of algebras induced by them are isomorphic. We define it like this as opposed to using eqToIso 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]
                                          @[simp]
                                          def CategoryTheory.Monad.algebraEquivOfIsoMonads {C : Type u₁} [Category.{v₁, u₁} C] {T₁ T₂ : Monad C} (h : T₁ ≅ T₂) :
                                          T₁.Algebra ≌ T₂.Algebra

                                          Isomorphic monads give equivalent categories of algebras. Furthermore, they are equivalent as categories over C, that is, we have algebraEquivOfIsoMonads h ⋙ forget = forget.

                                          Equations
                                          • One or more equations did not get rendered due to their size.
                                          Instances For
                                            @[deprecated CategoryTheory.Comonad.coalgebra_epi_of_epi (since := "2026-10-08")]
                                            theorem CategoryTheory.Comonad.algebra_epi_of_epi {C : Type u₁} [Category.{v₁, u₁} C] (T : Comonad C) {X Y : T.Coalgebra} (f : Y ⟶ X) [h : Epi f.f] :
                                            Epi f

                                            Alias of CategoryTheory.Comonad.coalgebra_epi_of_epi.


                                            Given a coalgebra morphism whose carrier part is an epimorphism, we get an algebra epimorphism.

                                            @[deprecated CategoryTheory.Comonad.coalgebra_mono_of_mono (since := "2026-10-08")]
                                            theorem CategoryTheory.Comonad.algebra_mono_of_mono {C : Type u₁} [Category.{v₁, u₁} C] (T : Comonad C) {X Y : T.Coalgebra} (f : Y ⟶ X) [h : Mono f.f] :

                                            Alias of CategoryTheory.Comonad.coalgebra_mono_of_mono.


                                            Given a coalgebra morphism whose carrier part is a monomorphism, we get an algebra monomorphism.