Matrices over a category. #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
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
.
An object in Mat_ C
is a finite tuple of objects in C
.
Instances for category_theory.Mat_
A morphism in Mat_ C
is a dependently typed matrix of morphisms.
The identity matrix consists of identity morphisms on the diagonal, and zeros elsewhere.
Equations
- category_theory.Mat_.hom.id M = λ (i j : M.ι), dite (i = j) (λ (h : i = j), category_theory.eq_to_hom _) (λ (h : ¬i = j), 0)
Composition of matrices using matrix multiplication.
Equations
- category_theory.Mat_.category_theory.category = {to_category_struct := {to_quiver := {hom := category_theory.Mat_.hom _inst_2}, id := category_theory.Mat_.hom.id _inst_2, comp := λ (M N K : category_theory.Mat_ C) (f : M ⟶ N) (g : N ⟶ K), category_theory.Mat_.hom.comp f g}, id_comp' := _, comp_id' := _, assoc' := _}
Equations
- category_theory.Mat_.category_theory.preadditive = {hom_group := λ (M N : category_theory.Mat_ C), id dmatrix.add_comm_group, add_comp' := _, comp_add' := _}
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 iso_biproduct_embedding
.
A functor induces a functor of matrix categories.
Equations
- F.map_Mat_ = {obj := λ (M : category_theory.Mat_ C), {ι := M.ι, F := M.F, X := λ (i : M.ι), F.obj (M.X i)}, map := λ (M N : category_theory.Mat_ C) (f : M ⟶ N) (i : {ι := M.ι, F := M.F, X := λ (i : M.ι), F.obj (M.X i)}.ι) (j : {ι := N.ι, F := N.F, X := λ (i : N.ι), F.obj (N.X i)}.ι), F.map (f i j), map_id' := _, map_comp' := _}
The identity functor induces the identity functor on matrix categories.
Equations
- category_theory.functor.map_Mat_id = category_theory.nat_iso.of_components (λ (M : category_theory.Mat_ C), category_theory.eq_to_iso _) category_theory.functor.map_Mat_id._proof_2
Composite functors induce composite functors on matrix categories.
Equations
- F.map_Mat_comp G = category_theory.nat_iso.of_components (λ (M : category_theory.Mat_ C), category_theory.eq_to_iso _) _
The embedding of C
into Mat_ C
as one-by-one matrices.
(We index the summands by punit
.)
Equations
- category_theory.Mat_.embedding C = {obj := λ (X : C), {ι := punit, F := punit.fintype, X := λ (_x : punit), X}, map := λ (X Y : C) (f : X ⟶ Y) (_x : {ι := punit, F := punit.fintype, X := λ (_x : punit), X}.ι) (_x : {ι := punit, F := punit.fintype, X := λ (_x : punit), Y}.ι), f, map_id' := _, map_comp' := _}
Instances for category_theory.Mat_.embedding
Equations
- category_theory.Mat_.embedding.category_theory.full C = {preimage := λ (X Y : C) (f : (category_theory.Mat_.embedding C).obj X ⟶ (category_theory.Mat_.embedding C).obj Y), f punit.star punit.star, witness' := _}
Equations
Every object in Mat_ C
is isomorphic to the biproduct of its summands.
Equations
- M.iso_biproduct_embedding = {hom := category_theory.limits.biproduct.lift (λ (i j : M.ι) (k : ((category_theory.Mat_.embedding C).obj (M.X i)).ι), dite (j = i) (λ (h : j = i), category_theory.eq_to_hom _) (λ (h : ¬j = i), 0)), inv := category_theory.limits.biproduct.desc (λ (i : M.ι) (j : ((category_theory.Mat_.embedding C).obj (M.X i)).ι) (k : M.ι), dite (i = k) (λ (h : i = k), category_theory.eq_to_hom _) (λ (h : ¬i = k), 0)), hom_inv_id' := _, inv_hom_id' := _}
Every M
is a direct sum of objects from C
, and F
preserves biproducts.
Equations
- category_theory.Mat_.additive_obj_iso_biproduct F M = F.map_iso M.iso_biproduct_embedding ≪≫ F.map_biproduct (λ (i : M.ι), (category_theory.Mat_.embedding C).obj (M.X i))
Any additive functor C ⥤ D
to a category D
with finite biproducts extends to
a functor Mat_ C ⥤ D
.
Equations
- category_theory.Mat_.lift F = {obj := λ (X : category_theory.Mat_ C), ⨁ λ (i : X.ι), F.obj (X.X i), map := λ (X Y : category_theory.Mat_ C) (f : X ⟶ Y), category_theory.limits.biproduct.matrix (λ (i : X.ι) (j : Y.ι), F.map (f i j)), map_id' := _, map_comp' := _}
Instances for category_theory.Mat_.lift
An additive functor C ⥤ D
factors through its lift to Mat_ C ⥤ D
.
Equations
- category_theory.Mat_.embedding_lift_iso F = category_theory.nat_iso.of_components (λ (X : C), {hom := category_theory.limits.biproduct.desc (λ (P : ((category_theory.Mat_.embedding C).obj X).ι), 𝟙 (F.obj X)), inv := category_theory.limits.biproduct.lift (λ (P : ((category_theory.Mat_.embedding C).obj X).ι), 𝟙 (F.obj X)), hom_inv_id' := _, inv_hom_id' := _}) _
Mat_.lift F
is the unique additive functor L : Mat_ C ⥤ D
such that F ≅ embedding C ⋙ L
.
Equations
- category_theory.Mat_.lift_unique F L α = category_theory.nat_iso.of_components (λ (M : category_theory.Mat_ C), category_theory.Mat_.additive_obj_iso_biproduct L M ≪≫ category_theory.limits.biproduct.map_iso (λ (i : M.ι), α.app (M.X i)) ≪≫ category_theory.limits.biproduct.map_iso (λ (i : M.ι), (category_theory.Mat_.embedding_lift_iso F).symm.app (M.X i)) ≪≫ (category_theory.Mat_.additive_obj_iso_biproduct (category_theory.Mat_.lift F) M).symm) _
Two additive functors Mat_ C ⥤ D
are naturally isomorphic if
their precompositions with embedding C
are naturally isomorphic as functors C ⥤ D
.
Natural isomorphism needed in the construction of equivalence_self_of_has_finite_biproducts
.
Equations
- category_theory.Mat_.equivalence_self_of_has_finite_biproducts_aux = (category_theory.Mat_.embedding C).right_unitor ≪≫ (category_theory.Mat_.embedding C).left_unitor.symm ≪≫ category_theory.iso_whisker_right (category_theory.Mat_.embedding_lift_iso (𝟭 C)).symm (category_theory.Mat_.embedding C) ≪≫ (category_theory.Mat_.embedding C).associator (category_theory.Mat_.lift (𝟭 C)) (category_theory.Mat_.embedding C)
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
- category_theory.Mat_.equivalence_self_of_has_finite_biproducts C = category_theory.equivalence.mk (category_theory.Mat_.lift (𝟭 C)) (category_theory.Mat_.embedding C) (category_theory.Mat_.ext category_theory.Mat_.equivalence_self_of_has_finite_biproducts_aux) (category_theory.Mat_.embedding_lift_iso (𝟭 C))
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 category_theory.Mat
Equations
- category_theory.Mat.category R = {to_category_struct := {to_quiver := {hom := λ (X Y : category_theory.Mat R), matrix ↥X ↥Y R}, id := λ (X : category_theory.Mat R), 1, comp := λ (X Y Z : category_theory.Mat R) (f : X ⟶ Y) (g : Y ⟶ Z), matrix.mul f g}, id_comp' := _, comp_id' := _, assoc' := _}
Auxiliary definition for category_theory.Mat.equivalence_single_obj
.
Equations
- category_theory.Mat.equivalence_single_obj_inverse R = {obj := λ (X : category_theory.Mat_ (category_theory.single_obj Rᵐᵒᵖ)), Fintype.of X.ι, map := λ (X Y : category_theory.Mat_ (category_theory.single_obj Rᵐᵒᵖ)) (f : X ⟶ Y) (i : ↥(Fintype.of X.ι)) (j : ↥(Fintype.of Y.ι)), mul_opposite.unop (f i j), map_id' := _, map_comp' := _}
Instances for category_theory.Mat.equivalence_single_obj_inverse
Equations
- category_theory.Mat.equivalence_single_obj_inverse.category_theory.full R = {preimage := λ (X Y : category_theory.Mat_ (category_theory.single_obj Rᵐᵒᵖ)) (f : (category_theory.Mat.equivalence_single_obj_inverse R).obj X ⟶ (category_theory.Mat.equivalence_single_obj_inverse R).obj Y) (i : X.ι) (j : Y.ι), mul_opposite.op (f i j), witness' := _}
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
- category_theory.Mat.category_theory.preadditive R = {hom_group := λ (P Q : category_theory.Mat R), matrix.add_comm_group, add_comp' := _, comp_add' := _}