Documentation

Mathlib.CategoryTheory.Elements

The category of elements #

This file defines the category of elements, also known as (a special case of) the Grothendieck construction.

Given a functor F : C ⥤ Type*, an object of F.Elements is a pair (X : C, x : F.obj X). A morphism (X, x) ⟶ (Y, y) is a morphism f : X ⟶ Y in C such that F.map f takes x to y.

Implementation notes #

This construction is equivalent to a special case of a comma construction, so this is mostly just a more convenient API. We prove the equivalence in CategoryTheory.Functor.Elements.structuredArrowEquivalence.

References #

Tags #

category of elements, Grothendieck construction, comma category

structure CategoryTheory.Functor.Elements {C : Type u} [Category.{v, u} C] (F : Functor C (Type w)) :
Type (max u w)

The type of objects for the category of elements of a functor F : C ⥤ Type is a pair (X : C, x : F.obj X).

  • obj : C

    the underlying object of an element of a functor to types

  • val : F.obj self.obj

    the value of the element

Instances For
    @[deprecated CategoryTheory.Functor.Elements.obj (since := "2026-08-30")]

    Alias of CategoryTheory.Functor.Elements.obj.


    the underlying object of an element of a functor to types

    Equations
    Instances For
      @[deprecated CategoryTheory.Functor.Elements.val (since := "2026-08-30")]

      Alias of CategoryTheory.Functor.Elements.val.


      the value of the element

      Equations
      Instances For
        @[reducible, inline]
        abbrev CategoryTheory.Functor.elementsMk {C : Type u} [Category.{v, u} C] (F : Functor C (Type w)) (X : C) (x : F.obj X) :

        Constructor for the type F.Elements when F is a functor to types.

        Equations
        Instances For
          theorem CategoryTheory.Functor.Elements.ext {C : Type u} [Category.{v, u} C] {F : Functor C (Type w)} (x y : F.Elements) (h₁ : x.obj = y.obj) (h₂ : (ConcreteCategory.hom (F.map (eqToHom h₁))) x.val = y.val) :
          x = y
          structure CategoryTheory.Functor.Elements.Hom {C : Type u} [Category.{v, u} C] {F : Functor C (Type w)} (x y : F.Elements) :

          A morphism x ⟶ y in the category F.Elements of elements of a functor F : C ⥤ Type w consists of a morphism hom : x.obj ⟶ y.obj such that F.map hom sends x.val to y.val.

          Instances For
            theorem CategoryTheory.Functor.Elements.Hom.ext {C : Type u} {inst✝ : Category.{v, u} C} {F : Functor C (Type w)} {x y : F.Elements} {x✝ y✝ : x.Hom y} (hom : x✝.hom = y✝.hom) :
            x✝ = y✝
            theorem CategoryTheory.Functor.Elements.Hom.ext_iff {C : Type u} {inst✝ : Category.{v, u} C} {F : Functor C (Type w)} {x y : F.Elements} {x✝ y✝ : x.Hom y} :
            x✝ = y✝ x✝.hom = y✝.hom
            @[instance_reducible]

            The category structure on F.Elements, for F : C ⥤ Type. A morphism (X, x) ⟶ (Y, y) is a morphism f : X ⟶ Y in C, so F.map f takes x to y.

            Equations
            • One or more equations did not get rendered due to their size.
            @[simp]
            theorem CategoryTheory.Functor.Elements.comp_hom {C : Type u} [Category.{v, u} C] {F : Functor C (Type w)} {X✝ Y✝ Z✝ : F.Elements} (f : X✝.Hom Y✝) (g : Y✝.Hom Z✝) :
            @[implicit_reducible]

            The functor out of the category of elements which forgets the element.

            Equations
            Instances For
              @[simp]
              @[simp]
              theorem CategoryTheory.Functor.Elements.π_map {C : Type u} [Category.{v, u} C] (F : Functor C (Type w)) {X✝ Y✝ : F.Elements} (f : X✝ Y✝) :
              (π F).map f = f.hom
              @[implicit_reducible]

              Natural transformations are mapped to functors between categories of elements.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For
                @[simp]
                theorem CategoryTheory.NatTrans.mapElements_obj_obj {C : Type u} [Category.{v, u} C] {F G : Functor C (Type w)} (φ : F G) (e : F.Elements) :
                ((mapElements φ).obj e).obj = e.obj
                @[simp]
                theorem CategoryTheory.NatTrans.mapElements_map_hom {C : Type u} [Category.{v, u} C] {F G : Functor C (Type w)} (φ : F G) {e₁ e₂ : F.Elements} (f : e₁ e₂) :
                ((mapElements φ).map f).hom = f.hom
                @[simp]

                If φ : F ⟶ G is a natural transformation between functors to types, this is the canonical isomorphism φ.mapElementsFunctor.Elements.π G ≅ Functor.Elements.π F.

                Equations
                Instances For

                  The functor mapping functors C ⥤ Type w to their category of elements

                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For
                    @[reducible, inline]
                    abbrev CategoryTheory.Functor.Elements.homMk {C : Type u} [Category.{v, u} C] {F : Functor C (Type w)} {x y : F.Elements} (f : x.obj y.obj) (hf : (ConcreteCategory.hom (F.map f)) x.val = y.val := by cat_disch) :
                    x y

                    Constructor for morphisms in the category of elements of a functor to types.

                    Equations
                    Instances For
                      theorem CategoryTheory.Functor.Elements.hom_ext {C : Type u} [Category.{v, u} C] {F : Functor C (Type w)} {x y : F.Elements} {f g : x y} (w : f.hom = g.hom) :
                      f = g
                      theorem CategoryTheory.Functor.Elements.hom_ext_iff {C : Type u} [Category.{v, u} C] {F : Functor C (Type w)} {x y : F.Elements} {f g : x y} :
                      f = g f.hom = g.hom
                      def CategoryTheory.Functor.Elements.isoMk {C : Type u} [Category.{v, u} C] {F : Functor C (Type w)} {x y : F.Elements} (e : x.obj y.obj) (he : (ConcreteCategory.hom (F.map e.hom)) x.val = y.val := by cat_disch) :
                      x y

                      Constructor for isomorphisms in the category of elements of a functor to types.

                      Equations
                      Instances For
                        @[simp]
                        theorem CategoryTheory.Functor.Elements.isoMk_inv {C : Type u} [Category.{v, u} C] {F : Functor C (Type w)} {x y : F.Elements} (e : x.obj y.obj) (he : (ConcreteCategory.hom (F.map e.hom)) x.val = y.val := by cat_disch) :
                        (isoMk e he).inv = homMk e.inv
                        @[simp]
                        theorem CategoryTheory.Functor.Elements.isoMk_hom {C : Type u} [Category.{v, u} C] {F : Functor C (Type w)} {x y : F.Elements} (e : x.obj y.obj) (he : (ConcreteCategory.hom (F.map e.hom)) x.val = y.val := by cat_disch) :
                        (isoMk e he).hom = homMk e.hom he
                        @[instance_reducible]
                        Equations
                        • One or more equations did not get rendered due to their size.
                        @[implicit_reducible]

                        The forward direction of the equivalence F.Elements ≅ (*, F).

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

                          The reverse direction of the equivalence F.Elements ≅ (*, F).

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

                            The equivalence between the category of elements F.Elements and the comma category (*, F).

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

                              The forward direction of the equivalence F.Elementsᵒᵖ ≅ (yoneda, F), given by CategoryTheory.yonedaEquiv.

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

                                The reverse direction of the equivalence F.Elementsᵒᵖ ≅ (yoneda, F), given by CategoryTheory.yonedaEquiv.

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

                                  The equivalence F.Elementsᵒᵖ ≅ (yoneda, F) given by Yoneda's lemma.

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

                                    The equivalence F.elementsᵒᵖ ≌ (yoneda, F) is compatible with the forgetful functors.

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

                                      The equivalence F.elementsᵒᵖ ≌ (yoneda, F) is compatible with the forgetful functors.

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

                                        The opposite of the category of elements of a presheaf of types is equivalent to a category of costructured arrows for the Yoneda embedding functor.

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

                                          The functor of the equivalence costructuredArrowULiftYonedaEquivalence F followed by the projection CostructuredArrow uliftYoneda.{w} F ⥤ C identifies to (π F).leftOp.

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

                                            Given F : Cᵒᵖ ⥤ Type w where C is a locally w-small category, this is the equivalence between the opposite of the category of elements of F and CostructuredArrow shrinkYoneda.{w} F.

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

                                              The functor of the equivalence costructuredArrowShrinkYonedaEquivalence F followed by the projection CostructuredArrow shrinkYoneda.{w} F ⥤ C identifies to (π F).leftOp.

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

                                                The initial object in F.Elements if F is representable.

                                                Equations
                                                Instances For

                                                  If F is represented by X, X with its universal element is the initial object of F.Elements.

                                                  Equations
                                                  Instances For
                                                    @[reducible, inline]

                                                    The initial object in F.Elements if F is corepresentable.

                                                    Equations
                                                    Instances For

                                                      If F is corepresented by X, X with its universal element is the initial object of F.Elements.

                                                      Equations
                                                      Instances For
                                                        @[reducible, inline]

                                                        The initial object in the category of elements for a representable functor. In isInitial it is shown that this is initial.

                                                        Equations
                                                        Instances For
                                                          @[deprecated CategoryTheory.Functor.Elements.initialYonedaObj (since := "2026-08-30")]

                                                          Alias of CategoryTheory.Functor.Elements.initialYonedaObj.


                                                          The initial object in the category of elements for a representable functor. In isInitial it is shown that this is initial.

                                                          Equations
                                                          Instances For
                                                            @[deprecated CategoryTheory.Functor.Elements.isInitialYonedaObj (since := "2026-08-30")]

                                                            Alias of CategoryTheory.Functor.Elements.isInitialYonedaObj.


                                                            Show that Elements.initial A is initial in the category of elements for the yoneda functor.

                                                            Equations
                                                            Instances For
                                                              @[implicit_reducible]

                                                              The functor (F ⋙ G).Elements ⥤ G.Elements.

                                                              Equations
                                                              • One or more equations did not get rendered due to their size.
                                                              Instances For
                                                                @[simp]
                                                                theorem CategoryTheory.Functor.Elements.precomp_obj_val {C : Type u} [Category.{v, u} C] {D : Type u_1} [Category.{u_2, u_1} D] (F : Functor C D) (G : Functor D (Type w)) (x : (F.comp G).Elements) :
                                                                ((precomp F G).obj x).val = x.val
                                                                @[simp]
                                                                theorem CategoryTheory.Functor.Elements.precomp_map_hom {C : Type u} [Category.{v, u} C] {D : Type u_1} [Category.{u_2, u_1} D] (F : Functor C D) (G : Functor D (Type w)) {X✝ Y✝ : (F.comp G).Elements} (f : X✝ Y✝) :
                                                                ((precomp F G).map f).hom = F.map f.hom
                                                                @[simp]
                                                                theorem CategoryTheory.Functor.Elements.precomp_obj_obj {C : Type u} [Category.{v, u} C] {D : Type u_1} [Category.{u_2, u_1} D] (F : Functor C D) (G : Functor D (Type w)) (x : (F.comp G).Elements) :
                                                                ((precomp F G).obj x).obj = F.obj x.obj

                                                                The functor Functor.Elements.toCostructuredArrow is compatible with NatTrans.mapElements.

                                                                Equations
                                                                • One or more equations did not get rendered due to their size.
                                                                Instances For
                                                                  @[deprecated CategoryTheory.Functor.Elements.homMk (since := "2026-08-30")]
                                                                  def CategoryTheory.CategoryOfElements.homMk {C : Type u} [Category.{v, u} C] {F : Functor C (Type w)} {x y : F.Elements} (f : x.obj y.obj) (hf : (ConcreteCategory.hom (F.map f)) x.val = y.val := by cat_disch) :
                                                                  x y

                                                                  Alias of CategoryTheory.Functor.Elements.homMk.


                                                                  Constructor for morphisms in the category of elements of a functor to types.

                                                                  Equations
                                                                  Instances For
                                                                    @[deprecated CategoryTheory.Functor.Elements.isoMk (since := "2026-08-30")]
                                                                    def CategoryTheory.CategoryOfElements.isoMk {C : Type u} [Category.{v, u} C] {F : Functor C (Type w)} {x y : F.Elements} (e : x.obj y.obj) (he : (ConcreteCategory.hom (F.map e.hom)) x.val = y.val := by cat_disch) :
                                                                    x y

                                                                    Alias of CategoryTheory.Functor.Elements.isoMk.


                                                                    Constructor for isomorphisms in the category of elements of a functor to types.

                                                                    Equations
                                                                    Instances For
                                                                      @[deprecated CategoryTheory.Functor.Elements.hom_ext (since := "2026-08-30")]
                                                                      theorem CategoryTheory.CategoryOfElements.ext {C : Type u} [Category.{v, u} C] {F : Functor C (Type w)} {x y : F.Elements} {f g : x y} (w : f.hom = g.hom) :
                                                                      f = g

                                                                      Alias of CategoryTheory.Functor.Elements.hom_ext.

                                                                      @[deprecated CategoryTheory.Functor.Elements.id_hom (since := "2026-08-30")]

                                                                      Alias of CategoryTheory.Functor.Elements.id_hom.

                                                                      @[deprecated CategoryTheory.Functor.Elements.comp_hom (since := "2026-08-30")]
                                                                      theorem CategoryTheory.CategoryOfElements.comp_val {C : Type u} [Category.{v, u} C] {F : Functor C (Type w)} {X✝ Y✝ Z✝ : F.Elements} (f : X✝.Hom Y✝) (g : Y✝.Hom Z✝) :

                                                                      Alias of CategoryTheory.Functor.Elements.comp_hom.

                                                                      @[deprecated CategoryTheory.Functor.Elements.Hom.map_val (since := "2026-08-30")]
                                                                      theorem CategoryTheory.CategoryOfElements.map_snd {C : Type u} [Category.{v, u} C] {F : Functor C (Type w)} {x y : F.Elements} (self : x.Hom y) :

                                                                      Alias of CategoryTheory.Functor.Elements.Hom.map_val.

                                                                      @[deprecated CategoryTheory.Functor.Elements.π (since := "2026-08-30")]

                                                                      Alias of CategoryTheory.Functor.Elements.π.


                                                                      The functor out of the category of elements which forgets the element.

                                                                      Equations
                                                                      Instances For
                                                                        @[deprecated CategoryTheory.NatTrans.mapElements (since := "2026-08-30")]

                                                                        Alias of CategoryTheory.NatTrans.mapElements.


                                                                        Natural transformations are mapped to functors between categories of elements.

                                                                        Equations
                                                                        Instances For
                                                                          @[deprecated CategoryTheory.NatTrans.mapElements_comp_π (since := "2026-08-30")]

                                                                          Alias of CategoryTheory.NatTrans.mapElements_comp_π.

                                                                          @[deprecated CategoryTheory.Functor.Elements.toStructuredArrow (since := "2026-08-30")]

                                                                          Alias of CategoryTheory.Functor.Elements.toStructuredArrow.


                                                                          The forward direction of the equivalence F.Elements ≅ (*, F).

                                                                          Equations
                                                                          Instances For
                                                                            @[deprecated CategoryTheory.Functor.Elements.fromStructuredArrow (since := "2026-08-30")]

                                                                            Alias of CategoryTheory.Functor.Elements.fromStructuredArrow.


                                                                            The reverse direction of the equivalence F.Elements ≅ (*, F).

                                                                            Equations
                                                                            Instances For
                                                                              @[deprecated CategoryTheory.Functor.Elements.toStructuredArrow_obj (since := "2026-08-30")]

                                                                              Alias of CategoryTheory.Functor.Elements.toStructuredArrow_obj.

                                                                              @[deprecated CategoryTheory.Functor.Elements.toStructuredArrow_map (since := "2026-08-30")]

                                                                              Alias of CategoryTheory.Functor.Elements.toStructuredArrow_map.

                                                                              @[deprecated CategoryTheory.Functor.Elements.structuredArrowEquivalence (since := "2026-08-30")]

                                                                              Alias of CategoryTheory.Functor.Elements.structuredArrowEquivalence.


                                                                              The equivalence between the category of elements F.Elements and the comma category (*, F).

                                                                              Equations
                                                                              Instances For
                                                                                @[deprecated CategoryTheory.Functor.Elements.toCostructuredArrow (since := "2026-08-30")]

                                                                                Alias of CategoryTheory.Functor.Elements.toCostructuredArrow.


                                                                                The forward direction of the equivalence F.Elementsᵒᵖ ≅ (yoneda, F), given by CategoryTheory.yonedaEquiv.

                                                                                Equations
                                                                                Instances For
                                                                                  @[deprecated CategoryTheory.Functor.Elements.fromCostructuredArrow (since := "2026-08-30")]

                                                                                  Alias of CategoryTheory.Functor.Elements.fromCostructuredArrow.


                                                                                  The reverse direction of the equivalence F.Elementsᵒᵖ ≅ (yoneda, F), given by CategoryTheory.yonedaEquiv.

                                                                                  Equations
                                                                                  Instances For
                                                                                    @[deprecated CategoryTheory.Functor.Elements.fromCostructuredArrow_obj_mk (since := "2026-08-30")]

                                                                                    Alias of CategoryTheory.Functor.Elements.fromCostructuredArrow_obj_mk.

                                                                                    @[deprecated CategoryTheory.Functor.Elements.costructuredArrowYonedaEquivalence (since := "2026-08-30")]

                                                                                    Alias of CategoryTheory.Functor.Elements.costructuredArrowYonedaEquivalence.


                                                                                    The equivalence F.Elementsᵒᵖ ≅ (yoneda, F) given by Yoneda's lemma.

                                                                                    Equations
                                                                                    Instances For
                                                                                      @[deprecated CategoryTheory.Functor.Elements.costructuredArrowULiftYonedaEquivalence (since := "2026-08-30")]

                                                                                      Alias of CategoryTheory.Functor.Elements.costructuredArrowULiftYonedaEquivalence.


                                                                                      The opposite of the category of elements of a presheaf of types is equivalent to a category of costructured arrows for the Yoneda embedding functor.

                                                                                      Equations
                                                                                      Instances For
                                                                                        @[deprecated "No replacement (this is proven `by dsimp`)" (since := "2026-08-30")]