|
| 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.Category.ModuleCat.Presheaf.Abelian |
| 7 | +import Mathlib.Algebra.Category.ModuleCat.Presheaf.EpiMono |
| 8 | +import Mathlib.Algebra.Category.ModuleCat.Presheaf.Free |
| 9 | +import Mathlib.Algebra.Homology.ShortComplex.Exact |
| 10 | +import Mathlib.CategoryTheory.Elements |
| 11 | +import Mathlib.CategoryTheory.Generator |
| 12 | + |
| 13 | +/-! |
| 14 | +# Generators for the category of presheaves of modules |
| 15 | +
|
| 16 | +In this file, given a presheaf of rings `R` on a category `C`, |
| 17 | +we study the set `freeYoneda R` of presheaves of modules |
| 18 | +of form `(free R).obj (yoneda.obj X)` for `X : C`, i.e. |
| 19 | +free presheaves of modules generated by the Yoneda |
| 20 | +presheaf represented by some `X : C` (the functor |
| 21 | +represented by such a presheaf of modules is the evaluation |
| 22 | +functor `M ↦ M.obj (op X)`, see `freeYonedaEquiv`). |
| 23 | +
|
| 24 | +Lemmas `PresheafOfModules.freeYoneda.isSeparating` and |
| 25 | +`PresheafOfModules.freeYoneda.isDetecting` assert that this |
| 26 | +set `freeYoneda R` is separating and detecting. |
| 27 | +We deduce that if `C : Type u` is a small category, |
| 28 | +and `R : Cᵒᵖ ⥤ RingCat.{u}`, then `PresheafOfModules.{u} R` |
| 29 | +is a well-powered category. |
| 30 | +
|
| 31 | +Finally, given `M : PresheafOfModules.{u} R`, we consider |
| 32 | +the canonical epimorphism of presheaves of modules |
| 33 | +`M.fromFreeYonedaCoproduct : M.freeYonedaCoproduct ⟶ M` |
| 34 | +where `M.freeYonedaCoproduct` is a coproduct indexed |
| 35 | +by elements of `M`, i.e. pairs `⟨X : Cᵒᵖ, a : M.obj X⟩`, |
| 36 | +of the objects `(free R).obj (yoneda.obj X.unop)`. |
| 37 | +This is used in the definition |
| 38 | +`PresheafOfModules.isColimitFreeYonedaCoproductsCokernelCofork` |
| 39 | +in order to obtain that any presheaf of modules is a cokernel |
| 40 | +of a morphism between coproducts of objects in `freeYoneda R`. |
| 41 | +
|
| 42 | +-/ |
| 43 | + |
| 44 | +universe v v₁ u u₁ |
| 45 | + |
| 46 | +open CategoryTheory Limits |
| 47 | + |
| 48 | +namespace PresheafOfModules |
| 49 | + |
| 50 | +variable {C : Type u} [Category.{v} C] {R : Cᵒᵖ ⥤ RingCat.{v}} |
| 51 | + |
| 52 | +/-- When `R : Cᵒᵖ ⥤ RingCat`, `M : PresheafOfModules R`, and `X : C`, this is the |
| 53 | +bijection `((free R).obj (yoneda.obj X) ⟶ M) ≃ M.obj (Opposite.op X)`. -/ |
| 54 | +noncomputable def freeYonedaEquiv {M : PresheafOfModules.{v} R} {X : C} : |
| 55 | + ((free R).obj (yoneda.obj X) ⟶ M) ≃ M.obj (Opposite.op X) := |
| 56 | + freeHomEquiv.trans yonedaEquiv |
| 57 | + |
| 58 | +lemma freeYonedaEquiv_symm_app (M : PresheafOfModules.{v} R) (X : C) |
| 59 | + (x : M.obj (Opposite.op X)) : |
| 60 | + (freeYonedaEquiv.symm x).app (Opposite.op X) (ModuleCat.freeMk (𝟙 _)) = x := by |
| 61 | + dsimp [freeYonedaEquiv, freeHomEquiv, yonedaEquiv] |
| 62 | + rw [ModuleCat.freeDesc_apply, op_id, M.presheaf.map_id] |
| 63 | + rfl |
| 64 | + |
| 65 | +lemma freeYonedaEquiv_comp {M N : PresheafOfModules.{v} R} {X : C} |
| 66 | + (m : ((free R).obj (yoneda.obj X) ⟶ M)) (φ : M ⟶ N) : |
| 67 | + freeYonedaEquiv (m ≫ φ) = φ.app _ (freeYonedaEquiv m) := rfl |
| 68 | + |
| 69 | +variable (R) in |
| 70 | +/-- The set of `PresheafOfModules.{v} R` consisting of objects of the |
| 71 | +form `(free R).obj (yoneda.obj X)` for some `X`. -/ |
| 72 | +def freeYoneda : Set (PresheafOfModules.{v} R) := Set.range (yoneda ⋙ free R).obj |
| 73 | + |
| 74 | +namespace freeYoneda |
| 75 | + |
| 76 | +instance : Small.{u} (freeYoneda R) := by |
| 77 | + let π : C → freeYoneda R := fun X ↦ ⟨_, ⟨X, rfl⟩⟩ |
| 78 | + have hπ : Function.Surjective π := by rintro ⟨_, ⟨X, rfl⟩⟩; exact ⟨X, rfl⟩ |
| 79 | + exact small_of_surjective hπ |
| 80 | + |
| 81 | +variable (R) |
| 82 | + |
| 83 | +lemma isSeparating : IsSeparating (freeYoneda R) := by |
| 84 | + intro M N f₁ f₂ h |
| 85 | + ext ⟨X⟩ m |
| 86 | + obtain ⟨g, rfl⟩ := freeYonedaEquiv.surjective m |
| 87 | + exact congr_arg freeYonedaEquiv (h _ ⟨X, rfl⟩ g) |
| 88 | + |
| 89 | +lemma isDetecting : IsDetecting (freeYoneda R) := |
| 90 | + (isSeparating R).isDetecting |
| 91 | + |
| 92 | +end freeYoneda |
| 93 | + |
| 94 | +instance wellPowered {C₀ : Type u} [SmallCategory C₀] (R₀ : C₀ᵒᵖ ⥤ RingCat.{u}) : |
| 95 | + WellPowered (PresheafOfModules.{u} R₀) := |
| 96 | + wellPowered_of_isDetecting (freeYoneda.isDetecting R₀) |
| 97 | + |
| 98 | +/-- The type of elements of a presheaf of modules. A term of this type is a pair |
| 99 | +`⟨X, a⟩` with `X : Cᵒᵖ` and `a : M.obj X`. -/ |
| 100 | +abbrev Elements {C : Type u₁} [Category.{v₁} C] {R : Cᵒᵖ ⥤ RingCat.{u}} |
| 101 | + (M : PresheafOfModules.{v} R) := ((toPresheaf R).obj M ⋙ forget Ab).Elements |
| 102 | + |
| 103 | +/-- Given a presheaf of modules `M`, this is a constructor for the type `M.Elements`. -/ |
| 104 | +abbrev elementsMk {C : Type u₁} [Category.{v₁} C] {R : Cᵒᵖ ⥤ RingCat.{u}} |
| 105 | + (M : PresheafOfModules.{v} R) (X : Cᵒᵖ) (x : M.obj X) : M.Elements := |
| 106 | + Functor.elementsMk _ X x |
| 107 | + |
| 108 | +namespace Elements |
| 109 | + |
| 110 | +variable {C : Type u} [Category.{v} C] {R : Cᵒᵖ ⥤ RingCat.{v}} {M : PresheafOfModules.{v} R} |
| 111 | + |
| 112 | +/-- Given an element `m : M.Elements` of a presheaf of modules `M`, this is the |
| 113 | +free presheaf of modules on the Yoneda presheaf of types corresponding to the |
| 114 | +underlying object of `m`. -/ |
| 115 | +noncomputable abbrev freeYoneda (m : M.Elements) : |
| 116 | + PresheafOfModules.{v} R := (free R).obj (yoneda.obj m.1.unop) |
| 117 | + |
| 118 | +/-- Given an element `m : M.Elements` of a presheaf of modules `M`, this is |
| 119 | +the canonical morphism `m.freeYoneda ⟶ M`. -/ |
| 120 | +noncomputable abbrev fromFreeYoneda (m : M.Elements) : |
| 121 | + m.freeYoneda ⟶ M := |
| 122 | + freeYonedaEquiv.symm m.2 |
| 123 | + |
| 124 | +lemma fromFreeYoneda_app_apply (m : M.Elements) : |
| 125 | + m.fromFreeYoneda.app m.1 (ModuleCat.freeMk (𝟙 _)) = m.2 := by |
| 126 | + apply freeYonedaEquiv_symm_app |
| 127 | + |
| 128 | +end Elements |
| 129 | + |
| 130 | +section |
| 131 | + |
| 132 | +variable {C : Type u} [SmallCategory.{u} C] {R : Cᵒᵖ ⥤ RingCat.{u}} (M : PresheafOfModules.{u} R) |
| 133 | + |
| 134 | +/-- Given a presheaf of modules `M`, this is the coproduct of |
| 135 | +all free Yoneda presheaves `m.freeYoneda` for all `m : M.Elements`. -/ |
| 136 | +noncomputable abbrev freeYonedaCoproduct : PresheafOfModules.{u} R := |
| 137 | + ∐ (Elements.freeYoneda (M := M)) |
| 138 | + |
| 139 | +/-- Given an element `m : M.Elements` of a presheaf of modules `M`, this is the |
| 140 | +canonical inclusion `m.freeYoneda ⟶ M.freeYonedaCoproduct`. -/ |
| 141 | +noncomputable abbrev ιFreeYonedaCoproduct (m : M.Elements) : |
| 142 | + m.freeYoneda ⟶ M.freeYonedaCoproduct := |
| 143 | + Sigma.ι _ m |
| 144 | + |
| 145 | +/-- Given a presheaf of modules `M`, this is the |
| 146 | +canonical morphism `M.freeYonedaCoproduct ⟶ M`. -/ |
| 147 | +noncomputable def fromFreeYonedaCoproduct : |
| 148 | + M.freeYonedaCoproduct ⟶ M := |
| 149 | + Sigma.desc Elements.fromFreeYoneda |
| 150 | + |
| 151 | +/-- Given an element `m` of a presheaf of modules `M`, this is the associated |
| 152 | +canonical section of the presheaf `M.freeYonedaCoproduct` over the object `m.1`. -/ |
| 153 | +noncomputable def freeYonedaCoproductMk (m : M.Elements) : |
| 154 | + M.freeYonedaCoproduct.obj m.1 := |
| 155 | + (M.ιFreeYonedaCoproduct m).app _ (ModuleCat.freeMk (𝟙 _)) |
| 156 | + |
| 157 | +@[reassoc (attr := simp)] |
| 158 | +lemma ι_fromFreeYonedaCoproduct (m : M.Elements) : |
| 159 | + M.ιFreeYonedaCoproduct m ≫ M.fromFreeYonedaCoproduct = m.fromFreeYoneda := by |
| 160 | + apply Sigma.ι_desc |
| 161 | + |
| 162 | +lemma ι_fromFreeYonedaCoproduct_apply (m : M.Elements) (X : Cᵒᵖ) (x : m.freeYoneda.obj X) : |
| 163 | + M.fromFreeYonedaCoproduct.app X ((M.ιFreeYonedaCoproduct m).app X x) = |
| 164 | + m.fromFreeYoneda.app X x := |
| 165 | + congr_fun ((evaluation R X ⋙ forget _).congr_map (M.ι_fromFreeYonedaCoproduct m)) x |
| 166 | + |
| 167 | +@[simp] |
| 168 | +lemma fromFreeYonedaCoproduct_app_mk (m : M.Elements) : |
| 169 | + M.fromFreeYonedaCoproduct.app _ (M.freeYonedaCoproductMk m) = m.2 := by |
| 170 | + dsimp [freeYonedaCoproductMk] |
| 171 | + erw [M.ι_fromFreeYonedaCoproduct_apply m] |
| 172 | + rw [m.fromFreeYoneda_app_apply] |
| 173 | + |
| 174 | +instance : Epi M.fromFreeYonedaCoproduct := |
| 175 | + epi_of_surjective (fun X m ↦ ⟨M.freeYonedaCoproductMk (M.elementsMk X m), |
| 176 | + M.fromFreeYonedaCoproduct_app_mk (M.elementsMk X m)⟩) |
| 177 | + |
| 178 | +/-- Given a presheaf of modules `M`, this is a morphism between coproducts |
| 179 | +of free presheaves of modules on Yoneda presheaves which gives a presentation |
| 180 | +of the module `M`, see `isColimitFreeYonedaCoproductsCokernelCofork`. -/ |
| 181 | +noncomputable def toFreeYonedaCoproduct : |
| 182 | + (kernel M.fromFreeYonedaCoproduct).freeYonedaCoproduct ⟶ M.freeYonedaCoproduct := |
| 183 | + (kernel M.fromFreeYonedaCoproduct).fromFreeYonedaCoproduct ≫ kernel.ι _ |
| 184 | + |
| 185 | +@[reassoc (attr := simp)] |
| 186 | +lemma toFreeYonedaCoproduct_fromFreeYonedaCoproduct : |
| 187 | + M.toFreeYonedaCoproduct ≫ M.fromFreeYonedaCoproduct = 0 := by |
| 188 | + simp [toFreeYonedaCoproduct] |
| 189 | + |
| 190 | +/-- (Colimit) cofork which gives a presentation of a presheaf of modules `M` using |
| 191 | +coproducts of free presheaves of modules on Yoneda presheaves. -/ |
| 192 | +noncomputable abbrev freeYonedaCoproductsCokernelCofork : |
| 193 | + CokernelCofork M.toFreeYonedaCoproduct := |
| 194 | + CokernelCofork.ofπ _ M.toFreeYonedaCoproduct_fromFreeYonedaCoproduct |
| 195 | + |
| 196 | +/-- If `M` is a presheaf of modules, the cokernel cofork |
| 197 | +`M.freeYonedaCoproductsCokernelCofork` is a colimit, which means that |
| 198 | +`M` can be expressed as a cokernel of the morphism `M.toFreeYonedaCoproduct` |
| 199 | +between coproducts of free presheaves of modules on Yoneda presheaves. -/ |
| 200 | +noncomputable def isColimitFreeYonedaCoproductsCokernelCofork : |
| 201 | + IsColimit M.freeYonedaCoproductsCokernelCofork := by |
| 202 | + let S := ShortComplex.mk _ _ M.toFreeYonedaCoproduct_fromFreeYonedaCoproduct |
| 203 | + let T := ShortComplex.mk _ _ (kernel.condition M.fromFreeYonedaCoproduct) |
| 204 | + let φ : S ⟶ T := |
| 205 | + { τ₁ := fromFreeYonedaCoproduct _ |
| 206 | + τ₂ := 𝟙 _ |
| 207 | + τ₃ := 𝟙 _ } |
| 208 | + exact ((ShortComplex.exact_iff_of_epi_of_isIso_of_mono φ).2 |
| 209 | + (T.exact_of_f_is_kernel (kernelIsKernel _))).gIsCokernel |
| 210 | + |
| 211 | +end |
| 212 | + |
| 213 | +end PresheafOfModules |
0 commit comments