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
    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) :
    CategoryStruct.comp (T.app self.A) (CategoryStruct.comp self.a h) = CategoryStruct.comp (T.map self.a) (CategoryStruct.comp self.a h)
    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) :
    CategoryStruct.comp (T.app self.A) (CategoryStruct.comp self.a h) = h
    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.

    • f : A.A B.A

      The underlying morphism associated to a morphism of algebras.

    • h : CategoryStruct.comp (T.map self.f) B.a = CategoryStruct.comp A.a self.f

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

    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
      @[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) :
      def CategoryTheory.Monad.Algebra.Hom.id {C : Type u₁} [Category.{v₁, u₁} C] {T : Monad C} (A : T.Algebra) :
      A.Hom A

      The identity homomorphism for an Eilenberg–Moore algebra.

      Equations
      Instances For
        instance CategoryTheory.Monad.Algebra.Hom.instInhabited {C : Type u₁} [Category.{v₁, u₁} C] {T : Monad C} (A : T.Algebra) :
        Inhabited (A.Hom A)
        Equations
        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
          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
          @[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]
          @[simp]
          @[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'') :

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

          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 aesop_cat) :
          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 aesop_cat) :
            (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 aesop_cat) :
            (isoMk h w).hom.f = h.hom
            def CategoryTheory.Monad.forget {C : Type u₁} [Category.{v₁, u₁} C] (T : Monad C) :
            Functor T.Algebra C

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

            Equations
            • T.forget = { obj := fun (A : T.Algebra) => A.A, map := fun {X Y : T.Algebra} (f : X Y) => f.f, map_id := , map_comp := }
            Instances For
              @[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
              @[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
              def CategoryTheory.Monad.free {C : Type u₁} [Category.{v₁, u₁} C] (T : Monad C) :
              Functor C T.Algebra

              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
                @[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.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.obj X
                Equations
                • T.instInhabitedAlgebra = { default := T.free.obj default }
                def CategoryTheory.Monad.adj {C : Type u₁} [Category.{v₁, u₁} C] (T : Monad C) :
                T.free T.forget

                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 := }
                  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.

                  instance CategoryTheory.Monad.forget_reflects_iso {C : Type u₁} [Category.{v₁, u₁} C] (T : Monad C) :
                  T.forget.ReflectsIsomorphisms
                  instance CategoryTheory.Monad.forget_faithful {C : Type u₁} [Category.{v₁, u₁} C] (T : Monad C) :
                  T.forget.Faithful
                  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.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.

                  instance CategoryTheory.Monad.instIsRightAdjointAlgebraForget {C : Type u₁} [Category.{v₁, u₁} C] (T : Monad C) :
                  T.forget.IsRightAdjoint
                  def CategoryTheory.Monad.algebraFunctorOfMonadHom {C : Type u₁} [Category.{v₁, u₁} C] {T₁ T₂ : Monad C} (h : T₂ T₁) :
                  Functor T₁.Algebra T₂.Algebra

                  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) :
                    ((algebraFunctorOfMonadHom h).obj A).a = CategoryStruct.comp (h.app A.A) A.a
                    @[simp]
                    theorem CategoryTheory.Monad.algebraFunctorOfMonadHom_obj_A {C : Type u₁} [Category.{v₁, u₁} C] {T₁ T₂ : Monad C} (h : T₂ T₁) (A : T₁.Algebra) :
                    ((algebraFunctorOfMonadHom h).obj A).A = A.A
                    @[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✝) :
                    ((algebraFunctorOfMonadHom h).map f).f = f.f

                    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]
                        theorem CategoryTheory.Monad.algebraFunctorOfMonadHomComp_hom_app_f {C : Type u₁} [Category.{v₁, u₁} C] {T₁ T₂ T₃ : Monad C} (f : T₁ T₂) (g : T₂ T₃) (X : T₃.Algebra) :
                        @[simp]
                        theorem CategoryTheory.Monad.algebraFunctorOfMonadHomComp_inv_app_f {C : Type u₁} [Category.{v₁, u₁} C] {T₁ T₂ T₃ : Monad C} (f : T₁ T₂) (g : T₂ T₃) (X : T₃.Algebra) :

                        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]
                          theorem CategoryTheory.Monad.algebraFunctorOfMonadHomEq_inv_app_f {C : Type u₁} [Category.{v₁, u₁} C] {T₁ T₂ : Monad C} {f g : T₁ T₂} (h : f = g) (X : T₂.Algebra) :
                          ((algebraFunctorOfMonadHomEq h).inv.app X).f = (Iso.refl ((algebraFunctorOfMonadHom f).obj X).A).inv
                          @[simp]
                          theorem CategoryTheory.Monad.algebraFunctorOfMonadHomEq_hom_app_f {C : Type u₁} [Category.{v₁, u₁} C] {T₁ T₂ : Monad C} {f g : T₁ T₂} (h : f = g) (X : T₂.Algebra) :
                          ((algebraFunctorOfMonadHomEq h).hom.app X).f = (Iso.refl ((algebraFunctorOfMonadHom f).obj X).A).hom
                          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 hforget = forget.

                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For
                            @[simp]
                            theorem CategoryTheory.Monad.algebra_equiv_of_iso_monads_comp_forget {C : Type u₁} [Category.{v₁, u₁} C] {T₁ T₂ : Monad C} (h : T₁ T₂) :
                            (algebraFunctorOfMonadHom h).comp T₁.forget = T₂.forget
                            structure CategoryTheory.Comonad.Coalgebra {C : Type u₁} [Category.{v₁, u₁} C] (G : Comonad C) :
                            Type (max u₁ v₁)

                            An Eilenberg-Moore coalgebra for a comonad T.

                            • A : C

                              The underlying object associated to a coalgebra.

                            • a : self.A G.obj self.A

                              The structure morphism associated to a coalgebra.

                            • counit : CategoryStruct.comp self.a (G.app self.A) = CategoryStruct.id self.A

                              The counit axiom associated to a coalgebra.

                            • coassoc : CategoryStruct.comp self.a (G.app self.A) = CategoryStruct.comp self.a (G.map self.a)

                              The coassociativity axiom associated to a coalgebra.

                            Instances For
                              theorem CategoryTheory.Comonad.Coalgebra.coassoc_assoc {C : Type u₁} [Category.{v₁, u₁} C] {G : Comonad C} (self : G.Coalgebra) {Z : C} (h : G.obj (G.obj self.A) Z) :
                              CategoryStruct.comp self.a (CategoryStruct.comp (G.app self.A) h) = CategoryStruct.comp self.a (CategoryStruct.comp (G.map self.a) h)
                              theorem CategoryTheory.Comonad.Coalgebra.counit_assoc {C : Type u₁} [Category.{v₁, u₁} C] {G : Comonad C} (self : G.Coalgebra) {Z : C} (h : self.A Z) :
                              CategoryStruct.comp self.a (CategoryStruct.comp (G.app self.A) h) = h
                              structure CategoryTheory.Comonad.Coalgebra.Hom {C : Type u₁} [Category.{v₁, u₁} C] {G : Comonad C} (A B : G.Coalgebra) :
                              Type v₁

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

                              • f : A.A B.A

                                The underlying morphism associated to a morphism of coalgebras.

                              • h : CategoryStruct.comp A.a (G.map self.f) = CategoryStruct.comp self.f B.a

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

                              Instances For
                                theorem CategoryTheory.Comonad.Coalgebra.Hom.ext {C : Type u₁} {inst✝ : Category.{v₁, u₁} C} {G : Comonad C} {A B : G.Coalgebra} {x y : A.Hom B} (f : x.f = y.f) :
                                x = y
                                @[simp]
                                theorem CategoryTheory.Comonad.Coalgebra.Hom.h_assoc {C : Type u₁} [Category.{v₁, u₁} C] {G : Comonad C} {A B : G.Coalgebra} (self : A.Hom B) {Z : C} (h : G.obj B.A Z) :
                                def CategoryTheory.Comonad.Coalgebra.Hom.id {C : Type u₁} [Category.{v₁, u₁} C] {G : Comonad C} (A : G.Coalgebra) :
                                A.Hom A

                                The identity homomorphism for an Eilenberg–Moore coalgebra.

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

                                  Composition of Eilenberg–Moore coalgebra homomorphisms.

                                  Equations
                                  Instances For
                                    theorem CategoryTheory.Comonad.Coalgebra.Hom.ext' {C : Type u₁} [Category.{v₁, u₁} C] {G : Comonad C} (X Y : G.Coalgebra) (f g : X Y) (h : f.f = g.f) :
                                    f = g
                                    @[simp]
                                    theorem CategoryTheory.Comonad.Coalgebra.comp_eq_comp {C : Type u₁} [Category.{v₁, u₁} C] {G : Comonad C} {A A' A'' : G.Coalgebra} (f : A A') (g : A' A'') :
                                    @[simp]
                                    @[simp]
                                    theorem CategoryTheory.Comonad.Coalgebra.comp_f {C : Type u₁} [Category.{v₁, u₁} C] {G : Comonad C} {A A' A'' : G.Coalgebra} (f : A A') (g : A' A'') :

                                    The category of Eilenberg-Moore coalgebras for a comonad.

                                    Equations
                                    def CategoryTheory.Comonad.Coalgebra.isoMk {C : Type u₁} [Category.{v₁, u₁} C] {G : Comonad C} {A B : G.Coalgebra} (h : A.A B.A) (w : CategoryStruct.comp A.a (G.map h.hom) = CategoryStruct.comp h.hom B.a := by aesop_cat) :
                                    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_hom_f {C : Type u₁} [Category.{v₁, u₁} C] {G : Comonad C} {A B : G.Coalgebra} (h : A.A B.A) (w : CategoryStruct.comp A.a (G.map h.hom) = CategoryStruct.comp h.hom B.a := by aesop_cat) :
                                      (isoMk h w).hom.f = h.hom
                                      @[simp]
                                      theorem CategoryTheory.Comonad.Coalgebra.isoMk_inv_f {C : Type u₁} [Category.{v₁, u₁} C] {G : Comonad C} {A B : G.Coalgebra} (h : A.A B.A) (w : CategoryStruct.comp A.a (G.map h.hom) = CategoryStruct.comp h.hom B.a := by aesop_cat) :
                                      (isoMk h w).inv.f = h.inv
                                      def CategoryTheory.Comonad.forget {C : Type u₁} [Category.{v₁, u₁} C] (G : Comonad C) :
                                      Functor G.Coalgebra C

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

                                      Equations
                                      • G.forget = { obj := fun (A : G.Coalgebra) => A.A, map := fun {X Y : G.Coalgebra} (f : X Y) => f.f, map_id := , map_comp := }
                                      Instances For
                                        @[simp]
                                        theorem CategoryTheory.Comonad.forget_map {C : Type u₁} [Category.{v₁, u₁} C] (G : Comonad C) {X✝ Y✝ : G.Coalgebra} (f : X✝ Y✝) :
                                        G.forget.map f = f.f
                                        @[simp]
                                        theorem CategoryTheory.Comonad.forget_obj {C : Type u₁} [Category.{v₁, u₁} C] (G : Comonad C) (A : G.Coalgebra) :
                                        G.forget.obj A = A.A
                                        def CategoryTheory.Comonad.cofree {C : Type u₁} [Category.{v₁, u₁} C] (G : Comonad C) :
                                        Functor C G.Coalgebra

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

                                        Equations
                                        • G.cofree = { obj := fun (X : C) => { A := G.obj X, a := G.app X, counit := , coassoc := }, map := fun {X Y : C} (f : X Y) => { f := G.map f, h := }, map_id := , map_comp := }
                                        Instances For
                                          @[simp]
                                          theorem CategoryTheory.Comonad.cofree_map_f {C : Type u₁} [Category.{v₁, u₁} C] (G : Comonad C) {X✝ Y✝ : C} (f : X✝ Y✝) :
                                          (G.cofree.map f).f = G.map f
                                          @[simp]
                                          theorem CategoryTheory.Comonad.cofree_obj_A {C : Type u₁} [Category.{v₁, u₁} C] (G : Comonad C) (X : C) :
                                          (G.cofree.obj X).A = G.obj X
                                          @[simp]
                                          theorem CategoryTheory.Comonad.cofree_obj_a {C : Type u₁} [Category.{v₁, u₁} C] (G : Comonad C) (X : C) :
                                          (G.cofree.obj X).a = G.app X
                                          def CategoryTheory.Comonad.adj {C : Type u₁} [Category.{v₁, u₁} C] (G : Comonad C) :
                                          G.forget G.cofree

                                          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] (G : Comonad C) :
                                            G.adj.counit = { app := fun (Y : C) => G.app Y, naturality := }
                                            @[simp]
                                            theorem CategoryTheory.Comonad.adj_unit {C : Type u₁} [Category.{v₁, u₁} C] (G : Comonad C) :
                                            G.adj.unit = { app := fun (X : G.Coalgebra) => { f := X.a, h := }, naturality := }
                                            theorem CategoryTheory.Comonad.coalgebra_iso_of_iso {C : Type u₁} [Category.{v₁, u₁} C] (G : Comonad C) {A B : G.Coalgebra} (f : A B) [IsIso f.f] :

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

                                            instance CategoryTheory.Comonad.forget_reflects_iso {C : Type u₁} [Category.{v₁, u₁} C] (G : Comonad C) :
                                            G.forget.ReflectsIsomorphisms
                                            instance CategoryTheory.Comonad.forget_faithful {C : Type u₁} [Category.{v₁, u₁} C] (G : Comonad C) :
                                            G.forget.Faithful
                                            theorem CategoryTheory.Comonad.algebra_epi_of_epi {C : Type u₁} [Category.{v₁, u₁} C] (G : Comonad C) {X Y : G.Coalgebra} (f : X Y) [h : Epi f.f] :
                                            Epi f

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

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

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