|
| 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.Algebra.Homology.HomotopyCategory.HomologicalFunctor |
| 7 | +import Mathlib.Algebra.Homology.HomotopyCategory.ShiftSequence |
| 8 | +import Mathlib.Algebra.Homology.HomotopyCategory.Triangulated |
| 9 | +import Mathlib.Algebra.Homology.Localization |
| 10 | + |
| 11 | +/-! # The derived category of an abelian category |
| 12 | +
|
| 13 | +In this file, we construct the derived category `DerivedCategory C` of an |
| 14 | +abelian category `C`. It is equipped with a triangulated structure. |
| 15 | +
|
| 16 | +The derived category is defined here as the localization of cochain complexes |
| 17 | +indexed by `ℤ` with respect to quasi-isomorphisms: it is a type synonym of |
| 18 | +`HomologicalComplexUpToQuasiIso C (ComplexShape.up ℤ)`. Then, we have a |
| 19 | +localization functor `DerivedCategory.Q : CochainComplex C ℤ ⥤ DerivedCategory C`. |
| 20 | +It was already shown in the file `Algebra.Homology.Localization` that the induced |
| 21 | +functor `DerivedCategory.Qh : HomotopyCategory C (ComplexShape.up ℤ) ⥤ DerivedCategory C` |
| 22 | +is a localization functor with respect to the class of morphisms |
| 23 | +`HomotopyCategory.quasiIso C (ComplexShape.up ℤ)`. In the lemma |
| 24 | +`HomotopyCategory.quasiIso_eq_subcategoryAcyclic_W` we obtain that this class of morphisms |
| 25 | +consists of morphisms whose cone belongs to the triangulated subcategory |
| 26 | +`HomotopyCategory.subcategoryAcyclic C` of acyclic complexes. Then, the triangulated |
| 27 | +structure on `DerivedCategory C` is deduced from the triangulated structure |
| 28 | +on the homotopy category (see file `Algebra.Homology.HomotopyCategory.Triangulated`) |
| 29 | +using the localization theorem for triangulated categories which was obtained |
| 30 | +in the file `CategoryTheory.Localization.Triangulated`. |
| 31 | +
|
| 32 | +## Implementation notes |
| 33 | +
|
| 34 | +If `C : Type u` and `Category.{v} C`, the constructed localized category of cochain |
| 35 | +complexes with respect to quasi-isomorphisms has morphisms in `Type (max u v)`. |
| 36 | +However, in certain circumstances, it shall be possible to prove that they are `v`-small |
| 37 | +(when `C` is a Grothendieck abelian category (e.g. the category of modules over a ring), |
| 38 | +it should be so by a theorem of Hovey.). |
| 39 | +
|
| 40 | +Then, when working with derived categories in mathlib, the user should add the variable |
| 41 | +`[HasDerivedCategory.{w} C]` which is the assumption that there is a chosen derived |
| 42 | +category with morphisms in `Type w`. When derived categories are used in order to |
| 43 | +prove statements which do not involve derived categories, the `HasDerivedCategory.{max u v}` |
| 44 | +instance should be obtained at the beginning of the proof, using the term |
| 45 | +`HasDerivedCategory.standard C`. |
| 46 | +
|
| 47 | +## TODO (@joelriou) |
| 48 | +
|
| 49 | +- define the induced homological functor `DerivedCategory C ⥤ C`. |
| 50 | +- construct the distinguished triangle associated to a short exact sequence |
| 51 | +of cochain complexes, and compare the associated connecting homomorphism |
| 52 | +with the one defined in `Algebra.Homology.HomologySequence`. |
| 53 | +- refactor the definition of Ext groups using morphisms in the derived category |
| 54 | +(which may be shrunk to the universe `v` at least when `C` has enough projectives |
| 55 | +or enough injectives). |
| 56 | +
|
| 57 | +## References |
| 58 | +* [Jean-Louis Verdier, *Des catégories dérivées des catégories abéliennes*][verdier1996] |
| 59 | +* [Mark Hovey, *Model category structures on chain complexes of sheaves*][hovey-2001] |
| 60 | +
|
| 61 | +-/ |
| 62 | + |
| 63 | +universe w v u |
| 64 | + |
| 65 | +open CategoryTheory Limits |
| 66 | + |
| 67 | +variable (C : Type u) [Category.{v} C] [Abelian C] |
| 68 | + |
| 69 | +namespace HomotopyCategory |
| 70 | + |
| 71 | +/-- The triangulated subcategory of `HomotopyCategory C (ComplexShape.up ℤ)` consisting |
| 72 | +of acyclic complexes. -/ |
| 73 | +def subcategoryAcyclic : Triangulated.Subcategory (HomotopyCategory C (ComplexShape.up ℤ)) := |
| 74 | + (homologyFunctor C (ComplexShape.up ℤ) 0).homologicalKernel |
| 75 | + |
| 76 | +instance : ClosedUnderIsomorphisms (subcategoryAcyclic C).P := by |
| 77 | + dsimp [subcategoryAcyclic] |
| 78 | + infer_instance |
| 79 | + |
| 80 | +variable {C} |
| 81 | + |
| 82 | +lemma mem_subcategoryAcyclic_iff (X : HomotopyCategory C (ComplexShape.up ℤ)) : |
| 83 | + (subcategoryAcyclic C).P X ↔ ∀ (n : ℤ), IsZero ((homologyFunctor _ _ n).obj X) := |
| 84 | + Functor.mem_homologicalKernel_iff _ X |
| 85 | + |
| 86 | +lemma quotient_obj_mem_subcategoryAcyclic_iff_exactAt (K : CochainComplex C ℤ) : |
| 87 | + (subcategoryAcyclic C).P ((quotient _ _).obj K) ↔ ∀ (n : ℤ), K.ExactAt n := by |
| 88 | + rw [mem_subcategoryAcyclic_iff] |
| 89 | + refine forall_congr' (fun n => ?_) |
| 90 | + simp only [HomologicalComplex.exactAt_iff_isZero_homology] |
| 91 | + exact ((homologyFunctorFactors C (ComplexShape.up ℤ) n).app K).isZero_iff |
| 92 | + |
| 93 | +variable (C) |
| 94 | + |
| 95 | +lemma quasiIso_eq_subcategoryAcyclic_W : |
| 96 | + quasiIso C (ComplexShape.up ℤ) = (subcategoryAcyclic C).W := by |
| 97 | + ext K L f |
| 98 | + exact ((homologyFunctor C (ComplexShape.up ℤ) 0).mem_homologicalKernel_W_iff f).symm |
| 99 | + |
| 100 | +end HomotopyCategory |
| 101 | + |
| 102 | +/-- The assumption that a localized category for |
| 103 | +`(HomologicalComplex.quasiIso C (ComplexShape.up ℤ))` has been chosen, and that the morphisms |
| 104 | +in this chosen category are in `Type w`. -/ |
| 105 | +abbrev HasDerivedCategory := MorphismProperty.HasLocalization.{w} |
| 106 | + (HomologicalComplex.quasiIso C (ComplexShape.up ℤ)) |
| 107 | + |
| 108 | +/-- The derived category obtained using the constructed localized category of cochain complexes |
| 109 | +with respect to quasi-isomorphisms. This should be used only while proving statements |
| 110 | +which do not involve the derived category. -/ |
| 111 | +def HasDerivedCategory.standard : HasDerivedCategory.{max u v} C := |
| 112 | + MorphismProperty.HasLocalization.standard _ |
| 113 | + |
| 114 | +variable [HasDerivedCategory.{w} C] |
| 115 | + |
| 116 | +/-- The derived category of an abelian category. -/ |
| 117 | +def DerivedCategory : Type (max u v) := HomologicalComplexUpToQuasiIso C (ComplexShape.up ℤ) |
| 118 | + |
| 119 | +namespace DerivedCategory |
| 120 | + |
| 121 | +instance : Category.{w} (DerivedCategory C) := by |
| 122 | + dsimp [DerivedCategory] |
| 123 | + infer_instance |
| 124 | + |
| 125 | +variable {C} |
| 126 | + |
| 127 | +/-- The localization functor `CochainComplex C ℤ ⥤ DerivedCategory C`. -/ |
| 128 | +def Q : CochainComplex C ℤ ⥤ DerivedCategory C := HomologicalComplexUpToQuasiIso.Q |
| 129 | + |
| 130 | +instance : (Q (C := C)).IsLocalization |
| 131 | + (HomologicalComplex.quasiIso C (ComplexShape.up ℤ)) := by |
| 132 | + dsimp only [Q, DerivedCategory] |
| 133 | + infer_instance |
| 134 | + |
| 135 | +/-- The localization functor `HomotopyCategory C (ComplexShape.up ℤ) ⥤ DerivedCategory C`. -/ |
| 136 | +def Qh : HomotopyCategory C (ComplexShape.up ℤ) ⥤ DerivedCategory C := |
| 137 | + HomologicalComplexUpToQuasiIso.Qh |
| 138 | + |
| 139 | +variable (C) |
| 140 | + |
| 141 | +/-- The natural isomorphism `HomotopyCategory.quotient C (ComplexShape.up ℤ) ⋙ Qh ≅ Q`. -/ |
| 142 | +def quotientCompQhIso : HomotopyCategory.quotient C (ComplexShape.up ℤ) ⋙ Qh ≅ Q := |
| 143 | + HomologicalComplexUpToQuasiIso.quotientCompQhIso C (ComplexShape.up ℤ) |
| 144 | + |
| 145 | +instance : Qh.IsLocalization (HomotopyCategory.quasiIso C (ComplexShape.up ℤ)) := by |
| 146 | + dsimp [Qh, DerivedCategory] |
| 147 | + infer_instance |
| 148 | + |
| 149 | +instance : Qh.IsLocalization (HomotopyCategory.subcategoryAcyclic C).W := by |
| 150 | + rw [← HomotopyCategory.quasiIso_eq_subcategoryAcyclic_W] |
| 151 | + infer_instance |
| 152 | + |
| 153 | +noncomputable instance : Preadditive (DerivedCategory C) := |
| 154 | + Localization.preadditive Qh (HomotopyCategory.subcategoryAcyclic C).W |
| 155 | + |
| 156 | +instance : (Qh (C := C)).Additive := |
| 157 | + Localization.functor_additive Qh (HomotopyCategory.subcategoryAcyclic C).W |
| 158 | + |
| 159 | +instance : (Q (C := C)).Additive := |
| 160 | + Functor.additive_of_iso (quotientCompQhIso C) |
| 161 | + |
| 162 | +noncomputable instance : HasZeroObject (DerivedCategory C) := |
| 163 | + Q.hasZeroObject_of_additive |
| 164 | + |
| 165 | +noncomputable instance : HasShift (DerivedCategory C) ℤ := |
| 166 | + HasShift.localized Qh (HomotopyCategory.subcategoryAcyclic C).W ℤ |
| 167 | + |
| 168 | +noncomputable instance : (Qh (C := C)).CommShift ℤ := |
| 169 | + Functor.CommShift.localized Qh (HomotopyCategory.subcategoryAcyclic C).W ℤ |
| 170 | + |
| 171 | +instance (n : ℤ) : (shiftFunctor (DerivedCategory C) n).Additive := by |
| 172 | + rw [Localization.functor_additive_iff |
| 173 | + Qh (HomotopyCategory.subcategoryAcyclic C).W] |
| 174 | + exact Functor.additive_of_iso (Qh.commShiftIso n) |
| 175 | + |
| 176 | +noncomputable instance : Pretriangulated (DerivedCategory C) := |
| 177 | + Triangulated.Localization.pretriangulated |
| 178 | + Qh (HomotopyCategory.subcategoryAcyclic C).W |
| 179 | + |
| 180 | +instance : (Qh (C := C)).IsTriangulated := |
| 181 | + Triangulated.Localization.isTriangulated_functor |
| 182 | + Qh (HomotopyCategory.subcategoryAcyclic C).W |
| 183 | + |
| 184 | +noncomputable instance : IsTriangulated (DerivedCategory C) := |
| 185 | + Triangulated.Localization.isTriangulated |
| 186 | + Qh (HomotopyCategory.subcategoryAcyclic C).W |
| 187 | + |
| 188 | +end DerivedCategory |
0 commit comments