|
| 1 | +/- |
| 2 | +Copyright (c) 2024 Joël Riou. All rights reserved. |
| 3 | +Released under Apache 2.0 license as described in the file LICENSE. |
| 4 | +Authors: Joël Riou |
| 5 | +-/ |
| 6 | +import Mathlib.CategoryTheory.Functor.KanExtension.Basic |
| 7 | +import Mathlib.CategoryTheory.Localization.Predicate |
| 8 | + |
| 9 | +/-! |
| 10 | +# Right derived functors |
| 11 | +
|
| 12 | +In this file, given a functor `F : C ⥤ H`, and `L : C ⥤ D` that is a |
| 13 | +localization functor for `W : MorphismProperty C`, we define |
| 14 | +`F.totalRightDerived L W : D ⥤ H` as the left Kan extension of `F` |
| 15 | +along `L`: it is defined if the type class `F.HasRightDerivedFunctor W` |
| 16 | +asserting the existence of a left Kan extension is satisfied. |
| 17 | +(The name `totalRightDerived` is to avoid name-collision with |
| 18 | +`Functor.rightDerived` which are the right derived functors in |
| 19 | +the context of abelian categories.) |
| 20 | +
|
| 21 | +Given `RF : D ⥤ H` and `α : F ⟶ L ⋙ RF`, we also introduce a type class |
| 22 | +`F.IsRightDerivedFunctor α W` saying that `α` is a left Kan extension of `F` |
| 23 | +along the localization functor `L`. |
| 24 | +
|
| 25 | +## TODO |
| 26 | +
|
| 27 | +- refactor `Functor.rightDerived` (and `Functor.leftDerived`) when the necessary |
| 28 | +material enters mathlib: derived categories, injective/projective derivability |
| 29 | +structures, existence of derived functors from derivability structures. |
| 30 | +
|
| 31 | +## References |
| 32 | +
|
| 33 | +* https://ncatlab.org/nlab/show/derived+functor |
| 34 | +
|
| 35 | +-/ |
| 36 | + |
| 37 | +namespace CategoryTheory |
| 38 | + |
| 39 | +namespace Functor |
| 40 | + |
| 41 | +variable {C C' D D' H H' : Type _} [Category C] [Category C'] |
| 42 | + [Category D] [Category D'] [Category H] [Category H'] |
| 43 | + (RF RF' RF'' : D ⥤ H) {F F' F'' : C ⥤ H} (e : F ≅ F') {L : C ⥤ D} |
| 44 | + (α : F ⟶ L ⋙ RF) (α' : F' ⟶ L ⋙ RF') (α'' : F'' ⟶ L ⋙ RF'') (α'₂ : F ⟶ L ⋙ RF') |
| 45 | + (W : MorphismProperty C) |
| 46 | + |
| 47 | +/-- A functor `RF : D ⥤ H` is a right derived functor of `F : C ⥤ H` |
| 48 | +if it is equipped with a natural transformation `α : F ⟶ L ⋙ RF` |
| 49 | +which makes it a left Kan extension of `F` along `L`, |
| 50 | +where `L : C ⥤ D` is a localization functor for `W : MorphismProperty C`. -/ |
| 51 | +class IsRightDerivedFunctor [L.IsLocalization W] : Prop where |
| 52 | + isLeftKanExtension' : RF.IsLeftKanExtension α |
| 53 | + |
| 54 | +lemma IsRightDerivedFunctor.isLeftKanExtension |
| 55 | + [L.IsLocalization W] [RF.IsRightDerivedFunctor α W] : |
| 56 | + RF.IsLeftKanExtension α := |
| 57 | + IsRightDerivedFunctor.isLeftKanExtension' W |
| 58 | + |
| 59 | +lemma isRightDerivedFunctor_iff_isLeftKanExtension [L.IsLocalization W] : |
| 60 | + RF.IsRightDerivedFunctor α W ↔ RF.IsLeftKanExtension α := by |
| 61 | + constructor |
| 62 | + · exact fun _ => IsRightDerivedFunctor.isLeftKanExtension RF α W |
| 63 | + · exact fun h => ⟨h⟩ |
| 64 | + |
| 65 | +variable {RF RF'} in |
| 66 | +lemma isRightDerivedFunctor_iff_of_iso (α' : F ⟶ L ⋙ RF') (W : MorphismProperty C) |
| 67 | + [L.IsLocalization W] (e : RF ≅ RF') (comm : α ≫ whiskerLeft L e.hom = α') : |
| 68 | + RF.IsRightDerivedFunctor α W ↔ RF'.IsRightDerivedFunctor α' W := by |
| 69 | + simp only [isRightDerivedFunctor_iff_isLeftKanExtension] |
| 70 | + exact isLeftKanExtension_iff_of_iso e _ _ comm |
| 71 | + |
| 72 | +section |
| 73 | + |
| 74 | +variable [L.IsLocalization W] [RF.IsRightDerivedFunctor α W] |
| 75 | + [RF'.IsRightDerivedFunctor α' W] [RF''.IsRightDerivedFunctor α'' W] |
| 76 | + |
| 77 | +/-- Constructor for natural transformations from a right derived functor. -/ |
| 78 | +noncomputable def rightDerivedDesc (G : D ⥤ H) (β : F ⟶ L ⋙ G) : RF ⟶ G := |
| 79 | + have := IsRightDerivedFunctor.isLeftKanExtension RF α W |
| 80 | + RF.descOfIsLeftKanExtension α G β |
| 81 | + |
| 82 | +@[reassoc (attr := simp)] |
| 83 | +lemma rightDerived_fac (G : D ⥤ H) (β : F ⟶ L ⋙ G) : |
| 84 | + α ≫ whiskerLeft L (RF.rightDerivedDesc α W G β) = β := |
| 85 | + have := IsRightDerivedFunctor.isLeftKanExtension RF α W |
| 86 | + RF.descOfIsLeftKanExtension_fac α G β |
| 87 | + |
| 88 | +@[reassoc (attr := simp)] |
| 89 | +lemma rightDerived_fac_app (G : D ⥤ H) (β : F ⟶ L ⋙ G) (X : C): |
| 90 | + α.app X ≫ (RF.rightDerivedDesc α W G β).app (L.obj X) = β.app X := |
| 91 | + have := IsRightDerivedFunctor.isLeftKanExtension RF α W |
| 92 | + RF.descOfIsLeftKanExtension_fac_app α G β X |
| 93 | + |
| 94 | +lemma rightDerived_ext (G : D ⥤ H) (γ₁ γ₂ : RF ⟶ G) |
| 95 | + (hγ : α ≫ whiskerLeft L γ₁ = α ≫ whiskerLeft L γ₂) : γ₁ = γ₂ := |
| 96 | + have := IsRightDerivedFunctor.isLeftKanExtension RF α W |
| 97 | + RF.hom_ext_of_isLeftKanExtension α γ₁ γ₂ hγ |
| 98 | + |
| 99 | +/-- The natural transformation `RF ⟶ RF'` on right derived functors that is |
| 100 | +induced by a natural transformation `F ⟶ F'`. -/ |
| 101 | +noncomputable def rightDerivedNatTrans (τ : F ⟶ F') : RF ⟶ RF' := |
| 102 | + RF.rightDerivedDesc α W RF' (τ ≫ α') |
| 103 | + |
| 104 | +@[reassoc (attr := simp)] |
| 105 | +lemma rightDerivedNatTrans_fac (τ : F ⟶ F') : |
| 106 | + α ≫ whiskerLeft L (rightDerivedNatTrans RF RF' α α' W τ) = τ ≫ α' := by |
| 107 | + dsimp only [rightDerivedNatTrans] |
| 108 | + simp |
| 109 | + |
| 110 | +@[reassoc (attr := simp)] |
| 111 | +lemma rightDerivedNatTrans_app (τ : F ⟶ F') (X : C) : |
| 112 | + α.app X ≫ (rightDerivedNatTrans RF RF' α α' W τ).app (L.obj X) = |
| 113 | + τ.app X ≫ α'.app X := by |
| 114 | + dsimp only [rightDerivedNatTrans] |
| 115 | + simp |
| 116 | + |
| 117 | +@[simp] |
| 118 | +lemma rightDerivedNatTrans_id : |
| 119 | + rightDerivedNatTrans RF RF α α W (𝟙 F) = 𝟙 RF := |
| 120 | + rightDerived_ext RF α W _ _ _ (by aesop_cat) |
| 121 | + |
| 122 | +@[reassoc (attr:= simp)] |
| 123 | +lemma rightDerivedNatTrans_comp (τ : F ⟶ F') (τ' : F' ⟶ F'') : |
| 124 | + rightDerivedNatTrans RF RF' α α' W τ ≫ rightDerivedNatTrans RF' RF'' α' α'' W τ' = |
| 125 | + rightDerivedNatTrans RF RF'' α α'' W (τ ≫ τ') := |
| 126 | + rightDerived_ext RF α W _ _ _ (by aesop_cat) |
| 127 | + |
| 128 | +/-- The natural isomorphism `RF ≅ RF'` on right derived functors that is |
| 129 | +induced by a natural isomorphism `F ≅ F'`. -/ |
| 130 | +@[simps] |
| 131 | +noncomputable def rightDerivedNatIso (τ : F ≅ F') : |
| 132 | + RF ≅ RF' where |
| 133 | + hom := rightDerivedNatTrans RF RF' α α' W τ.hom |
| 134 | + inv := rightDerivedNatTrans RF' RF α' α W τ.inv |
| 135 | + |
| 136 | +/-- Uniqueness (up to a natural isomorphism) of the right derived functor. -/ |
| 137 | +noncomputable abbrev rightDerivedUnique [RF'.IsRightDerivedFunctor α'₂ W] : RF ≅ RF' := |
| 138 | + rightDerivedNatIso RF RF' α α'₂ W (Iso.refl F) |
| 139 | + |
| 140 | +lemma isRightDerivedFunctor_iff_isIso_rightDerivedDesc (G : D ⥤ H) (β : F ⟶ L ⋙ G) : |
| 141 | + G.IsRightDerivedFunctor β W ↔ IsIso (RF.rightDerivedDesc α W G β) := by |
| 142 | + rw [isRightDerivedFunctor_iff_isLeftKanExtension] |
| 143 | + have := IsRightDerivedFunctor.isLeftKanExtension _ α W |
| 144 | + exact isLeftKanExtension_iff_isIso _ α _ (by simp) |
| 145 | + |
| 146 | +end |
| 147 | + |
| 148 | +variable (F) |
| 149 | + |
| 150 | +/-- A functor `F : C ⥤ H` has a right derived functor with respect to |
| 151 | +`W : MorphismProperty C` if it has a left Kan extension along |
| 152 | +`W.Q : C ⥤ W.Localization` (or any localization functor `L : C ⥤ D` |
| 153 | +for `W`, see `hasRightDerivedFunctor_iff`). -/ |
| 154 | +class HasRightDerivedFunctor : Prop where |
| 155 | + hasLeftKanExtension' : HasLeftKanExtension W.Q F |
| 156 | + |
| 157 | +variable (L) |
| 158 | +variable [L.IsLocalization W] |
| 159 | + |
| 160 | +lemma hasRightDerivedFunctor_iff : |
| 161 | + F.HasRightDerivedFunctor W ↔ HasLeftKanExtension L F := by |
| 162 | + have : HasRightDerivedFunctor F W ↔ HasLeftKanExtension W.Q F := |
| 163 | + ⟨fun h => h.hasLeftKanExtension', fun h => ⟨h⟩⟩ |
| 164 | + rw [this, hasLeftExtension_iff_postcomp₁ (Localization.compUniqFunctor W.Q L W) F] |
| 165 | + |
| 166 | +variable {F} |
| 167 | + |
| 168 | +lemma hasRightDerivedFunctor_iff_of_iso : |
| 169 | + HasRightDerivedFunctor F W ↔ HasRightDerivedFunctor F' W := by |
| 170 | + rw [hasRightDerivedFunctor_iff F W.Q W, hasRightDerivedFunctor_iff F' W.Q W, |
| 171 | + hasLeftExtension_iff_of_iso₂ W.Q e] |
| 172 | + |
| 173 | +variable (F) |
| 174 | + |
| 175 | +lemma HasRightDerivedFunctor.hasLeftKanExtension [HasRightDerivedFunctor F W] : |
| 176 | + HasLeftKanExtension L F := by |
| 177 | + simpa only [← hasRightDerivedFunctor_iff F L W] |
| 178 | + |
| 179 | +variable {F L W} |
| 180 | + |
| 181 | +lemma HasRightDerivedFunctor.mk' [RF.IsRightDerivedFunctor α W] : |
| 182 | + HasRightDerivedFunctor F W := by |
| 183 | + have := IsRightDerivedFunctor.isLeftKanExtension RF α W |
| 184 | + simpa only [hasRightDerivedFunctor_iff F L W] using HasLeftKanExtension.mk RF α |
| 185 | + |
| 186 | +section |
| 187 | + |
| 188 | +variable [F.HasRightDerivedFunctor W] (L W) |
| 189 | + |
| 190 | +/-- Given a functor `F : C ⥤ H`, and a localization functor `L : D ⥤ H` for `W`, |
| 191 | +this is the right derived functor `D ⥤ H` of `F`, i.e. the left Kan extension |
| 192 | +of `F` along `L`. -/ |
| 193 | +noncomputable def totalRightDerived : D ⥤ H := |
| 194 | + have := HasRightDerivedFunctor.hasLeftKanExtension F L W |
| 195 | + leftKanExtension L F |
| 196 | + |
| 197 | +/-- The canonical natural transformation `F ⟶ L ⋙ F.totalRightDerived L W`. -/ |
| 198 | +noncomputable def totalRightDerivedUnit : F ⟶ L ⋙ F.totalRightDerived L W := |
| 199 | + have := HasRightDerivedFunctor.hasLeftKanExtension F L W |
| 200 | + leftKanExtensionUnit L F |
| 201 | + |
| 202 | +instance : (F.totalRightDerived L W).IsRightDerivedFunctor |
| 203 | + (F.totalRightDerivedUnit L W) W where |
| 204 | + isLeftKanExtension' := by |
| 205 | + dsimp [totalRightDerived, totalRightDerivedUnit] |
| 206 | + infer_instance |
| 207 | + |
| 208 | +end |
| 209 | + |
| 210 | +end Functor |
| 211 | + |
| 212 | +end CategoryTheory |
0 commit comments