Skip to content

Commit

Permalink
feat(CategoryTheory): more universe polymorphism for limits in sheaf …
Browse files Browse the repository at this point in the history
…categories (#12222)

We prove that sheaf categories have limits and colimits of the same size as the target category. Before, the universe levels were too restrictive. We change the construction of the colimit: it now uses the formal properties of sheafification instead of an explicit construction.
  • Loading branch information
dagurtomas committed Apr 18, 2024
1 parent fa2a388 commit f83fe2f
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 84 deletions.
30 changes: 5 additions & 25 deletions Mathlib/CategoryTheory/Sites/Abelian.lean
Expand Up @@ -5,9 +5,8 @@ Authors: Adam Topaz, Jujian Zhang
-/
import Mathlib.CategoryTheory.Abelian.FunctorCategory
import Mathlib.CategoryTheory.Preadditive.AdditiveFunctor
import Mathlib.CategoryTheory.Preadditive.FunctorCategory
import Mathlib.CategoryTheory.Abelian.Transfer
import Mathlib.CategoryTheory.Sites.LeftExact
import Mathlib.CategoryTheory.Sites.Limits

#align_import topology.sheaves.abelian from "leanprover-community/mathlib"@"ac3ae212f394f508df43e37aa093722fa9b65d31"

Expand All @@ -29,33 +28,14 @@ open CategoryTheory.Limits

section Abelian

universe w v u
universe w' w v u

-- Porting note: `C` was `Type (max v u)`, but making it more universe polymorphic
-- solves some problems
variable {C : Type u} [Category.{v} C]
variable {D : Type w} [Category.{max v u} D] [Abelian D]
variable {D : Type w} [Category.{w'} D] [Abelian D]
variable {J : GrothendieckTopology C}
variable [HasSheafify J D] [HasFiniteLimits D]

-- Porting note: this `Abelian` instance is no longer necessary,
-- maybe because I have made `C` more universe polymorphic
--
-- This needs to be specified manually because of universe level.
--instance : Abelian (Cᵒᵖ ⥤ D) :=
-- @Abelian.functorCategoryAbelian Cᵒᵖ _ D _ _

-- This also needs to be specified manually, but I don't know why.
instance hasFiniteProductsSheaf : HasFiniteProducts (Sheaf J D) where
out j := { has_limit := fun F => by infer_instance }

-- sheafification assumptions
variable [∀ (P : Cᵒᵖ ⥤ D) (X : C) (S : J.Cover X), HasMultiequalizer (S.index P)]
variable [∀ X : C, HasColimitsOfShape (J.Cover X)ᵒᵖ D]
variable [ConcreteCategory.{max v u} D] [PreservesLimits (forget D)]
variable [∀ X : C, PreservesColimitsOfShape (J.Cover X)ᵒᵖ (forget D)]
variable [(forget D).ReflectsIsomorphisms]

instance sheafIsAbelian [HasFiniteLimits D] : Abelian (Sheaf J D) :=
instance sheafIsAbelian : Abelian (Sheaf J D) :=
let adj := sheafificationAdjunction J D
abelianOfAdjunction _ _ (asIso adj.counit) adj
set_option linter.uppercaseLean3 false in
Expand Down
5 changes: 1 addition & 4 deletions Mathlib/CategoryTheory/Sites/LeftExact.lean
Expand Up @@ -4,10 +4,9 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Adam Topaz
-/
import Mathlib.CategoryTheory.Sites.Limits
import Mathlib.CategoryTheory.Limits.FunctorCategory
import Mathlib.CategoryTheory.Limits.FilteredColimitCommutesFiniteLimit
import Mathlib.CategoryTheory.Adhesive
import Mathlib.CategoryTheory.Sites.Sheafification
import Mathlib.CategoryTheory.Sites.ConcreteSheafification

#align_import category_theory.sites.left_exact from "leanprover-community/mathlib"@"59382264386afdbaf1727e617f5fdda511992eb9"

Expand All @@ -21,8 +20,6 @@ open CategoryTheory Limits Opposite

universe w' w v u

-- Porting note: was `C : Type max v u` which made most instances non automatically applicable
-- it seems to me it is better to declare `C : Type u`: it works better, and it is more general
variable {C : Type u} [Category.{v} C] {J : GrothendieckTopology C}
variable {D : Type w} [Category.{max v u} D]
variable [∀ (P : Cᵒᵖ ⥤ D) (X : C) (S : J.Cover X), HasMultiequalizer (S.index P)]
Expand Down
79 changes: 31 additions & 48 deletions Mathlib/CategoryTheory/Sites/Limits.lean
Expand Up @@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Adam Topaz
-/
import Mathlib.CategoryTheory.Limits.Creates
import Mathlib.CategoryTheory.Sites.ConcreteSheafification
import Mathlib.CategoryTheory.Sites.Sheafification
import Mathlib.CategoryTheory.Limits.Shapes.FiniteProducts

#align_import category_theory.sites.limits from "leanprover-community/mathlib"@"95e83ced9542828815f53a1096a4d373c1b08a77"
Expand Down Expand Up @@ -38,14 +38,14 @@ open CategoryTheory.Limits

open Opposite

section Limits

universe w v u z z'
universe w w' v u z z' u₁ u₂

variable {C : Type u} [Category.{v} C] {J : GrothendieckTopology C}
variable {D : Type w} [Category.{max v u} D]
variable {D : Type w} [Category.{w'} D]
variable {K : Type z} [Category.{z'} K]

section Limits

noncomputable section

section
Expand Down Expand Up @@ -168,71 +168,47 @@ instance : HasLimitsOfShape K (Sheaf J D) :=
instance [HasFiniteProducts D] : HasFiniteProducts (Sheaf J D) :=
⟨inferInstance⟩

instance [HasFiniteLimits D] : HasFiniteLimits (Sheaf J D) :=
fun _ ↦ inferInstance⟩

end

instance createsLimits [HasLimits D] : CreatesLimits (sheafToPresheaf J D) :=
instance createsLimits [HasLimitsOfSize.{u₁, u₂} D] :
CreatesLimitsOfSize.{u₁, u₂} (sheafToPresheaf J D) :=
⟨createsLimitsOfShape⟩

instance [HasLimits D] : HasLimits (Sheaf J D) :=
instance hasLimitsOfSize [HasLimitsOfSize.{u₁, u₂} D] : HasLimitsOfSize.{u₁, u₂} (Sheaf J D) :=
hasLimits_of_hasLimits_createsLimits (sheafToPresheaf J D)

variable {D : Type w} [Category.{max v u} D]

example [HasLimits D] : HasLimits (Sheaf J D) := inferInstance

end

end Limits

section Colimits

universe w v u z z'

variable {C : Type u} [Category.{v} C] {J : GrothendieckTopology C}
variable {D : Type w} [Category.{max v u} D]
variable {K : Type z} [Category.{z'} K]

-- Now we need a handful of instances to obtain sheafification...
variable [ConcreteCategory.{max v u} D]
variable [∀ (P : Cᵒᵖ ⥤ D) (X : C) (S : J.Cover X), HasMultiequalizer (S.index P)]
variable [PreservesLimits (forget D)]
variable [∀ X : C, HasColimitsOfShape (J.Cover X)ᵒᵖ D]
variable [∀ X : C, PreservesColimitsOfShape (J.Cover X)ᵒᵖ (forget D)]
variable [(forget D).ReflectsIsomorphisms]
variable [HasWeakSheafify J D]

/-- Construct a cocone by sheafifying a cocone point of a cocone `E` of presheaves
over a functor which factors through sheaves.
In `isColimitSheafifyCocone`, we show that this is a colimit cocone when `E` is a colimit. -/
@[simps]
noncomputable def sheafifyCocone {F : K ⥤ Sheaf J D}
(E : Cocone (F ⋙ sheafToPresheaf J D)) : Cocone F where
pt := ⟨J.sheafify E.pt, GrothendieckTopology.Plus.isSheaf_plus_plus _ _⟩
ι :=
{ app := fun k => ⟨E.ι.app k ≫ J.toSheafify E.pt⟩
naturality := fun i j f => by
ext1
dsimp
erw [Category.comp_id, ← Category.assoc, E.w f] }
(E : Cocone (F ⋙ sheafToPresheaf J D)) : Cocone F :=
(Cocones.precompose
(isoWhiskerLeft F (asIso (sheafificationAdjunction J D).counit).symm).hom).obj
((presheafToSheaf J D).mapCocone E)
set_option linter.uppercaseLean3 false in
#align category_theory.Sheaf.sheafify_cocone CategoryTheory.Sheaf.sheafifyCocone

/-- If `E` is a colimit cocone of presheaves, over a diagram factoring through sheaves,
then `sheafifyCocone E` is a colimit cocone. -/
@[simps]
noncomputable def isColimitSheafifyCocone {F : K ⥤ Sheaf J D}
(E : Cocone (F ⋙ sheafToPresheaf J D)) (hE : IsColimit E) : IsColimit (sheafifyCocone E) where
desc S := ⟨J.sheafifyLift (hE.desc ((sheafToPresheaf J D).mapCocone S)) S.pt.2
fac := by
intro S j
ext1
dsimp [sheafifyCocone]
erw [Category.assoc, J.toSheafify_sheafifyLift, hE.fac]
rfl
uniq := by
intro S m hm
ext1
apply J.sheafifyLift_unique
apply hE.uniq ((sheafToPresheaf J D).mapCocone S)
intro j
dsimp
simp only [← Category.assoc, ← hm] -- Porting note: was `simpa only [...]`
rfl
(E : Cocone (F ⋙ sheafToPresheaf J D)) (hE : IsColimit E) : IsColimit (sheafifyCocone E) :=
(IsColimit.precomposeHomEquiv _ ((presheafToSheaf J D).mapCocone E)).symm
(isColimitOfPreserves _ hE)
set_option linter.uppercaseLean3 false in
#align category_theory.Sheaf.is_colimit_sheafify_cocone CategoryTheory.Sheaf.isColimitSheafifyCocone

Expand All @@ -243,9 +219,16 @@ instance [HasColimitsOfShape K D] : HasColimitsOfShape K (Sheaf J D) :=
instance [HasFiniteCoproducts D] : HasFiniteCoproducts (Sheaf J D) :=
⟨inferInstance⟩

instance [HasColimits D] : HasColimits (Sheaf J D) :=
instance [HasFiniteColimits D] : HasFiniteColimits (Sheaf J D) :=
fun _ ↦ inferInstance⟩

instance [HasColimitsOfSize.{u₁, u₂} D] : HasColimitsOfSize.{u₁, u₂} (Sheaf J D) :=
⟨inferInstance⟩

variable {D : Type w} [Category.{max v u} D]

example [HasLimits D] : HasLimits (Sheaf J D) := inferInstance

end Colimits

end Sheaf
Expand Down
10 changes: 3 additions & 7 deletions Mathlib/Condensed/Abelian.lean
Expand Up @@ -4,8 +4,8 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Adam Topaz
-/
import Mathlib.Algebra.Category.GroupCat.Abelian
import Mathlib.Algebra.Category.GroupCat.FilteredColimits
import Mathlib.CategoryTheory.Sites.Abelian
import Mathlib.CategoryTheory.Sites.LeftExact
import Mathlib.Condensed.Basic

/-!
Expand All @@ -16,16 +16,12 @@ Condensed abelian groups form an abelian category.

universe u

open CategoryTheory Limits
open CategoryTheory

/--
The category of condensed abelian groups, defined as sheaves of abelian groups over
`CompHaus` with respect to the coherent Grothendieck topology.
-/
abbrev CondensedAb := Condensed.{u} AddCommGroupCat.{u+1}

noncomputable instance CondensedAb.abelian :
CategoryTheory.Abelian CondensedAb.{u} :=
letI : PreservesLimits (forget AddCommGroupCat.{u+1}) :=
AddCommGroupCat.forgetPreservesLimits.{u+1}
CategoryTheory.sheafIsAbelian
noncomputable instance CondensedAb.abelian : Abelian CondensedAb.{u} := sheafIsAbelian

0 comments on commit f83fe2f

Please sign in to comment.