Documentation

Mathlib.CategoryTheory.Limits.Shapes.Biproducts

Biproducts and binary biproducts #

We introduce the notion of (finite) biproducts and binary biproducts.

These are slightly unusual relative to the other shapes in the library, as they are simultaneously limits and colimits. (Zero objects are similar; they are "biterminal".)

For results about biproducts in preadditive categories see CategoryTheory.Preadditive.Biproducts.

In a category with zero morphisms, we model the (binary) biproduct of P Q : C using a BinaryBicone, which has a cone point X, and morphisms fst : X ⟶ P, snd : X ⟶ Q, inl : P ⟶ X and inr : X ⟶ Q, such that inlfst = 𝟙 P, inlsnd = 0, inrfst = 0, and inrsnd = 𝟙 Q. Such a BinaryBicone is a biproduct if the cone is a limit cone, and the cocone is a colimit cocone.

For biproducts indexed by a Fintype J, a bicone again consists of a cone point X and morphisms π j : X ⟶ F j and ι j : F j ⟶ X for each j, such that ι j ≫ π j' is the identity when j = j' and zero otherwise.

Notation #

As is already taken for the sum of types, we introduce the notation X ⊞ Y for a binary biproduct. We introduce ⨁ f for the indexed biproduct.

Implementation #

Prior to #14046, HasFiniteBiproducts required a DecidableEq instance on the indexing type. As this had no pay-off (everything about limits is non-constructive in mathlib), and occasional cost (constructing decidability instances appropriate for constructions involving the indexing type), we made everything classical.

structure CategoryTheory.Limits.Bicone {J : Type w} {C : Type uC} [CategoryTheory.Category.{uC', uC} C] [CategoryTheory.Limits.HasZeroMorphisms C] (F : JC) :
Type (max (max uC uC') w)

A c : Bicone F is:

  • an object c.pt and
  • morphisms π j : pt ⟶ F j and ι j : F j ⟶ pt for each j,
  • such that ι j ≫ π j' is the identity when j = j' and zero otherwise.
Instances For

    A bicone morphism between two bicones for the same diagram is a morphism of the bicone points which commutes with the cone and cocone legs.

    Instances For

      To give an isomorphism between cocones, it suffices to give an isomorphism between their vertices which commutes with the cocone maps.

      Instances For

        We can turn any limit cone over a discrete collection of objects into a bicone.

        Instances For

          We can turn any colimit cocone over a discrete collection of objects into a bicone.

          Instances For

            Structure witnessing that a bicone is both a limit cone and a colimit cocone.

            Instances For
              theorem CategoryTheory.Limits.Bicone.IsBilimit.ext_iff {J : Type w} {C : Type uC} :
              ∀ {inst : CategoryTheory.Category.{uC', uC} C} {inst_1 : CategoryTheory.Limits.HasZeroMorphisms C} {F : JC} {B : CategoryTheory.Limits.Bicone F} (x y : CategoryTheory.Limits.Bicone.IsBilimit B), x = y x.isLimit = y.isLimit x.isColimit = y.isColimit
              theorem CategoryTheory.Limits.Bicone.IsBilimit.ext {J : Type w} {C : Type uC} :
              ∀ {inst : CategoryTheory.Category.{uC', uC} C} {inst_1 : CategoryTheory.Limits.HasZeroMorphisms C} {F : JC} {B : CategoryTheory.Limits.Bicone F} (x y : CategoryTheory.Limits.Bicone.IsBilimit B), x.isLimit = y.isLimitx.isColimit = y.isColimitx = y

              Whisker a bicone with an equivalence between the indexing types.

              Instances For

                Taking the cone of a whiskered bicone results in a cone isomorphic to one gained by whiskering the cone and postcomposing with a suitable isomorphism.

                Instances For

                  Taking the cocone of a whiskered bicone results in a cone isomorphic to one gained by whiskering the cocone and precomposing with a suitable isomorphism.

                  Instances For

                    Whiskering a bicone with an equivalence between types preserves being a bilimit bicone.

                    Instances For

                      A bicone over F : J → C, which is both a limit cone and a colimit cocone.

                      Instances For

                        HasBiproduct F expresses the mere existence of a bicone which is simultaneously a limit and a colimit of the diagram F.

                        Instances

                          Use the axiom of choice to extract explicit BiproductData F from HasBiproduct F.

                          Instances For

                            A bicone for F which is both a limit cone and a colimit cocone.

                            Instances For

                              C has biproducts of shape J if we have a limit and a colimit, with the same cone points, of every function F : J → C.

                              Instances

                                HasFiniteBiproducts C represents a choice of biproduct for every family of objects in C indexed by a finite type.

                                Instances

                                  The isomorphism between the specified limit and the specified colimit for a functor with a bilimit.

                                  Instances For
                                    @[inline, reducible]

                                    biproduct f computes the biproduct of a family of elements f. (It is defined as an abbreviation for limit (Discrete.functor f), so for most facts about biproduct f, you will just use general facts about limits and colimits.)

                                    Instances For

                                      biproduct f computes the biproduct of a family of elements f. (It is defined as an abbreviation for limit (Discrete.functor f), so for most facts about biproduct f, you will just use general facts about limits and colimits.)

                                      Instances For
                                        @[inline, reducible]

                                        The projection onto a summand of a biproduct.

                                        Instances For
                                          @[inline, reducible]

                                          The inclusion into a summand of a biproduct.

                                          Instances For

                                            Note that as this lemma has an if in the statement, we include a DecidableEq argument. This means you may not be able to simp using this lemma unless you open Classical.

                                            @[inline, reducible]

                                            Given a collection of maps into the summands, we obtain a map into the biproduct.

                                            Instances For
                                              @[inline, reducible]

                                              Given a collection of maps out of the summands, we obtain a map out of the biproduct.

                                              Instances For
                                                @[inline, reducible]

                                                Given a collection of maps between corresponding summands of a pair of biproducts indexed by the same type, we obtain a map between the biproducts.

                                                Instances For
                                                  @[inline, reducible]

                                                  An alternative to biproduct.map constructed via colimits. This construction only exists in order to show it is equal to biproduct.map.

                                                  Instances For

                                                    The canonical isomorphism between the chosen biproduct and the chosen product.

                                                    Instances For

                                                      The canonical isomorphism between the chosen biproduct and the chosen coproduct.

                                                      Instances For

                                                        Given a collection of isomorphisms between corresponding summands of a pair of biproducts indexed by the same type, we obtain an isomorphism between the biproducts.

                                                        Instances For

                                                          Two biproducts which differ by an equivalence in the indexing type, and up to isomorphism in the factors, are isomorphic.

                                                          Unfortunately there are two natural ways to define each direction of this isomorphism (because it is true for both products and coproducts separately). We give the alternative definitions as lemmas below.

                                                          Instances For
                                                            def CategoryTheory.Limits.biproductBiproductIso {C : Type u} [CategoryTheory.Category.{v, u} C] [CategoryTheory.Limits.HasZeroMorphisms C] {ι : Type u_3} (f : ιType u_2) (g : (i : ι) → f iC) [∀ (i : ι), CategoryTheory.Limits.HasBiproduct (g i)] [CategoryTheory.Limits.HasBiproduct fun i => g i] :
                                                            ( fun i => g i) fun p => g p.fst p.snd

                                                            An iterated biproduct is a biproduct over a sigma type.

                                                            Instances For

                                                              The canonical morphism from the biproduct over a restricted index type to the biproduct of the full index type.

                                                              Instances For

                                                                The canonical morphism from a biproduct to the biproduct over a restriction of its index type.

                                                                Instances For
                                                                  @[simp]
                                                                  theorem CategoryTheory.Limits.kernelBiproductToSubtypeIso_hom {C : Type u} [CategoryTheory.Category.{v, u} C] [CategoryTheory.Limits.HasZeroMorphisms C] {K : Type} [Fintype K] [CategoryTheory.Limits.HasFiniteBiproducts C] (f : KC) (p : Set K) :
                                                                  @[simp]
                                                                  theorem CategoryTheory.Limits.cokernelBiproductFromSubtypeIso_inv {C : Type u} [CategoryTheory.Category.{v, u} C] [CategoryTheory.Limits.HasZeroMorphisms C] {K : Type} [Fintype K] [CategoryTheory.Limits.HasFiniteBiproducts C] (f : KC) (p : Set K) :
                                                                  def CategoryTheory.Limits.biproduct.matrix {J : Type} [Fintype J] {K : Type} [Fintype K] {C : Type u} [CategoryTheory.Category.{v, u} C] [CategoryTheory.Limits.HasZeroMorphisms C] [CategoryTheory.Limits.HasFiniteBiproducts C] {f : JC} {g : KC} (m : (j : J) → (k : K) → f j g k) :
                                                                  f g

                                                                  Convert a (dependently typed) matrix to a morphism of biproducts.

                                                                  Instances For

                                                                    Extract the matrix components from a morphism of biproducts.

                                                                    Instances For
                                                                      @[simp]
                                                                      theorem CategoryTheory.Limits.biproduct.matrixEquiv_apply {J : Type} [Fintype J] {K : Type} [Fintype K] {C : Type u} [CategoryTheory.Category.{v, u} C] [CategoryTheory.Limits.HasZeroMorphisms C] [CategoryTheory.Limits.HasFiniteBiproducts C] {f : JC} {g : KC} (m : f g) (j : J) (k : K) :
                                                                      CategoryTheory.Limits.biproduct.matrixEquiv m j k = CategoryTheory.Limits.biproduct.components m j k
                                                                      @[simp]
                                                                      theorem CategoryTheory.Limits.biproduct.matrixEquiv_symm_apply {J : Type} [Fintype J] {K : Type} [Fintype K] {C : Type u} [CategoryTheory.Category.{v, u} C] [CategoryTheory.Limits.HasZeroMorphisms C] [CategoryTheory.Limits.HasFiniteBiproducts C] {f : JC} {g : KC} (m : (j : J) → (k : K) → f j g k) :
                                                                      CategoryTheory.Limits.biproduct.matrixEquiv.symm m = CategoryTheory.Limits.biproduct.matrix m

                                                                      Morphisms between direct sums are matrices.

                                                                      Instances For

                                                                        Biproducts are unique up to isomorphism. This already follows because bilimits are limits, but in the case of biproducts we can give an isomorphism with particularly nice definitional properties, namely that biproduct.lift b.π and biproduct.desc b.ι are inverses of each other.

                                                                        Instances For

                                                                          The limit bicone for the biproduct over an index type with exactly one term.

                                                                          Instances For

                                                                            A biproduct over an index type with exactly one term is just the object over that term.

                                                                            Instances For
                                                                              • pt : C

                                                                                A binary bicone for a pair of objects P Q : C consists of the cone point X, maps from X to both P and Q, and maps from both P and Q to X, so that inlfst = 𝟙 P, inlsnd = 0, inrfst = 0, and inrsnd = 𝟙 Q

                                                                              • fst : s.pt P

                                                                                A binary bicone for a pair of objects P Q : C consists of the cone point X, maps from X to both P and Q, and maps from both P and Q to X, so that inlfst = 𝟙 P, inlsnd = 0, inrfst = 0, and inrsnd = 𝟙 Q

                                                                              • snd : s.pt Q

                                                                                A binary bicone for a pair of objects P Q : C consists of the cone point X, maps from X to both P and Q, and maps from both P and Q to X, so that inlfst = 𝟙 P, inlsnd = 0, inrfst = 0, and inrsnd = 𝟙 Q

                                                                              • inl : P s.pt

                                                                                A binary bicone for a pair of objects P Q : C consists of the cone point X, maps from X to both P and Q, and maps from both P and Q to X, so that inlfst = 𝟙 P, inlsnd = 0, inrfst = 0, and inrsnd = 𝟙 Q

                                                                              • inr : Q s.pt

                                                                                A binary bicone for a pair of objects P Q : C consists of the cone point X, maps from X to both P and Q, and maps from both P and Q to X, so that inlfst = 𝟙 P, inlsnd = 0, inrfst = 0, and inrsnd = 𝟙 Q

                                                                              • A binary bicone for a pair of objects P Q : C consists of the cone point X, maps from X to both P and Q, and maps from both P and Q to X, so that inlfst = 𝟙 P, inlsnd = 0, inrfst = 0, and inrsnd = 𝟙 Q

                                                                              • inl_snd : CategoryTheory.CategoryStruct.comp s.inl s.snd = 0

                                                                                A binary bicone for a pair of objects P Q : C consists of the cone point X, maps from X to both P and Q, and maps from both P and Q to X, so that inlfst = 𝟙 P, inlsnd = 0, inrfst = 0, and inrsnd = 𝟙 Q

                                                                              • inr_fst : CategoryTheory.CategoryStruct.comp s.inr s.fst = 0

                                                                                A binary bicone for a pair of objects P Q : C consists of the cone point X, maps from X to both P and Q, and maps from both P and Q to X, so that inlfst = 𝟙 P, inlsnd = 0, inrfst = 0, and inrsnd = 𝟙 Q

                                                                              • A binary bicone for a pair of objects P Q : C consists of the cone point X, maps from X to both P and Q, and maps from both P and Q to X, so that inlfst = 𝟙 P, inlsnd = 0, inrfst = 0, and inrsnd = 𝟙 Q

                                                                              A binary bicone for a pair of objects P Q : C consists of the cone point X, maps from X to both P and Q, and maps from both P and Q to X, so that inlfst = 𝟙 P, inlsnd = 0, inrfst = 0, and inrsnd = 𝟙 Q

                                                                              Instances For

                                                                                Structure witnessing that a binary bicone is a limit cone and a limit cocone.

                                                                                Instances For

                                                                                  A bicone over P Q : C, which is both a limit cone and a colimit cocone.

                                                                                  Instances For

                                                                                    HasBinaryBiproduct P Q expresses the mere existence of a bicone which is simultaneously a limit and a colimit of the diagram pair P Q.

                                                                                    Instances

                                                                                      HasBinaryBiproducts C represents the existence of a bicone which is simultaneously a limit and a colimit of the diagram pair P Q, for every P Q : C.

                                                                                      Instances

                                                                                        A category with finite biproducts has binary biproducts.

                                                                                        This is not an instance as typically in concrete categories there will be an alternative construction with nicer definitional properties.

                                                                                        The isomorphism between the specified binary product and the specified binary coproduct for a pair for a binary biproduct.

                                                                                        Instances For
                                                                                          @[inline, reducible]

                                                                                          An arbitrary choice of biproduct of a pair of objects.

                                                                                          Instances For

                                                                                            An arbitrary choice of biproduct of a pair of objects.

                                                                                            Instances For
                                                                                              @[inline, reducible]

                                                                                              The projection onto the first summand of a binary biproduct.

                                                                                              Instances For
                                                                                                @[inline, reducible]

                                                                                                The projection onto the second summand of a binary biproduct.

                                                                                                Instances For
                                                                                                  @[inline, reducible]

                                                                                                  The inclusion into the first summand of a binary biproduct.

                                                                                                  Instances For
                                                                                                    @[inline, reducible]

                                                                                                    The inclusion into the second summand of a binary biproduct.

                                                                                                    Instances For