Documentation

Mathlib.CategoryTheory.Preadditive.Mat

Matrices over a category. #

When C is a preadditive category, Mat_ C is the preadditive category whose objects are finite tuples of objects in C, and whose morphisms are matrices of morphisms from C.

There is a functor Mat_.embedding : C ⥤ Mat_ C sending morphisms to one-by-one matrices.

Mat_ C has finite biproducts.

The additive envelope #

We show that this construction is the "additive envelope" of C, in the sense that any additive functor F : C ⥤ D to a category D with biproducts lifts to a functor Mat_.lift F : Mat_ C ⥤ D, Moreover, this functor is unique (up to natural isomorphisms) amongst functors L : Mat_ C ⥤ D such that embedding C ⋙ L ≅ F. (As we don't have 2-category theory, we can't explicitly state that Mat_ C is the initial object in the 2-category of categories under C which have biproducts.)

As a consequence, when C already has finite biproducts we have Mat_ C ≌ C.

Future work #

We should provide a more convenient Mat R, when R is a ring, as a category with objects n : FinType, and whose morphisms are matrices with components in R.

Ideally this would conveniently interact with both Mat_ and Matrix.

structure CategoryTheory.Mat_ (C : Type u₁) :
Type (max 1 u₁)

An object in Mat_ C is a finite tuple of objects in C.

Instances For
    def CategoryTheory.Mat_.Hom {C : Type u₁} [Category.{v₁, u₁} C] (M N : Mat_ C) :
    Type v₁

    A morphism in Mat_ C is a dependently typed matrix of morphisms.

    Equations
    • M.Hom N = DMatrix M N fun (i : M) (j : N) => M.X i N.X j
    Instances For
      def CategoryTheory.Mat_.Hom.id {C : Type u₁} [Category.{v₁, u₁} C] [Preadditive C] (M : Mat_ C) :
      M.Hom M

      The identity matrix consists of identity morphisms on the diagonal, and zeros elsewhere.

      Equations
      Instances For
        def CategoryTheory.Mat_.Hom.comp {C : Type u₁} [Category.{v₁, u₁} C] [Preadditive C] {M N K : Mat_ C} (f : M.Hom N) (g : N.Hom K) :
        M.Hom K

        Composition of matrices using matrix multiplication.

        Equations
        Instances For
          theorem CategoryTheory.Mat_.hom_ext {C : Type u₁} [Category.{v₁, u₁} C] [Preadditive C] {M N : Mat_ C} (f g : M N) (H : ∀ (i : M) (j : N), f i j = g i j) :
          f = g
          theorem CategoryTheory.Mat_.id_def {C : Type u₁} [Category.{v₁, u₁} C] [Preadditive C] (M : Mat_ C) :
          CategoryStruct.id M = fun (i j : M) => if h : i = j then eqToHom else 0
          theorem CategoryTheory.Mat_.id_apply {C : Type u₁} [Category.{v₁, u₁} C] [Preadditive C] (M : Mat_ C) (i j : M) :
          CategoryStruct.id M i j = if h : i = j then eqToHom else 0
          @[simp]
          @[simp]
          theorem CategoryTheory.Mat_.id_apply_of_ne {C : Type u₁} [Category.{v₁, u₁} C] [Preadditive C] (M : Mat_ C) (i j : M) (h : i j) :
          theorem CategoryTheory.Mat_.comp_def {C : Type u₁} [Category.{v₁, u₁} C] [Preadditive C] {M N K : Mat_ C} (f : M N) (g : N K) :
          CategoryStruct.comp f g = fun (i : M) (k : K) => j : N, CategoryStruct.comp (f i j) (g j k)
          @[simp]
          theorem CategoryTheory.Mat_.comp_apply {C : Type u₁} [Category.{v₁, u₁} C] [Preadditive C] {M N K : Mat_ C} (f : M N) (g : N K) (i : M) (k : K) :
          CategoryStruct.comp f g i k = j : N, CategoryStruct.comp (f i j) (g j k)
          Equations
          • M.instInhabitedHom N = { default := fun (i : M) (j : N) => 0 }
          Equations
          @[simp]
          theorem CategoryTheory.Mat_.add_apply {C : Type u₁} [Category.{v₁, u₁} C] [Preadditive C] {M N : Mat_ C} (f g : M N) (i : M) (j : N) :
          (f + g) i j = f i j + g i j
          Equations

          We now prove that Mat_ C has finite biproducts.

          Be warned, however, that Mat_ C is not necessarily Krull-Schmidt, and so the internal indexing of a biproduct may have nothing to do with the external indexing, even though the construction we give uses a sigma type. See however isoBiproductEmbedding.

          def CategoryTheory.Functor.mapMat_ {C : Type u₁} [Category.{v₁, u₁} C] [Preadditive C] {D : Type u_1} [Category.{v₁, u_1} D] [Preadditive D] (F : Functor C D) [F.Additive] :
          Functor (Mat_ C) (Mat_ D)

          A functor induces a functor of matrix categories.

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For
            @[simp]
            theorem CategoryTheory.Functor.mapMat__obj_X {C : Type u₁} [Category.{v₁, u₁} C] [Preadditive C] {D : Type u_1} [Category.{v₁, u_1} D] [Preadditive D] (F : Functor C D) [F.Additive] (M : Mat_ C) (i : M) :
            (F.mapMat_.obj M).X i = F.obj (M.X i)
            @[simp]
            theorem CategoryTheory.Functor.mapMat__map {C : Type u₁} [Category.{v₁, u₁} C] [Preadditive C] {D : Type u_1} [Category.{v₁, u_1} D] [Preadditive D] (F : Functor C D) [F.Additive] {X✝ Y✝ : Mat_ C} (f : X✝ Y✝) (i : ((fun (M : Mat_ C) => Mat_.mk M fun (i : M) => F.obj (M.X i)) X✝)) (j : ((fun (M : Mat_ C) => Mat_.mk M fun (i : M) => F.obj (M.X i)) Y✝)) :
            F.mapMat_.map f i j = F.map (f i j)
            @[simp]
            theorem CategoryTheory.Functor.mapMat__obj_fintype {C : Type u₁} [Category.{v₁, u₁} C] [Preadditive C] {D : Type u_1} [Category.{v₁, u_1} D] [Preadditive D] (F : Functor C D) [F.Additive] (M : Mat_ C) :
            (F.mapMat_.obj M).fintype = M.fintype
            @[simp]
            theorem CategoryTheory.Functor.mapMat__obj_ι {C : Type u₁} [Category.{v₁, u₁} C] [Preadditive C] {D : Type u_1} [Category.{v₁, u_1} D] [Preadditive D] (F : Functor C D) [F.Additive] (M : Mat_ C) :
            (F.mapMat_.obj M) = M

            The identity functor induces the identity functor on matrix categories.

            Equations
            Instances For
              @[simp]
              @[simp]
              def CategoryTheory.Functor.mapMatComp {C : Type u₁} [Category.{v₁, u₁} C] [Preadditive C] {D : Type u_1} [Category.{v₁, u_1} D] [Preadditive D] {E : Type u_2} [Category.{v₁, u_2} E] [Preadditive E] (F : Functor C D) [F.Additive] (G : Functor D E) [G.Additive] :
              (F.comp G).mapMat_ F.mapMat_.comp G.mapMat_

              Composite functors induce composite functors on matrix categories.

              Equations
              Instances For
                @[simp]
                theorem CategoryTheory.Functor.mapMatComp_hom_app {C : Type u₁} [Category.{v₁, u₁} C] [Preadditive C] {D : Type u_1} [Category.{v₁, u_1} D] [Preadditive D] {E : Type u_2} [Category.{v₁, u_2} E] [Preadditive E] (F : Functor C D) [F.Additive] (G : Functor D E) [G.Additive] (X : Mat_ C) :
                (F.mapMatComp G).hom.app X = CategoryStruct.id ((F.comp G).mapMat_.obj X)
                @[simp]
                theorem CategoryTheory.Functor.mapMatComp_inv_app {C : Type u₁} [Category.{v₁, u₁} C] [Preadditive C] {D : Type u_1} [Category.{v₁, u_1} D] [Preadditive D] {E : Type u_2} [Category.{v₁, u_2} E] [Preadditive E] (F : Functor C D) [F.Additive] (G : Functor D E) [G.Additive] (X : Mat_ C) :
                (F.mapMatComp G).inv.app X = CategoryStruct.id ((F.comp G).mapMat_.obj X)

                The embedding of C into Mat_ C as one-by-one matrices. (We index the summands by PUnit.)

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  @[simp]
                  @[simp]
                  theorem CategoryTheory.Mat_.embedding_map (C : Type u₁) [Category.{v₁, u₁} C] [Preadditive C] {X✝ Y✝ : C} (f : X✝ Y✝) (x✝ : ((fun (X : C) => mk PUnit.{1} fun (x : PUnit.{1}) => X) X✝)) (x✝¹ : ((fun (X : C) => mk PUnit.{1} fun (x : PUnit.{1}) => X) Y✝)) :
                  (embedding C).map f x✝ x✝¹ = f
                  @[simp]
                  theorem CategoryTheory.Mat_.embedding_obj_X (C : Type u₁) [Category.{v₁, u₁} C] [Preadditive C] (X : C) (x✝ : PUnit.{1}) :
                  ((embedding C).obj X).X x✝ = X
                  def CategoryTheory.Mat_.isoBiproductEmbedding {C : Type u₁} [Category.{v₁, u₁} C] [Preadditive C] (M : Mat_ C) :
                  M fun (i : M) => (embedding C).obj (M.X i)

                  Every object in Mat_ C is isomorphic to the biproduct of its summands.

                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For
                    @[simp]
                    theorem CategoryTheory.Mat_.isoBiproductEmbedding_inv {C : Type u₁} [Category.{v₁, u₁} C] [Preadditive C] (M : Mat_ C) :
                    M.isoBiproductEmbedding.inv = Limits.biproduct.desc fun (i : M) (x : ((embedding C).obj (M.X i))) (k : M) => if h : i = k then eqToHom else 0
                    @[simp]
                    theorem CategoryTheory.Mat_.isoBiproductEmbedding_hom {C : Type u₁} [Category.{v₁, u₁} C] [Preadditive C] (M : Mat_ C) :
                    M.isoBiproductEmbedding.hom = Limits.biproduct.lift fun (i j : M) (x : ((embedding C).obj (M.X i))) => if h : j = i then eqToHom else 0
                    instance CategoryTheory.Mat_.instHasBiproductιObjEmbeddingXOfAdditive {C : Type u₁} [Category.{v₁, u₁} C] [Preadditive C] {D : Type u₁} [Category.{v₁, u₁} D] [Preadditive D] (F : Functor (Mat_ C) D) [F.Additive] (M : Mat_ C) :
                    Limits.HasBiproduct fun (i : M) => F.obj ((embedding C).obj (M.X i))
                    def CategoryTheory.Mat_.additiveObjIsoBiproduct {C : Type u₁} [Category.{v₁, u₁} C] [Preadditive C] {D : Type u₁} [Category.{v₁, u₁} D] [Preadditive D] (F : Functor (Mat_ C) D) [F.Additive] (M : Mat_ C) :
                    F.obj M fun (i : M) => F.obj ((embedding C).obj (M.X i))

                    Every M is a direct sum of objects from C, and F preserves biproducts.

                    Equations
                    Instances For
                      @[simp]
                      theorem CategoryTheory.Mat_.additiveObjIsoBiproduct_hom_π {C : Type u₁} [Category.{v₁, u₁} C] [Preadditive C] {D : Type u₁} [Category.{v₁, u₁} D] [Preadditive D] (F : Functor (Mat_ C) D) [F.Additive] (M : Mat_ C) (i : M) :
                      CategoryStruct.comp (additiveObjIsoBiproduct F M).hom (Limits.biproduct.π (fun (i : M) => F.obj ((embedding C).obj (M.X i))) i) = F.map (CategoryStruct.comp M.isoBiproductEmbedding.hom (Limits.biproduct.π (fun (i : M) => (embedding C).obj (M.X i)) i))
                      @[simp]
                      theorem CategoryTheory.Mat_.additiveObjIsoBiproduct_hom_π_assoc {C : Type u₁} [Category.{v₁, u₁} C] [Preadditive C] {D : Type u₁} [Category.{v₁, u₁} D] [Preadditive D] (F : Functor (Mat_ C) D) [F.Additive] (M : Mat_ C) (i : M) {Z : D} (h : F.obj ((embedding C).obj (M.X i)) Z) :
                      CategoryStruct.comp (additiveObjIsoBiproduct F M).hom (CategoryStruct.comp (Limits.biproduct.π (fun (i : M) => F.obj ((embedding C).obj (M.X i))) i) h) = CategoryStruct.comp (F.map (CategoryStruct.comp M.isoBiproductEmbedding.hom (Limits.biproduct.π (fun (i : M) => (embedding C).obj (M.X i)) i))) h
                      @[simp]
                      theorem CategoryTheory.Mat_.ι_additiveObjIsoBiproduct_inv {C : Type u₁} [Category.{v₁, u₁} C] [Preadditive C] {D : Type u₁} [Category.{v₁, u₁} D] [Preadditive D] (F : Functor (Mat_ C) D) [F.Additive] (M : Mat_ C) (i : M) :
                      CategoryStruct.comp (Limits.biproduct.ι (fun (i : M) => F.obj ((embedding C).obj (M.X i))) i) (additiveObjIsoBiproduct F M).inv = F.map (CategoryStruct.comp (Limits.biproduct.ι (fun (i : M) => (embedding C).obj (M.X i)) i) M.isoBiproductEmbedding.inv)
                      @[simp]
                      theorem CategoryTheory.Mat_.ι_additiveObjIsoBiproduct_inv_assoc {C : Type u₁} [Category.{v₁, u₁} C] [Preadditive C] {D : Type u₁} [Category.{v₁, u₁} D] [Preadditive D] (F : Functor (Mat_ C) D) [F.Additive] (M : Mat_ C) (i : M) {Z : D} (h : F.obj M Z) :
                      CategoryStruct.comp (Limits.biproduct.ι (fun (i : M) => F.obj ((embedding C).obj (M.X i))) i) (CategoryStruct.comp (additiveObjIsoBiproduct F M).inv h) = CategoryStruct.comp (F.map (CategoryStruct.comp (Limits.biproduct.ι (fun (i : M) => (embedding C).obj (M.X i)) i) M.isoBiproductEmbedding.inv)) h
                      theorem CategoryTheory.Mat_.additiveObjIsoBiproduct_naturality {C : Type u₁} [Category.{v₁, u₁} C] [Preadditive C] {D : Type u₁} [Category.{v₁, u₁} D] [Preadditive D] [Limits.HasFiniteBiproducts D] (F : Functor (Mat_ C) D) [F.Additive] {M N : Mat_ C} (f : M N) :
                      CategoryStruct.comp (F.map f) (additiveObjIsoBiproduct F N).hom = CategoryStruct.comp (additiveObjIsoBiproduct F M).hom (Limits.biproduct.matrix fun (i : M) (j : N) => F.map ((embedding C).map (f i j)))
                      theorem CategoryTheory.Mat_.additiveObjIsoBiproduct_naturality_assoc {C : Type u₁} [Category.{v₁, u₁} C] [Preadditive C] {D : Type u₁} [Category.{v₁, u₁} D] [Preadditive D] [Limits.HasFiniteBiproducts D] (F : Functor (Mat_ C) D) [F.Additive] {M N : Mat_ C} (f : M N) {Z : D} (h : ( fun (i : N) => F.obj ((embedding C).obj (N.X i))) Z) :
                      theorem CategoryTheory.Mat_.additiveObjIsoBiproduct_naturality' {C : Type u₁} [Category.{v₁, u₁} C] [Preadditive C] {D : Type u₁} [Category.{v₁, u₁} D] [Preadditive D] [Limits.HasFiniteBiproducts D] (F : Functor (Mat_ C) D) [F.Additive] {M N : Mat_ C} (f : M N) :
                      CategoryStruct.comp (additiveObjIsoBiproduct F M).inv (F.map f) = CategoryStruct.comp (Limits.biproduct.matrix fun (i : M) (j : N) => F.map ((embedding C).map (f i j))) (additiveObjIsoBiproduct F N).inv
                      theorem CategoryTheory.Mat_.additiveObjIsoBiproduct_naturality'_assoc {C : Type u₁} [Category.{v₁, u₁} C] [Preadditive C] {D : Type u₁} [Category.{v₁, u₁} D] [Preadditive D] [Limits.HasFiniteBiproducts D] (F : Functor (Mat_ C) D) [F.Additive] {M N : Mat_ C} (f : M N) {Z : D} (h : F.obj N Z) :

                      Any additive functor C ⥤ D to a category D with finite biproducts extends to a functor Mat_ C ⥤ D.

                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For
                        @[simp]
                        theorem CategoryTheory.Mat_.lift_map {C : Type u₁} [Category.{v₁, u₁} C] [Preadditive C] {D : Type u₁} [Category.{v₁, u₁} D] [Preadditive D] [Limits.HasFiniteBiproducts D] (F : Functor C D) [F.Additive] {X✝ Y✝ : Mat_ C} (f : X✝ Y✝) :
                        (lift F).map f = Limits.biproduct.matrix fun (i : X✝) (j : Y✝) => F.map (f i j)
                        @[simp]
                        theorem CategoryTheory.Mat_.lift_obj {C : Type u₁} [Category.{v₁, u₁} C] [Preadditive C] {D : Type u₁} [Category.{v₁, u₁} D] [Preadditive D] [Limits.HasFiniteBiproducts D] (F : Functor C D) [F.Additive] (X : Mat_ C) :
                        (lift F).obj X = fun (i : X) => F.obj (X.X i)

                        An additive functor C ⥤ D factors through its lift to Mat_ C ⥤ D.

                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For
                          def CategoryTheory.Mat_.liftUnique {C : Type u₁} [Category.{v₁, u₁} C] [Preadditive C] {D : Type u₁} [Category.{v₁, u₁} D] [Preadditive D] [Limits.HasFiniteBiproducts D] (F : Functor C D) [F.Additive] (L : Functor (Mat_ C) D) [L.Additive] (α : (embedding C).comp L F) :
                          L lift F

                          Mat_.lift F is the unique additive functor L : Mat_ C ⥤ D such that F ≅ embedding C ⋙ L.

                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For
                            def CategoryTheory.Mat_.ext {C : Type u₁} [Category.{v₁, u₁} C] [Preadditive C] {D : Type u₁} [Category.{v₁, u₁} D] [Preadditive D] [Limits.HasFiniteBiproducts D] {F G : Functor (Mat_ C) D} [F.Additive] [G.Additive] (α : (embedding C).comp F (embedding C).comp G) :
                            F G

                            Two additive functors Mat_ C ⥤ D are naturally isomorphic if their precompositions with embedding C are naturally isomorphic as functors C ⥤ D.

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

                              Natural isomorphism needed in the construction of equivalenceSelfOfHasFiniteBiproducts.

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

                                A preadditive category that already has finite biproducts is equivalent to its additive envelope.

                                Note that we only prove this for a large category; otherwise there are universe issues that I haven't attempted to sort out.

                                Equations
                                • One or more equations did not get rendered due to their size.
                                Instances For
                                  def CategoryTheory.Mat :
                                  Type u → Type (u + 1)

                                  A type synonym for Fintype, which we will equip with a category structure where the morphisms are matrices with components in R.

                                  Equations
                                  Instances For
                                    theorem CategoryTheory.Mat.hom_ext {R : Type u} [Semiring R] {X Y : Mat R} (f g : X Y) (h : ∀ (i : X) (j : Y), f i j = g i j) :
                                    f = g
                                    theorem CategoryTheory.Mat.id_def (R : Type u) [Semiring R] (M : Mat R) :
                                    CategoryStruct.id M = fun (i j : M) => if i = j then 1 else 0
                                    theorem CategoryTheory.Mat.id_apply (R : Type u) [Semiring R] (M : Mat R) (i j : M) :
                                    CategoryStruct.id M i j = if i = j then 1 else 0
                                    @[simp]
                                    theorem CategoryTheory.Mat.id_apply_self (R : Type u) [Semiring R] (M : Mat R) (i : M) :
                                    @[simp]
                                    theorem CategoryTheory.Mat.id_apply_of_ne (R : Type u) [Semiring R] (M : Mat R) (i j : M) (h : i j) :
                                    theorem CategoryTheory.Mat.comp_def (R : Type u) [Semiring R] {M N K : Mat R} (f : M N) (g : N K) :
                                    CategoryStruct.comp f g = fun (i : M) (k : K) => j : N, f i j * g j k
                                    @[simp]
                                    theorem CategoryTheory.Mat.comp_apply (R : Type u) [Semiring R] {M N K : Mat R} (f : M N) (g : N K) (i : M) (k : K) :
                                    CategoryStruct.comp f g i k = j : N, f i j * g j k
                                    instance CategoryTheory.Mat.instInhabitedHom (R : Type u) [Semiring R] (M N : Mat R) :
                                    Equations

                                    Auxiliary definition for CategoryTheory.Mat.equivalenceSingleObj.

                                    Equations
                                    • One or more equations did not get rendered due to their size.
                                    Instances For
                                      @[simp]
                                      theorem CategoryTheory.Mat.equivalenceSingleObjInverse_map (R : Type) [Ring R] {X✝ Y✝ : Mat_ (SingleObj Rᵐᵒᵖ)} (f : X✝ Y✝) (i : ((fun (X : Mat_ (SingleObj Rᵐᵒᵖ)) => FintypeCat.of X) X✝)) (j : ((fun (X : Mat_ (SingleObj Rᵐᵒᵖ)) => FintypeCat.of X) Y✝)) :

                                      The categorical equivalence between the category of matrices over a ring, and the category of matrices over that ring considered as a single-object category.

                                      Equations
                                      Instances For
                                        @[simp]
                                        theorem CategoryTheory.Mat.add_apply {R : Type} [Ring R] {M N : Mat R} (f g : M N) (i : M) (j : N) :
                                        (f + g) i j = f i j + g i j
                                        Equations