|
| 1 | +/- |
| 2 | +Copyright (c) 2021 Adam Topaz. All rights reserved. |
| 3 | +Released under Apache 2.0 license as described in the file LICENSE. |
| 4 | +Authors: Adam Topaz, Scott Morrison |
| 5 | +-/ |
| 6 | +import category_theory.preadditive |
| 7 | +import category_theory.limits.shapes.biproducts |
| 8 | + |
| 9 | +/-! |
| 10 | +# Additive Functors |
| 11 | +
|
| 12 | +A functor between two preadditive categories is called *additive* |
| 13 | +provided that the induced map on hom types is a morphism of abelian |
| 14 | +groups. |
| 15 | +
|
| 16 | +An additive functor between preadditive categories creates and preserves biproducts. |
| 17 | +
|
| 18 | +# Implementation details |
| 19 | +
|
| 20 | +`functor.additive` is a `Prop`-valued class, defined by saying that |
| 21 | +for every two objects `X` and `Y`, the map |
| 22 | +`F.map : (X ⟶ Y) → (F.obj X ⟶ F.obj Y)` is a morphism of abelian |
| 23 | +groups. |
| 24 | +
|
| 25 | +# Project: |
| 26 | +
|
| 27 | +- Prove that a functor is additive if it preserves finite biproducts |
| 28 | + (See https://stacks.math.columbia.edu/tag/010M.) |
| 29 | +-/ |
| 30 | + |
| 31 | +namespace category_theory |
| 32 | + |
| 33 | +/-- A functor `F` is additive provided `F.map` is an additive homomorphism. -/ |
| 34 | +class functor.additive {C D : Type*} [category C] [category D] |
| 35 | + [preadditive C] [preadditive D] (F : C ⥤ D) : Prop := |
| 36 | +(map_zero' : Π {X Y : C}, F.map (0 : X ⟶ Y) = 0 . obviously) |
| 37 | +(map_add' : Π {X Y : C} {f g : X ⟶ Y}, F.map (f + g) = F.map f + F.map g . obviously) |
| 38 | + |
| 39 | +section preadditive |
| 40 | + |
| 41 | +namespace functor |
| 42 | + |
| 43 | +section |
| 44 | +variables {C D : Type*} [category C] [category D] [preadditive C] |
| 45 | + [preadditive D] (F : C ⥤ D) [functor.additive F] |
| 46 | + |
| 47 | +@[simp] |
| 48 | +lemma map_zero {X Y : C} : F.map (0 : X ⟶ Y) = 0 := |
| 49 | +functor.additive.map_zero' |
| 50 | + |
| 51 | +@[simp] |
| 52 | +lemma map_add {X Y : C} {f g : X ⟶ Y} : F.map (f + g) = F.map f + F.map g := |
| 53 | +functor.additive.map_add' |
| 54 | + |
| 55 | +instance : additive (𝟭 C) := |
| 56 | +{} |
| 57 | + |
| 58 | +instance {E : Type*} [category E] [preadditive E] (G : D ⥤ E) [functor.additive G] : |
| 59 | + additive (F ⋙ G) := |
| 60 | +{} |
| 61 | + |
| 62 | +/-- `F.map_add_hom` is an additive homomorphism whose underlying function is `F.map`. -/ |
| 63 | +@[simps] |
| 64 | +def map_add_hom {X Y : C} : (X ⟶ Y) →+ (F.obj X ⟶ F.obj Y) := |
| 65 | +{ to_fun := λ f, F.map f, |
| 66 | + map_zero' := F.map_zero, |
| 67 | + map_add' := λ _ _, F.map_add } |
| 68 | + |
| 69 | +lemma coe_map_add_hom {X Y : C} : ⇑(F.map_add_hom : (X ⟶ Y) →+ _) = @map C _ D _ F X Y := rfl |
| 70 | + |
| 71 | +@[simp] |
| 72 | +lemma map_neg {X Y : C} {f : X ⟶ Y} : F.map (-f) = - F.map f := |
| 73 | +F.map_add_hom.map_neg _ |
| 74 | + |
| 75 | +@[simp] |
| 76 | +lemma map_sub {X Y : C} {f g : X ⟶ Y} : F.map (f - g) = F.map f - F.map g := |
| 77 | +F.map_add_hom.map_sub _ _ |
| 78 | + |
| 79 | +open_locale big_operators |
| 80 | + |
| 81 | +@[simp] |
| 82 | +lemma map_sum {X Y : C} {α : Type*} (f : α → (X ⟶ Y)) (s : finset α) : |
| 83 | + F.map (∑ a in s, f a) = ∑ a in s, F.map (f a) := |
| 84 | +(F.map_add_hom : (X ⟶ Y) →+ _).map_sum f s |
| 85 | + |
| 86 | +end |
| 87 | + |
| 88 | +section |
| 89 | +-- To talk about preservation of biproducts we need to specify universes explicitly. |
| 90 | + |
| 91 | +noncomputable theory |
| 92 | +universes v u₁ u₂ |
| 93 | + |
| 94 | +variables {C : Type u₁} {D : Type u₂} [category.{v} C] [category.{v} D] |
| 95 | + [preadditive C] [preadditive D] (F : C ⥤ D) [functor.additive F] |
| 96 | + |
| 97 | +open category_theory.limits |
| 98 | + |
| 99 | +/-- |
| 100 | +An additive functor between preadditive categories creates finite biproducts. |
| 101 | +-/ |
| 102 | +instance map_has_biproduct {J : Type v} [fintype J] [decidable_eq J] (f : J → C) [has_biproduct f] : |
| 103 | + has_biproduct (λ j, F.obj (f j)) := |
| 104 | +has_biproduct_of_total |
| 105 | +{ X := F.obj (⨁ f), |
| 106 | + π := λ j, F.map (biproduct.π f j), |
| 107 | + ι := λ j, F.map (biproduct.ι f j), |
| 108 | + ι_π := λ j j', by { simp only [←F.map_comp], split_ifs, { subst h, simp, }, { simp [h], }, }, } |
| 109 | +(by simp_rw [←F.map_comp, ←F.map_sum, biproduct.total, functor.map_id]) |
| 110 | + |
| 111 | +/-- |
| 112 | +An additive functor between preadditive categories preserves finite biproducts. |
| 113 | +-/ |
| 114 | +-- This essentially repeats the work of the previous instance, |
| 115 | +-- but gives good definitional reduction to `biproduct.lift` and `biproduct.desc`. |
| 116 | +@[simps] |
| 117 | +def map_biproduct {J : Type v} [fintype J] [decidable_eq J] (f : J → C) [has_biproduct f] : |
| 118 | + F.obj (⨁ f) ≅ ⨁ (λ j, F.obj (f j)) := |
| 119 | +{ hom := biproduct.lift (λ j, F.map (biproduct.π f j)), |
| 120 | + inv := biproduct.desc (λ j, F.map (biproduct.ι f j)), |
| 121 | + hom_inv_id' := |
| 122 | + by simp only [biproduct.lift_desc, ←F.map_comp, ←F.map_sum, biproduct.total, F.map_id], |
| 123 | + inv_hom_id' := |
| 124 | + begin |
| 125 | + ext j j', |
| 126 | + simp only [category.comp_id, category.assoc, biproduct.lift_π, biproduct.ι_desc_assoc, |
| 127 | + ←F.map_comp, biproduct.ι_π, F.map_dite, dif_ctx_congr, eq_to_hom_map, F.map_zero], |
| 128 | + end } |
| 129 | + |
| 130 | +end |
| 131 | + |
| 132 | +end functor |
| 133 | +end preadditive |
| 134 | + |
| 135 | +end category_theory |
0 commit comments