state
stringlengths
0
159k
srcUpToTactic
stringlengths
387
167k
nextTactic
stringlengths
3
9k
declUpToTactic
stringlengths
22
11.5k
declId
stringlengths
38
95
decl
stringlengths
16
1.89k
file_tag
stringlengths
17
73
case a.a C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C J : GrothendieckTopology C hJ : J ∈ {J | K ≤ ofGrothendieck C J} X : C S : Sieve X hS : S ∈ GrothendieckTopology.sieves (toGrothendieck C K) X ⊢ S ∈ GrothendieckTopology.sieves J X
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS
induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2
/-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS
Mathlib.CategoryTheory.Sites.Coverage.271_0.qkZFgqEgDC2P633
/-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J }
Mathlib_CategoryTheory_Sites_Coverage
case a.a C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C J : GrothendieckTopology C hJ : J ∈ {J | K ≤ ofGrothendieck C J} X : C S : Sieve X hS : S ∈ GrothendieckTopology.sieves (toGrothendieck C K) X ⊢ S ∈ GrothendieckTopology.sieves J X
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS
induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2
/-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS
Mathlib.CategoryTheory.Sites.Coverage.271_0.qkZFgqEgDC2P633
/-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J }
Mathlib_CategoryTheory_Sites_Coverage
case a.a.of C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C J : GrothendieckTopology C hJ : J ∈ {J | K ≤ ofGrothendieck C J} X✝ : C S✝ : Sieve X✝ X : C S : Presieve X hS : S ∈ covering K X ⊢ Sieve.generate S ∈ GrothendieckTopology.sieves J X
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with
| of X S hS => apply hJ; assumption
/-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with
Mathlib.CategoryTheory.Sites.Coverage.271_0.qkZFgqEgDC2P633
/-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J }
Mathlib_CategoryTheory_Sites_Coverage
case a.a.of C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C J : GrothendieckTopology C hJ : J ∈ {J | K ≤ ofGrothendieck C J} X✝ : C S✝ : Sieve X✝ X : C S : Presieve X hS : S ∈ covering K X ⊢ Sieve.generate S ∈ GrothendieckTopology.sieves J X
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS =>
apply hJ
/-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS =>
Mathlib.CategoryTheory.Sites.Coverage.271_0.qkZFgqEgDC2P633
/-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J }
Mathlib_CategoryTheory_Sites_Coverage
case a.a.of.a C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C J : GrothendieckTopology C hJ : J ∈ {J | K ≤ ofGrothendieck C J} X✝ : C S✝ : Sieve X✝ X : C S : Presieve X hS : S ∈ covering K X ⊢ S ∈ covering K X
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ;
assumption
/-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ;
Mathlib.CategoryTheory.Sites.Coverage.271_0.qkZFgqEgDC2P633
/-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J }
Mathlib_CategoryTheory_Sites_Coverage
case a.a.top C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C J : GrothendieckTopology C hJ : J ∈ {J | K ≤ ofGrothendieck C J} X : C S : Sieve X X✝ : C ⊢ ⊤ ∈ GrothendieckTopology.sieves J X✝
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption
| top => apply J.top_mem
/-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption
Mathlib.CategoryTheory.Sites.Coverage.271_0.qkZFgqEgDC2P633
/-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J }
Mathlib_CategoryTheory_Sites_Coverage
case a.a.top C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C J : GrothendieckTopology C hJ : J ∈ {J | K ≤ ofGrothendieck C J} X : C S : Sieve X X✝ : C ⊢ ⊤ ∈ GrothendieckTopology.sieves J X✝
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top =>
apply J.top_mem
/-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top =>
Mathlib.CategoryTheory.Sites.Coverage.271_0.qkZFgqEgDC2P633
/-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J }
Mathlib_CategoryTheory_Sites_Coverage
case a.a.transitive C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C J : GrothendieckTopology C hJ : J ∈ {J | K ≤ ofGrothendieck C J} X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) H1 : R ∈ GrothendieckTopology.sieves J X H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → Sieve.pullback f S ∈ GrothendieckTopology.sieves J Y ⊢ S ∈ GrothendieckTopology.sieves J X
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem
| transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2
/-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem
Mathlib.CategoryTheory.Sites.Coverage.271_0.qkZFgqEgDC2P633
/-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J }
Mathlib_CategoryTheory_Sites_Coverage
case a.a.transitive C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C J : GrothendieckTopology C hJ : J ∈ {J | K ≤ ofGrothendieck C J} X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) H1 : R ∈ GrothendieckTopology.sieves J X H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → Sieve.pullback f S ∈ GrothendieckTopology.sieves J Y ⊢ S ∈ GrothendieckTopology.sieves J X
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 =>
exact J.transitive H1 _ H2
/-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 =>
Mathlib.CategoryTheory.Sites.Coverage.271_0.qkZFgqEgDC2P633
/-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J }
Mathlib_CategoryTheory_Sites_Coverage
case a C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C ⊢ sInf {J | K ≤ ofGrothendieck C J} ≤ toGrothendieck C K
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 ·
apply sInf_le
/-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 ·
Mathlib.CategoryTheory.Sites.Coverage.271_0.qkZFgqEgDC2P633
/-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J }
Mathlib_CategoryTheory_Sites_Coverage
case a.a C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C ⊢ toGrothendieck C K ∈ {J | K ≤ ofGrothendieck C J}
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le
intro X S hS
/-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le
Mathlib.CategoryTheory.Sites.Coverage.271_0.qkZFgqEgDC2P633
/-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J }
Mathlib_CategoryTheory_Sites_Coverage
case a.a C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C X : C S : Presieve X hS : S ∈ covering K X ⊢ S ∈ covering (ofGrothendieck C (toGrothendieck C K)) X
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS
apply saturate.of _ _ hS
/-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS
Mathlib.CategoryTheory.Sites.Coverage.271_0.qkZFgqEgDC2P633
/-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J }
Mathlib_CategoryTheory_Sites_Coverage
C : Type ?u.32430 inst✝ : Category.{?u.32434, ?u.32430} C x y : Coverage C ⊢ ∀ ⦃X Y : C⦄ (f : Y ⟶ X), ∀ S ∈ (fun B => covering x B ∪ covering y B) X, ∃ T ∈ (fun B => covering x B ∪ covering y B) Y, Presieve.FactorsThruAlong T S f
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by
rintro X Y f S (hx | hy)
instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by
Mathlib.CategoryTheory.Sites.Coverage.288_0.qkZFgqEgDC2P633
instance : SemilatticeSup (Coverage C) where sup x y
Mathlib_CategoryTheory_Sites_Coverage
case inl C : Type ?u.32430 inst✝ : Category.{?u.32434, ?u.32430} C x y : Coverage C X Y : C f : Y ⟶ X S : Presieve X hx : S ∈ covering x X ⊢ ∃ T ∈ (fun B => covering x B ∪ covering y B) Y, Presieve.FactorsThruAlong T S f
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) ·
obtain ⟨T, hT⟩ := x.pullback f S hx
instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) ·
Mathlib.CategoryTheory.Sites.Coverage.288_0.qkZFgqEgDC2P633
instance : SemilatticeSup (Coverage C) where sup x y
Mathlib_CategoryTheory_Sites_Coverage
case inl.intro C : Type ?u.32430 inst✝ : Category.{?u.32434, ?u.32430} C x y : Coverage C X Y : C f : Y ⟶ X S : Presieve X hx : S ∈ covering x X T : Presieve Y hT : T ∈ covering x Y ∧ Presieve.FactorsThruAlong T S f ⊢ ∃ T ∈ (fun B => covering x B ∪ covering y B) Y, Presieve.FactorsThruAlong T S f
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx
exact ⟨T, Or.inl hT.1, hT.2⟩
instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx
Mathlib.CategoryTheory.Sites.Coverage.288_0.qkZFgqEgDC2P633
instance : SemilatticeSup (Coverage C) where sup x y
Mathlib_CategoryTheory_Sites_Coverage
case inr C : Type ?u.32430 inst✝ : Category.{?u.32434, ?u.32430} C x y : Coverage C X Y : C f : Y ⟶ X S : Presieve X hy : S ∈ covering y X ⊢ ∃ T ∈ (fun B => covering x B ∪ covering y B) Y, Presieve.FactorsThruAlong T S f
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ ·
obtain ⟨T, hT⟩ := y.pullback f S hy
instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ ·
Mathlib.CategoryTheory.Sites.Coverage.288_0.qkZFgqEgDC2P633
instance : SemilatticeSup (Coverage C) where sup x y
Mathlib_CategoryTheory_Sites_Coverage
case inr.intro C : Type ?u.32430 inst✝ : Category.{?u.32434, ?u.32430} C x y : Coverage C X Y : C f : Y ⟶ X S : Presieve X hy : S ∈ covering y X T : Presieve Y hT : T ∈ covering y Y ∧ Presieve.FactorsThruAlong T S f ⊢ ∃ T ∈ (fun B => covering x B ∪ covering y B) Y, Presieve.FactorsThruAlong T S f
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy
exact ⟨T, Or.inr hT.1, hT.2⟩
instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy
Mathlib.CategoryTheory.Sites.Coverage.288_0.qkZFgqEgDC2P633
instance : SemilatticeSup (Coverage C) where sup x y
Mathlib_CategoryTheory_Sites_Coverage
C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w ⊢ IsSheaf (toGrothendieck C K) P ↔ ∀ {X : C}, ∀ R ∈ covering K X, IsSheafFor P R
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by
constructor
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mp C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w ⊢ IsSheaf (toGrothendieck C K) P → ∀ {X : C}, ∀ R ∈ covering K X, IsSheafFor P R
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor ·
intro H X R hR
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor ·
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mp C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w H : IsSheaf (toGrothendieck C K) P X : C R : Presieve X hR : R ∈ covering K X ⊢ IsSheafFor P R
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR
rw [Presieve.isSheafFor_iff_generate]
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mp C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w H : IsSheaf (toGrothendieck C K) P X : C R : Presieve X hR : R ∈ covering K X ⊢ IsSheafFor P (Sieve.generate R).arrows
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate]
apply H _ <| saturate.of _ _ hR
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate]
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w ⊢ (∀ {X : C}, ∀ R ∈ covering K X, IsSheafFor P R) → IsSheaf (toGrothendieck C K) P
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR ·
intro H X S hS
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR ·
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w H : ∀ {X : C}, ∀ R ∈ covering K X, IsSheafFor P R X : C S : Sieve X hS : S ∈ GrothendieckTopology.sieves (toGrothendieck C K) X ⊢ IsSheafFor P S.arrows
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way.
suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _)
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way.
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w H : ∀ {X : C}, ∀ R ∈ covering K X, IsSheafFor P R X : C S : Sieve X hS : S ∈ GrothendieckTopology.sieves (toGrothendieck C K) X this : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSheafFor P (Sieve.pullback f S).arrows ⊢ IsSheafFor P S.arrows
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by
simpa using this (f := 𝟙 _)
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w H : ∀ {X : C}, ∀ R ∈ covering K X, IsSheafFor P R X : C S : Sieve X hS : S ∈ GrothendieckTopology.sieves (toGrothendieck C K) X ⊢ ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSheafFor P (Sieve.pullback f S).arrows
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _)
induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply] rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz] · dsimp; congr 1; simp only [Category.assoc, h] · simpa [reassoc_of% h] using hgg · simpa using hgg obtain ⟨t, ht⟩ := H1' f q hq refine ⟨t, fun Z g hg => ?_⟩ refine (H1 (g ≫ f)).ext (fun ZZ gg hgg => ?_) rw [← types_comp_apply _ (P.map gg.op), ← P.map_comp, ← op_comp, ht] swap; simpa using hgg refine (H2 hgg (𝟙 _)).ext (fun ZZZ ggg hggg => ?_) rw [← types_comp_apply _ (P.map ggg.op), ← P.map_comp, ← op_comp, hz] swap; simpa using hggg refine (H2 hgg ggg).ext (fun ZZZZ gggg _ => ?_) rw [← types_comp_apply _ (P.map gggg.op), ← P.map_comp, ← op_comp] apply hx simp
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _)
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w H : ∀ {X : C}, ∀ R ∈ covering K X, IsSheafFor P R X : C S : Sieve X hS : S ∈ GrothendieckTopology.sieves (toGrothendieck C K) X ⊢ ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSheafFor P (Sieve.pullback f S).arrows
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _)
induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply] rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz] · dsimp; congr 1; simp only [Category.assoc, h] · simpa [reassoc_of% h] using hgg · simpa using hgg obtain ⟨t, ht⟩ := H1' f q hq refine ⟨t, fun Z g hg => ?_⟩ refine (H1 (g ≫ f)).ext (fun ZZ gg hgg => ?_) rw [← types_comp_apply _ (P.map gg.op), ← P.map_comp, ← op_comp, ht] swap; simpa using hgg refine (H2 hgg (𝟙 _)).ext (fun ZZZ ggg hggg => ?_) rw [← types_comp_apply _ (P.map ggg.op), ← P.map_comp, ← op_comp, hz] swap; simpa using hggg refine (H2 hgg ggg).ext (fun ZZZZ gggg _ => ?_) rw [← types_comp_apply _ (P.map gggg.op), ← P.map_comp, ← op_comp] apply hx simp
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _)
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr.of C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w H : ∀ {X : C}, ∀ R ∈ covering K X, IsSheafFor P R X✝ : C S✝ : Sieve X✝ X : C S : Presieve X hS : S ∈ covering K X ⊢ ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSheafFor P (Sieve.pullback f (Sieve.generate S)).arrows
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with
| of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr.of C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w H : ∀ {X : C}, ∀ R ∈ covering K X, IsSheafFor P R X✝ : C S✝ : Sieve X✝ X : C S : Presieve X hS : S ∈ covering K X ⊢ ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSheafFor P (Sieve.pullback f (Sieve.generate S)).arrows
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS =>
intro Y f
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS =>
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr.of C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w H : ∀ {X : C}, ∀ R ∈ covering K X, IsSheafFor P R X✝ : C S✝ : Sieve X✝ X : C S : Presieve X hS : S ∈ covering K X Y : C f : Y ⟶ X ⊢ IsSheafFor P (Sieve.pullback f (Sieve.generate S)).arrows
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f
obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr.of.intro.intro C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w H : ∀ {X : C}, ∀ R ∈ covering K X, IsSheafFor P R X✝ : C S✝ : Sieve X✝ X : C S : Presieve X hS : S ∈ covering K X Y : C f : Y ⟶ X T : Presieve Y hT1 : T ∈ covering K Y hT2 : FactorsThruAlong T S f ⊢ IsSheafFor P (Sieve.pullback f (Sieve.generate S)).arrows
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS
apply Presieve.isSheafFor_of_factorsThru (S := T)
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr.of.intro.intro.H C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w H : ∀ {X : C}, ∀ R ∈ covering K X, IsSheafFor P R X✝ : C S✝ : Sieve X✝ X : C S : Presieve X hS : S ∈ covering K X Y : C f : Y ⟶ X T : Presieve Y hT1 : T ∈ covering K Y hT2 : FactorsThruAlong T S f ⊢ FactorsThru T (Sieve.pullback f (Sieve.generate S)).arrows
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) ·
intro Z g hg
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) ·
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr.of.intro.intro.H C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w H : ∀ {X : C}, ∀ R ∈ covering K X, IsSheafFor P R X✝ : C S✝ : Sieve X✝ X : C S : Presieve X hS : S ∈ covering K X Y : C f : Y ⟶ X T : Presieve Y hT1 : T ∈ covering K Y hT2 : FactorsThruAlong T S f Z : C g : Z ⟶ Y hg : T g ⊢ ∃ W i e, (Sieve.pullback f (Sieve.generate S)).arrows e ∧ i ≫ e = g
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg
obtain ⟨W, i, e, h1, h2⟩ := hT2 hg
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr.of.intro.intro.H.intro.intro.intro.intro C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w H : ∀ {X : C}, ∀ R ∈ covering K X, IsSheafFor P R X✝ : C S✝ : Sieve X✝ X : C S : Presieve X hS : S ∈ covering K X Y : C f : Y ⟶ X T : Presieve Y hT1 : T ∈ covering K Y hT2 : FactorsThruAlong T S f Z : C g : Z ⟶ Y hg : T g W : C i : Z ⟶ W e : W ⟶ X h1 : S e h2 : i ≫ e = g ≫ f ⊢ ∃ W i e, (Sieve.pullback f (Sieve.generate S)).arrows e ∧ i ≫ e = g
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg
exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w H : ∀ {X : C}, ∀ R ∈ covering K X, IsSheafFor P R X✝ : C S✝ : Sieve X✝ X : C S : Presieve X hS : S ∈ covering K X Y : C f : Y ⟶ X T : Presieve Y hT1 : T ∈ covering K Y hT2 : FactorsThruAlong T S f Z : C g : Z ⟶ Y hg : T g W : C i : Z ⟶ W e : W ⟶ X h1 : S e h2 : i ≫ e = g ≫ f ⊢ 𝟙 Z ≫ g = g
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by
simp
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr.of.intro.intro.hS C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w H : ∀ {X : C}, ∀ R ∈ covering K X, IsSheafFor P R X✝ : C S✝ : Sieve X✝ X : C S : Presieve X hS : S ∈ covering K X Y : C f : Y ⟶ X T : Presieve Y hT1 : T ∈ covering K Y hT2 : FactorsThruAlong T S f ⊢ IsSheafFor P T
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ ·
apply H
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ ·
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr.of.intro.intro.hS.a C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w H : ∀ {X : C}, ∀ R ∈ covering K X, IsSheafFor P R X✝ : C S✝ : Sieve X✝ X : C S : Presieve X hS : S ∈ covering K X Y : C f : Y ⟶ X T : Presieve Y hT1 : T ∈ covering K Y hT2 : FactorsThruAlong T S f ⊢ T ∈ covering K Y
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H;
assumption
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H;
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr.of.intro.intro.h C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w H : ∀ {X : C}, ∀ R ∈ covering K X, IsSheafFor P R X✝ : C S✝ : Sieve X✝ X : C S : Presieve X hS : S ∈ covering K X Y : C f : Y ⟶ X T : Presieve Y hT1 : T ∈ covering K Y hT2 : FactorsThruAlong T S f ⊢ ∀ ⦃Y_1 : C⦄ ⦃f_1 : Y_1 ⟶ Y⦄, (Sieve.pullback f (Sieve.generate S)).arrows f_1 → ∃ R, IsSeparatedFor P R ∧ FactorsThruAlong R T f_1
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption ·
intro Z g _
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption ·
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr.of.intro.intro.h C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w H : ∀ {X : C}, ∀ R ∈ covering K X, IsSheafFor P R X✝ : C S✝ : Sieve X✝ X : C S : Presieve X hS : S ∈ covering K X Y : C f : Y ⟶ X T : Presieve Y hT1 : T ∈ covering K Y hT2 : FactorsThruAlong T S f Z : C g : Z ⟶ Y a✝ : (Sieve.pullback f (Sieve.generate S)).arrows g ⊢ ∃ R, IsSeparatedFor P R ∧ FactorsThruAlong R T g
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _
obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr.of.intro.intro.h.intro.intro C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w H : ∀ {X : C}, ∀ R ∈ covering K X, IsSheafFor P R X✝ : C S✝ : Sieve X✝ X : C S : Presieve X hS : S ∈ covering K X Y : C f : Y ⟶ X T : Presieve Y hT1 : T ∈ covering K Y hT2 : FactorsThruAlong T S f Z : C g : Z ⟶ Y a✝ : (Sieve.pullback f (Sieve.generate S)).arrows g R : Presieve Z hR1 : R ∈ covering K Z hR2 : FactorsThruAlong R T g ⊢ ∃ R, IsSeparatedFor P R ∧ FactorsThruAlong R T g
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1
refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr.top C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w H : ∀ {X : C}, ∀ R ∈ covering K X, IsSheafFor P R X : C S : Sieve X X✝ : C ⊢ ∀ ⦃Y : C⦄ (f : Y ⟶ X✝), IsSheafFor P (Sieve.pullback f ⊤).arrows
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩
| top => intros; simpa using Presieve.isSheafFor_top_sieve _
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr.top C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w H : ∀ {X : C}, ∀ R ∈ covering K X, IsSheafFor P R X : C S : Sieve X X✝ : C ⊢ ∀ ⦃Y : C⦄ (f : Y ⟶ X✝), IsSheafFor P (Sieve.pullback f ⊤).arrows
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top =>
intros
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top =>
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr.top C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w H : ∀ {X : C}, ∀ R ∈ covering K X, IsSheafFor P R X : C S : Sieve X X✝ Y✝ : C f✝ : Y✝ ⟶ X✝ ⊢ IsSheafFor P (Sieve.pullback f✝ ⊤).arrows
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros;
simpa using Presieve.isSheafFor_top_sieve _
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros;
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr.transitive C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w H : ∀ {X : C}, ∀ R ∈ covering K X, IsSheafFor P R X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) H1 : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSheafFor P (Sieve.pullback f R).arrows H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y), IsSheafFor P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows ⊢ ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSheafFor P (Sieve.pullback f S).arrows
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _
| transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply] rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz] · dsimp; congr 1; simp only [Category.assoc, h] · simpa [reassoc_of% h] using hgg · simpa using hgg obtain ⟨t, ht⟩ := H1' f q hq refine ⟨t, fun Z g hg => ?_⟩ refine (H1 (g ≫ f)).ext (fun ZZ gg hgg => ?_) rw [← types_comp_apply _ (P.map gg.op), ← P.map_comp, ← op_comp, ht] swap; simpa using hgg refine (H2 hgg (𝟙 _)).ext (fun ZZZ ggg hggg => ?_) rw [← types_comp_apply _ (P.map ggg.op), ← P.map_comp, ← op_comp, hz] swap; simpa using hggg refine (H2 hgg ggg).ext (fun ZZZZ gggg _ => ?_) rw [← types_comp_apply _ (P.map gggg.op), ← P.map_comp, ← op_comp] apply hx simp
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr.transitive C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w H : ∀ {X : C}, ∀ R ∈ covering K X, IsSheafFor P R X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) H1 : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSheafFor P (Sieve.pullback f R).arrows H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y), IsSheafFor P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows ⊢ ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSheafFor P (Sieve.pullback f S).arrows
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 =>
intro Y f
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 =>
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr.transitive C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w H : ∀ {X : C}, ∀ R ∈ covering K X, IsSheafFor P R X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) H1 : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSheafFor P (Sieve.pullback f R).arrows H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y), IsSheafFor P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows Y : C f : Y ⟶ X ⊢ IsSheafFor P (Sieve.pullback f S).arrows
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f
simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at *
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr.transitive C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) Y : C f : Y ⟶ X H : ∀ {X : C}, ∀ R ∈ covering K X, IsSeparatedFor P R ∧ ∀ (x : FamilyOfElements P R), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H1 : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSeparatedFor P (Sieve.pullback f R).arrows ∧ ∀ (x : FamilyOfElements P (Sieve.pullback f R).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y), IsSeparatedFor P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows ∧ ∀ (x : FamilyOfElements P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t ⊢ IsSeparatedFor P (Sieve.pullback f S).arrows ∧ ∀ (x : FamilyOfElements P (Sieve.pullback f S).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at *
choose H1 H1' using H1
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at *
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr.transitive C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) Y : C f : Y ⟶ X H : ∀ {X : C}, ∀ R ∈ covering K X, IsSeparatedFor P R ∧ ∀ (x : FamilyOfElements P R), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y), IsSeparatedFor P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows ∧ ∀ (x : FamilyOfElements P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H1 : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSeparatedFor P (Sieve.pullback f R).arrows H1' : ∀ ⦃Y : C⦄ (f : Y ⟶ X) (x : FamilyOfElements P (Sieve.pullback f R).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t ⊢ IsSeparatedFor P (Sieve.pullback f S).arrows ∧ ∀ (x : FamilyOfElements P (Sieve.pullback f S).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1
choose H2 H2' using H2
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr.transitive C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) Y : C f : Y ⟶ X H : ∀ {X : C}, ∀ R ∈ covering K X, IsSeparatedFor P R ∧ ∀ (x : FamilyOfElements P R), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H1 : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSeparatedFor P (Sieve.pullback f R).arrows H1' : ∀ ⦃Y : C⦄ (f : Y ⟶ X) (x : FamilyOfElements P (Sieve.pullback f R).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y), IsSeparatedFor P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows H2' : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y) (x : FamilyOfElements P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t ⊢ IsSeparatedFor P (Sieve.pullback f S).arrows ∧ ∀ (x : FamilyOfElements P (Sieve.pullback f S).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2
refine ⟨?_, fun x hx => ?_⟩
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr.transitive.refine_1 C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) Y : C f : Y ⟶ X H : ∀ {X : C}, ∀ R ∈ covering K X, IsSeparatedFor P R ∧ ∀ (x : FamilyOfElements P R), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H1 : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSeparatedFor P (Sieve.pullback f R).arrows H1' : ∀ ⦃Y : C⦄ (f : Y ⟶ X) (x : FamilyOfElements P (Sieve.pullback f R).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y), IsSeparatedFor P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows H2' : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y) (x : FamilyOfElements P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t ⊢ IsSeparatedFor P (Sieve.pullback f S).arrows
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ ·
intro x t₁ t₂ h₁ h₂
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ ·
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr.transitive.refine_1 C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) Y : C f : Y ⟶ X H : ∀ {X : C}, ∀ R ∈ covering K X, IsSeparatedFor P R ∧ ∀ (x : FamilyOfElements P R), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H1 : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSeparatedFor P (Sieve.pullback f R).arrows H1' : ∀ ⦃Y : C⦄ (f : Y ⟶ X) (x : FamilyOfElements P (Sieve.pullback f R).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y), IsSeparatedFor P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows H2' : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y) (x : FamilyOfElements P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t x : FamilyOfElements P (Sieve.pullback f S).arrows t₁ t₂ : P.obj (Opposite.op Y) h₁ : FamilyOfElements.IsAmalgamation x t₁ h₂ : FamilyOfElements.IsAmalgamation x t₂ ⊢ t₁ = t₂
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂
refine (H1 f).ext (fun Z g hg => ?_)
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr.transitive.refine_1 C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) Y : C f : Y ⟶ X H : ∀ {X : C}, ∀ R ∈ covering K X, IsSeparatedFor P R ∧ ∀ (x : FamilyOfElements P R), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H1 : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSeparatedFor P (Sieve.pullback f R).arrows H1' : ∀ ⦃Y : C⦄ (f : Y ⟶ X) (x : FamilyOfElements P (Sieve.pullback f R).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y), IsSeparatedFor P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows H2' : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y) (x : FamilyOfElements P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t x : FamilyOfElements P (Sieve.pullback f S).arrows t₁ t₂ : P.obj (Opposite.op Y) h₁ : FamilyOfElements.IsAmalgamation x t₁ h₂ : FamilyOfElements.IsAmalgamation x t₂ Z : C g : Z ⟶ Y hg : (Sieve.pullback f R).arrows g ⊢ P.map g.op t₁ = P.map g.op t₂
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_)
refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_)
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_)
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr.transitive.refine_1 C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) Y : C f : Y ⟶ X H : ∀ {X : C}, ∀ R ∈ covering K X, IsSeparatedFor P R ∧ ∀ (x : FamilyOfElements P R), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H1 : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSeparatedFor P (Sieve.pullback f R).arrows H1' : ∀ ⦃Y : C⦄ (f : Y ⟶ X) (x : FamilyOfElements P (Sieve.pullback f R).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y), IsSeparatedFor P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows H2' : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y) (x : FamilyOfElements P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t x : FamilyOfElements P (Sieve.pullback f S).arrows t₁ t₂ : P.obj (Opposite.op Y) h₁ : FamilyOfElements.IsAmalgamation x t₁ h₂ : FamilyOfElements.IsAmalgamation x t₂ Z : C g : Z ⟶ Y hg : (Sieve.pullback f R).arrows g ZZ : C gg : ZZ ⟶ Z hgg : (Sieve.pullback (𝟙 Z) (Sieve.pullback (g ≫ f) S)).arrows gg ⊢ P.map gg.op (P.map g.op t₁) = P.map gg.op (P.map g.op t₂)
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_)
simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_)
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr.transitive.refine_1 C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) Y : C f : Y ⟶ X H : ∀ {X : C}, ∀ R ∈ covering K X, IsSeparatedFor P R ∧ ∀ (x : FamilyOfElements P R), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H1 : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSeparatedFor P (Sieve.pullback f R).arrows H1' : ∀ ⦃Y : C⦄ (f : Y ⟶ X) (x : FamilyOfElements P (Sieve.pullback f R).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y), IsSeparatedFor P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows H2' : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y) (x : FamilyOfElements P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t x : FamilyOfElements P (Sieve.pullback f S).arrows t₁ t₂ : P.obj (Opposite.op Y) h₁ : FamilyOfElements.IsAmalgamation x t₁ h₂ : FamilyOfElements.IsAmalgamation x t₂ Z : C g : Z ⟶ Y hg : (Sieve.pullback f R).arrows g ZZ : C gg : ZZ ⟶ Z hgg : S.arrows (gg ≫ g ≫ f) ⊢ P.map gg.op (P.map g.op t₁) = P.map gg.op (P.map g.op t₂)
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg
simp only [← types_comp_apply]
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr.transitive.refine_1 C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) Y : C f : Y ⟶ X H : ∀ {X : C}, ∀ R ∈ covering K X, IsSeparatedFor P R ∧ ∀ (x : FamilyOfElements P R), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H1 : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSeparatedFor P (Sieve.pullback f R).arrows H1' : ∀ ⦃Y : C⦄ (f : Y ⟶ X) (x : FamilyOfElements P (Sieve.pullback f R).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y), IsSeparatedFor P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows H2' : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y) (x : FamilyOfElements P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t x : FamilyOfElements P (Sieve.pullback f S).arrows t₁ t₂ : P.obj (Opposite.op Y) h₁ : FamilyOfElements.IsAmalgamation x t₁ h₂ : FamilyOfElements.IsAmalgamation x t₂ Z : C g : Z ⟶ Y hg : (Sieve.pullback f R).arrows g ZZ : C gg : ZZ ⟶ Z hgg : S.arrows (gg ≫ g ≫ f) ⊢ (P.map g.op ≫ P.map gg.op) t₁ = (P.map g.op ≫ P.map gg.op) t₂
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply]
rw [← P.map_comp, ← op_comp, h₁, h₂]
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply]
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr.transitive.refine_1.h C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) Y : C f : Y ⟶ X H : ∀ {X : C}, ∀ R ∈ covering K X, IsSeparatedFor P R ∧ ∀ (x : FamilyOfElements P R), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H1 : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSeparatedFor P (Sieve.pullback f R).arrows H1' : ∀ ⦃Y : C⦄ (f : Y ⟶ X) (x : FamilyOfElements P (Sieve.pullback f R).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y), IsSeparatedFor P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows H2' : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y) (x : FamilyOfElements P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t x : FamilyOfElements P (Sieve.pullback f S).arrows t₁ t₂ : P.obj (Opposite.op Y) h₁ : FamilyOfElements.IsAmalgamation x t₁ h₂ : FamilyOfElements.IsAmalgamation x t₂ Z : C g : Z ⟶ Y hg : (Sieve.pullback f R).arrows g ZZ : C gg : ZZ ⟶ Z hgg : S.arrows (gg ≫ g ≫ f) ⊢ (Sieve.pullback f S).arrows (gg ≫ g)
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂]
simpa only [Sieve.pullback_apply, Category.assoc] using hgg
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂]
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr.transitive.refine_2 C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) Y : C f : Y ⟶ X H : ∀ {X : C}, ∀ R ∈ covering K X, IsSeparatedFor P R ∧ ∀ (x : FamilyOfElements P R), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H1 : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSeparatedFor P (Sieve.pullback f R).arrows H1' : ∀ ⦃Y : C⦄ (f : Y ⟶ X) (x : FamilyOfElements P (Sieve.pullback f R).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y), IsSeparatedFor P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows H2' : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y) (x : FamilyOfElements P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t x : FamilyOfElements P (Sieve.pullback f S).arrows hx : FamilyOfElements.Compatible x ⊢ ∃ t, FamilyOfElements.IsAmalgamation x t
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg
let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg)
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) Y : C f : Y ⟶ X H : ∀ {X : C}, ∀ R ∈ covering K X, IsSeparatedFor P R ∧ ∀ (x : FamilyOfElements P R), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H1 : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSeparatedFor P (Sieve.pullback f R).arrows H1' : ∀ ⦃Y : C⦄ (f : Y ⟶ X) (x : FamilyOfElements P (Sieve.pullback f R).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y), IsSeparatedFor P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows H2' : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y) (x : FamilyOfElements P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t x : FamilyOfElements P (Sieve.pullback f S).arrows hx : FamilyOfElements.Compatible x Z : C g : Z ⟶ Y ZZ : C gg : ZZ ⟶ Z hgg : (Sieve.pullback (𝟙 Z) (Sieve.pullback (g ≫ f) S)).arrows gg ⊢ (Sieve.pullback f S).arrows (gg ≫ g)
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by
simpa using hgg
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr.transitive.refine_2 C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) Y : C f : Y ⟶ X H : ∀ {X : C}, ∀ R ∈ covering K X, IsSeparatedFor P R ∧ ∀ (x : FamilyOfElements P R), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H1 : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSeparatedFor P (Sieve.pullback f R).arrows H1' : ∀ ⦃Y : C⦄ (f : Y ⟶ X) (x : FamilyOfElements P (Sieve.pullback f R).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y), IsSeparatedFor P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows H2' : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y) (x : FamilyOfElements P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t x : FamilyOfElements P (Sieve.pullback f S).arrows hx : FamilyOfElements.Compatible x y : ⦃Z : C⦄ → (g : Z ⟶ Y) → FamilyOfElements P (Sieve.pullback (𝟙 Z) (Sieve.pullback (g ≫ f) S)).arrows := fun Z g ZZ gg hgg => x (gg ≫ g) (_ : (Sieve.pullback f S).arrows (gg ≫ g)) ⊢ ∃ t, FamilyOfElements.IsAmalgamation x t
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg)
have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h]
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg)
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) Y : C f : Y ⟶ X H : ∀ {X : C}, ∀ R ∈ covering K X, IsSeparatedFor P R ∧ ∀ (x : FamilyOfElements P R), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H1 : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSeparatedFor P (Sieve.pullback f R).arrows H1' : ∀ ⦃Y : C⦄ (f : Y ⟶ X) (x : FamilyOfElements P (Sieve.pullback f R).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y), IsSeparatedFor P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows H2' : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y) (x : FamilyOfElements P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t x : FamilyOfElements P (Sieve.pullback f S).arrows hx : FamilyOfElements.Compatible x y : ⦃Z : C⦄ → (g : Z ⟶ Y) → FamilyOfElements P (Sieve.pullback (𝟙 Z) (Sieve.pullback (g ≫ f) S)).arrows := fun Z g ZZ gg hgg => x (gg ≫ g) (_ : (Sieve.pullback f S).arrows (gg ≫ g)) ⊢ ∀ ⦃Z : C⦄ (g : Z ⟶ Y), FamilyOfElements.Compatible (y g)
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by
intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) Y : C f : Y ⟶ X H : ∀ {X : C}, ∀ R ∈ covering K X, IsSeparatedFor P R ∧ ∀ (x : FamilyOfElements P R), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H1 : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSeparatedFor P (Sieve.pullback f R).arrows H1' : ∀ ⦃Y : C⦄ (f : Y ⟶ X) (x : FamilyOfElements P (Sieve.pullback f R).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y), IsSeparatedFor P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows H2' : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y) (x : FamilyOfElements P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t x : FamilyOfElements P (Sieve.pullback f S).arrows hx : FamilyOfElements.Compatible x y : ⦃Z : C⦄ → (g : Z ⟶ Y) → FamilyOfElements P (Sieve.pullback (𝟙 Z) (Sieve.pullback (g ≫ f) S)).arrows := fun Z g ZZ gg hgg => x (gg ≫ g) (_ : (Sieve.pullback f S).arrows (gg ≫ g)) Z : C g : Z ⟶ Y Y₁ Y₂ ZZ : C g₁ : ZZ ⟶ Y₁ g₂ : ZZ ⟶ Y₂ f₁ : Y₁ ⟶ Z f₂ : Y₂ ⟶ Z h₁ : (Sieve.pullback (𝟙 Z) (Sieve.pullback (g ≫ f) S)).arrows f₁ h₂ : (Sieve.pullback (𝟙 Z) (Sieve.pullback (g ≫ f) S)).arrows f₂ h : g₁ ≫ f₁ = g₂ ≫ f₂ ⊢ P.map g₁.op (y g f₁ h₁) = P.map g₂.op (y g f₂ h₂)
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h
rw [hx]
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case a C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) Y : C f : Y ⟶ X H : ∀ {X : C}, ∀ R ∈ covering K X, IsSeparatedFor P R ∧ ∀ (x : FamilyOfElements P R), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H1 : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSeparatedFor P (Sieve.pullback f R).arrows H1' : ∀ ⦃Y : C⦄ (f : Y ⟶ X) (x : FamilyOfElements P (Sieve.pullback f R).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y), IsSeparatedFor P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows H2' : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y) (x : FamilyOfElements P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t x : FamilyOfElements P (Sieve.pullback f S).arrows hx : FamilyOfElements.Compatible x y : ⦃Z : C⦄ → (g : Z ⟶ Y) → FamilyOfElements P (Sieve.pullback (𝟙 Z) (Sieve.pullback (g ≫ f) S)).arrows := fun Z g ZZ gg hgg => x (gg ≫ g) (_ : (Sieve.pullback f S).arrows (gg ≫ g)) Z : C g : Z ⟶ Y Y₁ Y₂ ZZ : C g₁ : ZZ ⟶ Y₁ g₂ : ZZ ⟶ Y₂ f₁ : Y₁ ⟶ Z f₂ : Y₂ ⟶ Z h₁ : (Sieve.pullback (𝟙 Z) (Sieve.pullback (g ≫ f) S)).arrows f₁ h₂ : (Sieve.pullback (𝟙 Z) (Sieve.pullback (g ≫ f) S)).arrows f₂ h : g₁ ≫ f₁ = g₂ ≫ f₂ ⊢ g₁ ≫ f₁ ≫ g = g₂ ≫ f₂ ≫ g
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx]
rw [reassoc_of% h]
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx]
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr.transitive.refine_2 C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) Y : C f : Y ⟶ X H : ∀ {X : C}, ∀ R ∈ covering K X, IsSeparatedFor P R ∧ ∀ (x : FamilyOfElements P R), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H1 : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSeparatedFor P (Sieve.pullback f R).arrows H1' : ∀ ⦃Y : C⦄ (f : Y ⟶ X) (x : FamilyOfElements P (Sieve.pullback f R).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y), IsSeparatedFor P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows H2' : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y) (x : FamilyOfElements P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t x : FamilyOfElements P (Sieve.pullback f S).arrows hx : FamilyOfElements.Compatible x y : ⦃Z : C⦄ → (g : Z ⟶ Y) → FamilyOfElements P (Sieve.pullback (𝟙 Z) (Sieve.pullback (g ≫ f) S)).arrows := fun Z g ZZ gg hgg => x (gg ≫ g) (_ : (Sieve.pullback f S).arrows (gg ≫ g)) hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), FamilyOfElements.Compatible (y g) ⊢ ∃ t, FamilyOfElements.IsAmalgamation x t
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h]
choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g)
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h]
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr.transitive.refine_2 C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) Y : C f : Y ⟶ X H : ∀ {X : C}, ∀ R ∈ covering K X, IsSeparatedFor P R ∧ ∀ (x : FamilyOfElements P R), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H1 : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSeparatedFor P (Sieve.pullback f R).arrows H1' : ∀ ⦃Y : C⦄ (f : Y ⟶ X) (x : FamilyOfElements P (Sieve.pullback f R).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y), IsSeparatedFor P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows H2' : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y) (x : FamilyOfElements P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t x : FamilyOfElements P (Sieve.pullback f S).arrows hx : FamilyOfElements.Compatible x y : ⦃Z : C⦄ → (g : Z ⟶ Y) → FamilyOfElements P (Sieve.pullback (𝟙 Z) (Sieve.pullback (g ≫ f) S)).arrows := fun Z g ZZ gg hgg => x (gg ≫ g) (_ : (Sieve.pullback f S).arrows (gg ≫ g)) hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), FamilyOfElements.Compatible (y g) z : ⦃Z : C⦄ → ⦃g : Z ⟶ Y⦄ → (Sieve.pullback f R).arrows g → P.obj (Opposite.op Z) hz : ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : (Sieve.pullback f R).arrows g), FamilyOfElements.IsAmalgamation (y g) (z hg) ⊢ ∃ t, FamilyOfElements.IsAmalgamation x t
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g)
let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g)
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr.transitive.refine_2 C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) Y : C f : Y ⟶ X H : ∀ {X : C}, ∀ R ∈ covering K X, IsSeparatedFor P R ∧ ∀ (x : FamilyOfElements P R), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H1 : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSeparatedFor P (Sieve.pullback f R).arrows H1' : ∀ ⦃Y : C⦄ (f : Y ⟶ X) (x : FamilyOfElements P (Sieve.pullback f R).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y), IsSeparatedFor P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows H2' : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y) (x : FamilyOfElements P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t x : FamilyOfElements P (Sieve.pullback f S).arrows hx : FamilyOfElements.Compatible x y : ⦃Z : C⦄ → (g : Z ⟶ Y) → FamilyOfElements P (Sieve.pullback (𝟙 Z) (Sieve.pullback (g ≫ f) S)).arrows := fun Z g ZZ gg hgg => x (gg ≫ g) (_ : (Sieve.pullback f S).arrows (gg ≫ g)) hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), FamilyOfElements.Compatible (y g) z : ⦃Z : C⦄ → ⦃g : Z ⟶ Y⦄ → (Sieve.pullback f R).arrows g → P.obj (Opposite.op Z) hz : ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : (Sieve.pullback f R).arrows g), FamilyOfElements.IsAmalgamation (y g) (z hg) q : FamilyOfElements P (Sieve.pullback f R).arrows := fun Z g hg => z hg ⊢ ∃ t, FamilyOfElements.IsAmalgamation x t
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg
have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply] rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz] · dsimp; congr 1; simp only [Category.assoc, h] · simpa [reassoc_of% h] using hgg · simpa using hgg
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) Y : C f : Y ⟶ X H : ∀ {X : C}, ∀ R ∈ covering K X, IsSeparatedFor P R ∧ ∀ (x : FamilyOfElements P R), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H1 : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSeparatedFor P (Sieve.pullback f R).arrows H1' : ∀ ⦃Y : C⦄ (f : Y ⟶ X) (x : FamilyOfElements P (Sieve.pullback f R).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y), IsSeparatedFor P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows H2' : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y) (x : FamilyOfElements P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t x : FamilyOfElements P (Sieve.pullback f S).arrows hx : FamilyOfElements.Compatible x y : ⦃Z : C⦄ → (g : Z ⟶ Y) → FamilyOfElements P (Sieve.pullback (𝟙 Z) (Sieve.pullback (g ≫ f) S)).arrows := fun Z g ZZ gg hgg => x (gg ≫ g) (_ : (Sieve.pullback f S).arrows (gg ≫ g)) hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), FamilyOfElements.Compatible (y g) z : ⦃Z : C⦄ → ⦃g : Z ⟶ Y⦄ → (Sieve.pullback f R).arrows g → P.obj (Opposite.op Z) hz : ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : (Sieve.pullback f R).arrows g), FamilyOfElements.IsAmalgamation (y g) (z hg) q : FamilyOfElements P (Sieve.pullback f R).arrows := fun Z g hg => z hg ⊢ FamilyOfElements.Compatible q
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by
intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) Y : C f : Y ⟶ X H : ∀ {X : C}, ∀ R ∈ covering K X, IsSeparatedFor P R ∧ ∀ (x : FamilyOfElements P R), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H1 : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSeparatedFor P (Sieve.pullback f R).arrows H1' : ∀ ⦃Y : C⦄ (f : Y ⟶ X) (x : FamilyOfElements P (Sieve.pullback f R).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y), IsSeparatedFor P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows H2' : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y) (x : FamilyOfElements P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t x : FamilyOfElements P (Sieve.pullback f S).arrows hx : FamilyOfElements.Compatible x y : ⦃Z : C⦄ → (g : Z ⟶ Y) → FamilyOfElements P (Sieve.pullback (𝟙 Z) (Sieve.pullback (g ≫ f) S)).arrows := fun Z g ZZ gg hgg => x (gg ≫ g) (_ : (Sieve.pullback f S).arrows (gg ≫ g)) hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), FamilyOfElements.Compatible (y g) z : ⦃Z : C⦄ → ⦃g : Z ⟶ Y⦄ → (Sieve.pullback f R).arrows g → P.obj (Opposite.op Z) hz : ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : (Sieve.pullback f R).arrows g), FamilyOfElements.IsAmalgamation (y g) (z hg) q : FamilyOfElements P (Sieve.pullback f R).arrows := fun Z g hg => z hg Y₁ Y₂ Z : C g₁ : Z ⟶ Y₁ g₂ : Z ⟶ Y₂ f₁ : Y₁ ⟶ Y f₂ : Y₂ ⟶ Y h₁ : (Sieve.pullback f R).arrows f₁ h₂ : (Sieve.pullback f R).arrows f₂ h : g₁ ≫ f₁ = g₂ ≫ f₂ ⊢ P.map g₁.op (q f₁ h₁) = P.map g₂.op (q f₂ h₂)
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h
apply (H2 h₁ g₁).ext
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) Y : C f : Y ⟶ X H : ∀ {X : C}, ∀ R ∈ covering K X, IsSeparatedFor P R ∧ ∀ (x : FamilyOfElements P R), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H1 : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSeparatedFor P (Sieve.pullback f R).arrows H1' : ∀ ⦃Y : C⦄ (f : Y ⟶ X) (x : FamilyOfElements P (Sieve.pullback f R).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y), IsSeparatedFor P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows H2' : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y) (x : FamilyOfElements P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t x : FamilyOfElements P (Sieve.pullback f S).arrows hx : FamilyOfElements.Compatible x y : ⦃Z : C⦄ → (g : Z ⟶ Y) → FamilyOfElements P (Sieve.pullback (𝟙 Z) (Sieve.pullback (g ≫ f) S)).arrows := fun Z g ZZ gg hgg => x (gg ≫ g) (_ : (Sieve.pullback f S).arrows (gg ≫ g)) hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), FamilyOfElements.Compatible (y g) z : ⦃Z : C⦄ → ⦃g : Z ⟶ Y⦄ → (Sieve.pullback f R).arrows g → P.obj (Opposite.op Z) hz : ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : (Sieve.pullback f R).arrows g), FamilyOfElements.IsAmalgamation (y g) (z hg) q : FamilyOfElements P (Sieve.pullback f R).arrows := fun Z g hg => z hg Y₁ Y₂ Z : C g₁ : Z ⟶ Y₁ g₂ : Z ⟶ Y₂ f₁ : Y₁ ⟶ Y f₂ : Y₂ ⟶ Y h₁ : (Sieve.pullback f R).arrows f₁ h₂ : (Sieve.pullback f R).arrows f₂ h : g₁ ≫ f₁ = g₂ ≫ f₂ ⊢ ∀ ⦃Y_1 : C⦄ ⦃f_1 : Y_1 ⟶ Z⦄, (Sieve.pullback g₁ (Sieve.pullback (f₁ ≫ f) S)).arrows f_1 → P.map f_1.op (P.map g₁.op (q f₁ h₁)) = P.map f_1.op (P.map g₂.op (q f₂ h₂))
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext
intro ZZ gg hgg
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) Y : C f : Y ⟶ X H : ∀ {X : C}, ∀ R ∈ covering K X, IsSeparatedFor P R ∧ ∀ (x : FamilyOfElements P R), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H1 : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSeparatedFor P (Sieve.pullback f R).arrows H1' : ∀ ⦃Y : C⦄ (f : Y ⟶ X) (x : FamilyOfElements P (Sieve.pullback f R).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y), IsSeparatedFor P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows H2' : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y) (x : FamilyOfElements P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t x : FamilyOfElements P (Sieve.pullback f S).arrows hx : FamilyOfElements.Compatible x y : ⦃Z : C⦄ → (g : Z ⟶ Y) → FamilyOfElements P (Sieve.pullback (𝟙 Z) (Sieve.pullback (g ≫ f) S)).arrows := fun Z g ZZ gg hgg => x (gg ≫ g) (_ : (Sieve.pullback f S).arrows (gg ≫ g)) hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), FamilyOfElements.Compatible (y g) z : ⦃Z : C⦄ → ⦃g : Z ⟶ Y⦄ → (Sieve.pullback f R).arrows g → P.obj (Opposite.op Z) hz : ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : (Sieve.pullback f R).arrows g), FamilyOfElements.IsAmalgamation (y g) (z hg) q : FamilyOfElements P (Sieve.pullback f R).arrows := fun Z g hg => z hg Y₁ Y₂ Z : C g₁ : Z ⟶ Y₁ g₂ : Z ⟶ Y₂ f₁ : Y₁ ⟶ Y f₂ : Y₂ ⟶ Y h₁ : (Sieve.pullback f R).arrows f₁ h₂ : (Sieve.pullback f R).arrows f₂ h : g₁ ≫ f₁ = g₂ ≫ f₂ ZZ : C gg : ZZ ⟶ Z hgg : (Sieve.pullback g₁ (Sieve.pullback (f₁ ≫ f) S)).arrows gg ⊢ P.map gg.op (P.map g₁.op (q f₁ h₁)) = P.map gg.op (P.map g₂.op (q f₂ h₂))
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg
simp only [← types_comp_apply]
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) Y : C f : Y ⟶ X H : ∀ {X : C}, ∀ R ∈ covering K X, IsSeparatedFor P R ∧ ∀ (x : FamilyOfElements P R), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H1 : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSeparatedFor P (Sieve.pullback f R).arrows H1' : ∀ ⦃Y : C⦄ (f : Y ⟶ X) (x : FamilyOfElements P (Sieve.pullback f R).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y), IsSeparatedFor P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows H2' : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y) (x : FamilyOfElements P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t x : FamilyOfElements P (Sieve.pullback f S).arrows hx : FamilyOfElements.Compatible x y : ⦃Z : C⦄ → (g : Z ⟶ Y) → FamilyOfElements P (Sieve.pullback (𝟙 Z) (Sieve.pullback (g ≫ f) S)).arrows := fun Z g ZZ gg hgg => x (gg ≫ g) (_ : (Sieve.pullback f S).arrows (gg ≫ g)) hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), FamilyOfElements.Compatible (y g) z : ⦃Z : C⦄ → ⦃g : Z ⟶ Y⦄ → (Sieve.pullback f R).arrows g → P.obj (Opposite.op Z) hz : ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : (Sieve.pullback f R).arrows g), FamilyOfElements.IsAmalgamation (y g) (z hg) q : FamilyOfElements P (Sieve.pullback f R).arrows := fun Z g hg => z hg Y₁ Y₂ Z : C g₁ : Z ⟶ Y₁ g₂ : Z ⟶ Y₂ f₁ : Y₁ ⟶ Y f₂ : Y₂ ⟶ Y h₁ : (Sieve.pullback f R).arrows f₁ h₂ : (Sieve.pullback f R).arrows f₂ h : g₁ ≫ f₁ = g₂ ≫ f₂ ZZ : C gg : ZZ ⟶ Z hgg : (Sieve.pullback g₁ (Sieve.pullback (f₁ ≫ f) S)).arrows gg ⊢ (P.map g₁.op ≫ P.map gg.op) (z h₁) = (P.map g₂.op ≫ P.map gg.op) (z h₂)
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply]
rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz]
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply]
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) Y : C f : Y ⟶ X H : ∀ {X : C}, ∀ R ∈ covering K X, IsSeparatedFor P R ∧ ∀ (x : FamilyOfElements P R), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H1 : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSeparatedFor P (Sieve.pullback f R).arrows H1' : ∀ ⦃Y : C⦄ (f : Y ⟶ X) (x : FamilyOfElements P (Sieve.pullback f R).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y), IsSeparatedFor P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows H2' : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y) (x : FamilyOfElements P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t x : FamilyOfElements P (Sieve.pullback f S).arrows hx : FamilyOfElements.Compatible x y : ⦃Z : C⦄ → (g : Z ⟶ Y) → FamilyOfElements P (Sieve.pullback (𝟙 Z) (Sieve.pullback (g ≫ f) S)).arrows := fun Z g ZZ gg hgg => x (gg ≫ g) (_ : (Sieve.pullback f S).arrows (gg ≫ g)) hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), FamilyOfElements.Compatible (y g) z : ⦃Z : C⦄ → ⦃g : Z ⟶ Y⦄ → (Sieve.pullback f R).arrows g → P.obj (Opposite.op Z) hz : ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : (Sieve.pullback f R).arrows g), FamilyOfElements.IsAmalgamation (y g) (z hg) q : FamilyOfElements P (Sieve.pullback f R).arrows := fun Z g hg => z hg Y₁ Y₂ Z : C g₁ : Z ⟶ Y₁ g₂ : Z ⟶ Y₂ f₁ : Y₁ ⟶ Y f₂ : Y₂ ⟶ Y h₁ : (Sieve.pullback f R).arrows f₁ h₂ : (Sieve.pullback f R).arrows f₂ h : g₁ ≫ f₁ = g₂ ≫ f₂ ZZ : C gg : ZZ ⟶ Z hgg : (Sieve.pullback g₁ (Sieve.pullback (f₁ ≫ f) S)).arrows gg ⊢ y f₁ (gg ≫ g₁) ?h = y f₂ (gg ≫ g₂) ?h
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply] rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz] ·
dsimp
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply] rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz] ·
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) Y : C f : Y ⟶ X H : ∀ {X : C}, ∀ R ∈ covering K X, IsSeparatedFor P R ∧ ∀ (x : FamilyOfElements P R), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H1 : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSeparatedFor P (Sieve.pullback f R).arrows H1' : ∀ ⦃Y : C⦄ (f : Y ⟶ X) (x : FamilyOfElements P (Sieve.pullback f R).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y), IsSeparatedFor P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows H2' : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y) (x : FamilyOfElements P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t x : FamilyOfElements P (Sieve.pullback f S).arrows hx : FamilyOfElements.Compatible x y : ⦃Z : C⦄ → (g : Z ⟶ Y) → FamilyOfElements P (Sieve.pullback (𝟙 Z) (Sieve.pullback (g ≫ f) S)).arrows := fun Z g ZZ gg hgg => x (gg ≫ g) (_ : (Sieve.pullback f S).arrows (gg ≫ g)) hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), FamilyOfElements.Compatible (y g) z : ⦃Z : C⦄ → ⦃g : Z ⟶ Y⦄ → (Sieve.pullback f R).arrows g → P.obj (Opposite.op Z) hz : ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : (Sieve.pullback f R).arrows g), FamilyOfElements.IsAmalgamation (y g) (z hg) q : FamilyOfElements P (Sieve.pullback f R).arrows := fun Z g hg => z hg Y₁ Y₂ Z : C g₁ : Z ⟶ Y₁ g₂ : Z ⟶ Y₂ f₁ : Y₁ ⟶ Y f₂ : Y₂ ⟶ Y h₁ : (Sieve.pullback f R).arrows f₁ h₂ : (Sieve.pullback f R).arrows f₂ h : g₁ ≫ f₁ = g₂ ≫ f₂ ZZ : C gg : ZZ ⟶ Z hgg : (Sieve.pullback g₁ (Sieve.pullback (f₁ ≫ f) S)).arrows gg ⊢ x ((gg ≫ g₁) ≫ f₁) (_ : S.arrows (((gg ≫ g₁) ≫ f₁) ≫ f)) = x ((gg ≫ g₂) ≫ f₂) (_ : S.arrows (((gg ≫ g₂) ≫ f₂) ≫ f))
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply] rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz] · dsimp;
congr 1
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply] rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz] · dsimp;
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case e_f C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) Y : C f : Y ⟶ X H : ∀ {X : C}, ∀ R ∈ covering K X, IsSeparatedFor P R ∧ ∀ (x : FamilyOfElements P R), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H1 : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSeparatedFor P (Sieve.pullback f R).arrows H1' : ∀ ⦃Y : C⦄ (f : Y ⟶ X) (x : FamilyOfElements P (Sieve.pullback f R).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y), IsSeparatedFor P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows H2' : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y) (x : FamilyOfElements P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t x : FamilyOfElements P (Sieve.pullback f S).arrows hx : FamilyOfElements.Compatible x y : ⦃Z : C⦄ → (g : Z ⟶ Y) → FamilyOfElements P (Sieve.pullback (𝟙 Z) (Sieve.pullback (g ≫ f) S)).arrows := fun Z g ZZ gg hgg => x (gg ≫ g) (_ : (Sieve.pullback f S).arrows (gg ≫ g)) hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), FamilyOfElements.Compatible (y g) z : ⦃Z : C⦄ → ⦃g : Z ⟶ Y⦄ → (Sieve.pullback f R).arrows g → P.obj (Opposite.op Z) hz : ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : (Sieve.pullback f R).arrows g), FamilyOfElements.IsAmalgamation (y g) (z hg) q : FamilyOfElements P (Sieve.pullback f R).arrows := fun Z g hg => z hg Y₁ Y₂ Z : C g₁ : Z ⟶ Y₁ g₂ : Z ⟶ Y₂ f₁ : Y₁ ⟶ Y f₂ : Y₂ ⟶ Y h₁ : (Sieve.pullback f R).arrows f₁ h₂ : (Sieve.pullback f R).arrows f₂ h : g₁ ≫ f₁ = g₂ ≫ f₂ ZZ : C gg : ZZ ⟶ Z hgg : (Sieve.pullback g₁ (Sieve.pullback (f₁ ≫ f) S)).arrows gg ⊢ (gg ≫ g₁) ≫ f₁ = (gg ≫ g₂) ≫ f₂
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply] rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz] · dsimp; congr 1;
simp only [Category.assoc, h]
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply] rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz] · dsimp; congr 1;
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case h C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) Y : C f : Y ⟶ X H : ∀ {X : C}, ∀ R ∈ covering K X, IsSeparatedFor P R ∧ ∀ (x : FamilyOfElements P R), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H1 : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSeparatedFor P (Sieve.pullback f R).arrows H1' : ∀ ⦃Y : C⦄ (f : Y ⟶ X) (x : FamilyOfElements P (Sieve.pullback f R).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y), IsSeparatedFor P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows H2' : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y) (x : FamilyOfElements P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t x : FamilyOfElements P (Sieve.pullback f S).arrows hx : FamilyOfElements.Compatible x y : ⦃Z : C⦄ → (g : Z ⟶ Y) → FamilyOfElements P (Sieve.pullback (𝟙 Z) (Sieve.pullback (g ≫ f) S)).arrows := fun Z g ZZ gg hgg => x (gg ≫ g) (_ : (Sieve.pullback f S).arrows (gg ≫ g)) hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), FamilyOfElements.Compatible (y g) z : ⦃Z : C⦄ → ⦃g : Z ⟶ Y⦄ → (Sieve.pullback f R).arrows g → P.obj (Opposite.op Z) hz : ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : (Sieve.pullback f R).arrows g), FamilyOfElements.IsAmalgamation (y g) (z hg) q : FamilyOfElements P (Sieve.pullback f R).arrows := fun Z g hg => z hg Y₁ Y₂ Z : C g₁ : Z ⟶ Y₁ g₂ : Z ⟶ Y₂ f₁ : Y₁ ⟶ Y f₂ : Y₂ ⟶ Y h₁ : (Sieve.pullback f R).arrows f₁ h₂ : (Sieve.pullback f R).arrows f₂ h : g₁ ≫ f₁ = g₂ ≫ f₂ ZZ : C gg : ZZ ⟶ Z hgg : (Sieve.pullback g₁ (Sieve.pullback (f₁ ≫ f) S)).arrows gg ⊢ (Sieve.pullback (𝟙 Y₂) (Sieve.pullback (f₂ ≫ f) S)).arrows (gg ≫ g₂)
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply] rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz] · dsimp; congr 1; simp only [Category.assoc, h] ·
simpa [reassoc_of% h] using hgg
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply] rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz] · dsimp; congr 1; simp only [Category.assoc, h] ·
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case h C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) Y : C f : Y ⟶ X H : ∀ {X : C}, ∀ R ∈ covering K X, IsSeparatedFor P R ∧ ∀ (x : FamilyOfElements P R), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H1 : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSeparatedFor P (Sieve.pullback f R).arrows H1' : ∀ ⦃Y : C⦄ (f : Y ⟶ X) (x : FamilyOfElements P (Sieve.pullback f R).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y), IsSeparatedFor P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows H2' : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y) (x : FamilyOfElements P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t x : FamilyOfElements P (Sieve.pullback f S).arrows hx : FamilyOfElements.Compatible x y : ⦃Z : C⦄ → (g : Z ⟶ Y) → FamilyOfElements P (Sieve.pullback (𝟙 Z) (Sieve.pullback (g ≫ f) S)).arrows := fun Z g ZZ gg hgg => x (gg ≫ g) (_ : (Sieve.pullback f S).arrows (gg ≫ g)) hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), FamilyOfElements.Compatible (y g) z : ⦃Z : C⦄ → ⦃g : Z ⟶ Y⦄ → (Sieve.pullback f R).arrows g → P.obj (Opposite.op Z) hz : ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : (Sieve.pullback f R).arrows g), FamilyOfElements.IsAmalgamation (y g) (z hg) q : FamilyOfElements P (Sieve.pullback f R).arrows := fun Z g hg => z hg Y₁ Y₂ Z : C g₁ : Z ⟶ Y₁ g₂ : Z ⟶ Y₂ f₁ : Y₁ ⟶ Y f₂ : Y₂ ⟶ Y h₁ : (Sieve.pullback f R).arrows f₁ h₂ : (Sieve.pullback f R).arrows f₂ h : g₁ ≫ f₁ = g₂ ≫ f₂ ZZ : C gg : ZZ ⟶ Z hgg : (Sieve.pullback g₁ (Sieve.pullback (f₁ ≫ f) S)).arrows gg ⊢ (Sieve.pullback (𝟙 Y₁) (Sieve.pullback (f₁ ≫ f) S)).arrows (gg ≫ g₁)
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply] rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz] · dsimp; congr 1; simp only [Category.assoc, h] · simpa [reassoc_of% h] using hgg ·
simpa using hgg
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply] rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz] · dsimp; congr 1; simp only [Category.assoc, h] · simpa [reassoc_of% h] using hgg ·
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr.transitive.refine_2 C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) Y : C f : Y ⟶ X H : ∀ {X : C}, ∀ R ∈ covering K X, IsSeparatedFor P R ∧ ∀ (x : FamilyOfElements P R), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H1 : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSeparatedFor P (Sieve.pullback f R).arrows H1' : ∀ ⦃Y : C⦄ (f : Y ⟶ X) (x : FamilyOfElements P (Sieve.pullback f R).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y), IsSeparatedFor P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows H2' : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y) (x : FamilyOfElements P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t x : FamilyOfElements P (Sieve.pullback f S).arrows hx : FamilyOfElements.Compatible x y : ⦃Z : C⦄ → (g : Z ⟶ Y) → FamilyOfElements P (Sieve.pullback (𝟙 Z) (Sieve.pullback (g ≫ f) S)).arrows := fun Z g ZZ gg hgg => x (gg ≫ g) (_ : (Sieve.pullback f S).arrows (gg ≫ g)) hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), FamilyOfElements.Compatible (y g) z : ⦃Z : C⦄ → ⦃g : Z ⟶ Y⦄ → (Sieve.pullback f R).arrows g → P.obj (Opposite.op Z) hz : ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : (Sieve.pullback f R).arrows g), FamilyOfElements.IsAmalgamation (y g) (z hg) q : FamilyOfElements P (Sieve.pullback f R).arrows := fun Z g hg => z hg hq : FamilyOfElements.Compatible q ⊢ ∃ t, FamilyOfElements.IsAmalgamation x t
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply] rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz] · dsimp; congr 1; simp only [Category.assoc, h] · simpa [reassoc_of% h] using hgg · simpa using hgg
obtain ⟨t, ht⟩ := H1' f q hq
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply] rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz] · dsimp; congr 1; simp only [Category.assoc, h] · simpa [reassoc_of% h] using hgg · simpa using hgg
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr.transitive.refine_2.intro C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) Y : C f : Y ⟶ X H : ∀ {X : C}, ∀ R ∈ covering K X, IsSeparatedFor P R ∧ ∀ (x : FamilyOfElements P R), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H1 : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSeparatedFor P (Sieve.pullback f R).arrows H1' : ∀ ⦃Y : C⦄ (f : Y ⟶ X) (x : FamilyOfElements P (Sieve.pullback f R).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y), IsSeparatedFor P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows H2' : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y) (x : FamilyOfElements P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t x : FamilyOfElements P (Sieve.pullback f S).arrows hx : FamilyOfElements.Compatible x y : ⦃Z : C⦄ → (g : Z ⟶ Y) → FamilyOfElements P (Sieve.pullback (𝟙 Z) (Sieve.pullback (g ≫ f) S)).arrows := fun Z g ZZ gg hgg => x (gg ≫ g) (_ : (Sieve.pullback f S).arrows (gg ≫ g)) hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), FamilyOfElements.Compatible (y g) z : ⦃Z : C⦄ → ⦃g : Z ⟶ Y⦄ → (Sieve.pullback f R).arrows g → P.obj (Opposite.op Z) hz : ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : (Sieve.pullback f R).arrows g), FamilyOfElements.IsAmalgamation (y g) (z hg) q : FamilyOfElements P (Sieve.pullback f R).arrows := fun Z g hg => z hg hq : FamilyOfElements.Compatible q t : P.obj (Opposite.op Y) ht : FamilyOfElements.IsAmalgamation q t ⊢ ∃ t, FamilyOfElements.IsAmalgamation x t
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply] rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz] · dsimp; congr 1; simp only [Category.assoc, h] · simpa [reassoc_of% h] using hgg · simpa using hgg obtain ⟨t, ht⟩ := H1' f q hq
refine ⟨t, fun Z g hg => ?_⟩
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply] rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz] · dsimp; congr 1; simp only [Category.assoc, h] · simpa [reassoc_of% h] using hgg · simpa using hgg obtain ⟨t, ht⟩ := H1' f q hq
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr.transitive.refine_2.intro C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) Y : C f : Y ⟶ X H : ∀ {X : C}, ∀ R ∈ covering K X, IsSeparatedFor P R ∧ ∀ (x : FamilyOfElements P R), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H1 : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSeparatedFor P (Sieve.pullback f R).arrows H1' : ∀ ⦃Y : C⦄ (f : Y ⟶ X) (x : FamilyOfElements P (Sieve.pullback f R).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y), IsSeparatedFor P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows H2' : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y) (x : FamilyOfElements P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t x : FamilyOfElements P (Sieve.pullback f S).arrows hx : FamilyOfElements.Compatible x y : ⦃Z : C⦄ → (g : Z ⟶ Y) → FamilyOfElements P (Sieve.pullback (𝟙 Z) (Sieve.pullback (g ≫ f) S)).arrows := fun Z g ZZ gg hgg => x (gg ≫ g) (_ : (Sieve.pullback f S).arrows (gg ≫ g)) hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), FamilyOfElements.Compatible (y g) z : ⦃Z : C⦄ → ⦃g : Z ⟶ Y⦄ → (Sieve.pullback f R).arrows g → P.obj (Opposite.op Z) hz : ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : (Sieve.pullback f R).arrows g), FamilyOfElements.IsAmalgamation (y g) (z hg) q : FamilyOfElements P (Sieve.pullback f R).arrows := fun Z g hg => z hg hq : FamilyOfElements.Compatible q t : P.obj (Opposite.op Y) ht : FamilyOfElements.IsAmalgamation q t Z : C g : Z ⟶ Y hg : (Sieve.pullback f S).arrows g ⊢ P.map g.op t = x g hg
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply] rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz] · dsimp; congr 1; simp only [Category.assoc, h] · simpa [reassoc_of% h] using hgg · simpa using hgg obtain ⟨t, ht⟩ := H1' f q hq refine ⟨t, fun Z g hg => ?_⟩
refine (H1 (g ≫ f)).ext (fun ZZ gg hgg => ?_)
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply] rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz] · dsimp; congr 1; simp only [Category.assoc, h] · simpa [reassoc_of% h] using hgg · simpa using hgg obtain ⟨t, ht⟩ := H1' f q hq refine ⟨t, fun Z g hg => ?_⟩
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr.transitive.refine_2.intro C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) Y : C f : Y ⟶ X H : ∀ {X : C}, ∀ R ∈ covering K X, IsSeparatedFor P R ∧ ∀ (x : FamilyOfElements P R), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H1 : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSeparatedFor P (Sieve.pullback f R).arrows H1' : ∀ ⦃Y : C⦄ (f : Y ⟶ X) (x : FamilyOfElements P (Sieve.pullback f R).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y), IsSeparatedFor P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows H2' : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y) (x : FamilyOfElements P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t x : FamilyOfElements P (Sieve.pullback f S).arrows hx : FamilyOfElements.Compatible x y : ⦃Z : C⦄ → (g : Z ⟶ Y) → FamilyOfElements P (Sieve.pullback (𝟙 Z) (Sieve.pullback (g ≫ f) S)).arrows := fun Z g ZZ gg hgg => x (gg ≫ g) (_ : (Sieve.pullback f S).arrows (gg ≫ g)) hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), FamilyOfElements.Compatible (y g) z : ⦃Z : C⦄ → ⦃g : Z ⟶ Y⦄ → (Sieve.pullback f R).arrows g → P.obj (Opposite.op Z) hz : ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : (Sieve.pullback f R).arrows g), FamilyOfElements.IsAmalgamation (y g) (z hg) q : FamilyOfElements P (Sieve.pullback f R).arrows := fun Z g hg => z hg hq : FamilyOfElements.Compatible q t : P.obj (Opposite.op Y) ht : FamilyOfElements.IsAmalgamation q t Z : C g : Z ⟶ Y hg : (Sieve.pullback f S).arrows g ZZ : C gg : ZZ ⟶ Z hgg : (Sieve.pullback (g ≫ f) R).arrows gg ⊢ P.map gg.op (P.map g.op t) = P.map gg.op (x g hg)
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply] rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz] · dsimp; congr 1; simp only [Category.assoc, h] · simpa [reassoc_of% h] using hgg · simpa using hgg obtain ⟨t, ht⟩ := H1' f q hq refine ⟨t, fun Z g hg => ?_⟩ refine (H1 (g ≫ f)).ext (fun ZZ gg hgg => ?_)
rw [← types_comp_apply _ (P.map gg.op), ← P.map_comp, ← op_comp, ht]
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply] rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz] · dsimp; congr 1; simp only [Category.assoc, h] · simpa [reassoc_of% h] using hgg · simpa using hgg obtain ⟨t, ht⟩ := H1' f q hq refine ⟨t, fun Z g hg => ?_⟩ refine (H1 (g ≫ f)).ext (fun ZZ gg hgg => ?_)
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr.transitive.refine_2.intro C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) Y : C f : Y ⟶ X H : ∀ {X : C}, ∀ R ∈ covering K X, IsSeparatedFor P R ∧ ∀ (x : FamilyOfElements P R), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H1 : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSeparatedFor P (Sieve.pullback f R).arrows H1' : ∀ ⦃Y : C⦄ (f : Y ⟶ X) (x : FamilyOfElements P (Sieve.pullback f R).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y), IsSeparatedFor P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows H2' : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y) (x : FamilyOfElements P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t x : FamilyOfElements P (Sieve.pullback f S).arrows hx : FamilyOfElements.Compatible x y : ⦃Z : C⦄ → (g : Z ⟶ Y) → FamilyOfElements P (Sieve.pullback (𝟙 Z) (Sieve.pullback (g ≫ f) S)).arrows := fun Z g ZZ gg hgg => x (gg ≫ g) (_ : (Sieve.pullback f S).arrows (gg ≫ g)) hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), FamilyOfElements.Compatible (y g) z : ⦃Z : C⦄ → ⦃g : Z ⟶ Y⦄ → (Sieve.pullback f R).arrows g → P.obj (Opposite.op Z) hz : ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : (Sieve.pullback f R).arrows g), FamilyOfElements.IsAmalgamation (y g) (z hg) q : FamilyOfElements P (Sieve.pullback f R).arrows := fun Z g hg => z hg hq : FamilyOfElements.Compatible q t : P.obj (Opposite.op Y) ht : FamilyOfElements.IsAmalgamation q t Z : C g : Z ⟶ Y hg : (Sieve.pullback f S).arrows g ZZ : C gg : ZZ ⟶ Z hgg : (Sieve.pullback (g ≫ f) R).arrows gg ⊢ q (gg ≫ g) ?mpr.transitive.refine_2.intro.h = P.map gg.op (x g hg) case mpr.transitive.refine_2.intro.h C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) Y : C f : Y ⟶ X H : ∀ {X : C}, ∀ R ∈ covering K X, IsSeparatedFor P R ∧ ∀ (x : FamilyOfElements P R), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H1 : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSeparatedFor P (Sieve.pullback f R).arrows H1' : ∀ ⦃Y : C⦄ (f : Y ⟶ X) (x : FamilyOfElements P (Sieve.pullback f R).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y), IsSeparatedFor P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows H2' : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y) (x : FamilyOfElements P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t x : FamilyOfElements P (Sieve.pullback f S).arrows hx : FamilyOfElements.Compatible x y : ⦃Z : C⦄ → (g : Z ⟶ Y) → FamilyOfElements P (Sieve.pullback (𝟙 Z) (Sieve.pullback (g ≫ f) S)).arrows := fun Z g ZZ gg hgg => x (gg ≫ g) (_ : (Sieve.pullback f S).arrows (gg ≫ g)) hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), FamilyOfElements.Compatible (y g) z : ⦃Z : C⦄ → ⦃g : Z ⟶ Y⦄ → (Sieve.pullback f R).arrows g → P.obj (Opposite.op Z) hz : ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : (Sieve.pullback f R).arrows g), FamilyOfElements.IsAmalgamation (y g) (z hg) q : FamilyOfElements P (Sieve.pullback f R).arrows := fun Z g hg => z hg hq : FamilyOfElements.Compatible q t : P.obj (Opposite.op Y) ht : FamilyOfElements.IsAmalgamation q t Z : C g : Z ⟶ Y hg : (Sieve.pullback f S).arrows g ZZ : C gg : ZZ ⟶ Z hgg : (Sieve.pullback (g ≫ f) R).arrows gg ⊢ (Sieve.pullback f R).arrows (gg ≫ g)
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply] rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz] · dsimp; congr 1; simp only [Category.assoc, h] · simpa [reassoc_of% h] using hgg · simpa using hgg obtain ⟨t, ht⟩ := H1' f q hq refine ⟨t, fun Z g hg => ?_⟩ refine (H1 (g ≫ f)).ext (fun ZZ gg hgg => ?_) rw [← types_comp_apply _ (P.map gg.op), ← P.map_comp, ← op_comp, ht]
swap
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply] rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz] · dsimp; congr 1; simp only [Category.assoc, h] · simpa [reassoc_of% h] using hgg · simpa using hgg obtain ⟨t, ht⟩ := H1' f q hq refine ⟨t, fun Z g hg => ?_⟩ refine (H1 (g ≫ f)).ext (fun ZZ gg hgg => ?_) rw [← types_comp_apply _ (P.map gg.op), ← P.map_comp, ← op_comp, ht]
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr.transitive.refine_2.intro.h C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) Y : C f : Y ⟶ X H : ∀ {X : C}, ∀ R ∈ covering K X, IsSeparatedFor P R ∧ ∀ (x : FamilyOfElements P R), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H1 : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSeparatedFor P (Sieve.pullback f R).arrows H1' : ∀ ⦃Y : C⦄ (f : Y ⟶ X) (x : FamilyOfElements P (Sieve.pullback f R).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y), IsSeparatedFor P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows H2' : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y) (x : FamilyOfElements P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t x : FamilyOfElements P (Sieve.pullback f S).arrows hx : FamilyOfElements.Compatible x y : ⦃Z : C⦄ → (g : Z ⟶ Y) → FamilyOfElements P (Sieve.pullback (𝟙 Z) (Sieve.pullback (g ≫ f) S)).arrows := fun Z g ZZ gg hgg => x (gg ≫ g) (_ : (Sieve.pullback f S).arrows (gg ≫ g)) hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), FamilyOfElements.Compatible (y g) z : ⦃Z : C⦄ → ⦃g : Z ⟶ Y⦄ → (Sieve.pullback f R).arrows g → P.obj (Opposite.op Z) hz : ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : (Sieve.pullback f R).arrows g), FamilyOfElements.IsAmalgamation (y g) (z hg) q : FamilyOfElements P (Sieve.pullback f R).arrows := fun Z g hg => z hg hq : FamilyOfElements.Compatible q t : P.obj (Opposite.op Y) ht : FamilyOfElements.IsAmalgamation q t Z : C g : Z ⟶ Y hg : (Sieve.pullback f S).arrows g ZZ : C gg : ZZ ⟶ Z hgg : (Sieve.pullback (g ≫ f) R).arrows gg ⊢ (Sieve.pullback f R).arrows (gg ≫ g) case mpr.transitive.refine_2.intro C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) Y : C f : Y ⟶ X H : ∀ {X : C}, ∀ R ∈ covering K X, IsSeparatedFor P R ∧ ∀ (x : FamilyOfElements P R), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H1 : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSeparatedFor P (Sieve.pullback f R).arrows H1' : ∀ ⦃Y : C⦄ (f : Y ⟶ X) (x : FamilyOfElements P (Sieve.pullback f R).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y), IsSeparatedFor P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows H2' : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y) (x : FamilyOfElements P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t x : FamilyOfElements P (Sieve.pullback f S).arrows hx : FamilyOfElements.Compatible x y : ⦃Z : C⦄ → (g : Z ⟶ Y) → FamilyOfElements P (Sieve.pullback (𝟙 Z) (Sieve.pullback (g ≫ f) S)).arrows := fun Z g ZZ gg hgg => x (gg ≫ g) (_ : (Sieve.pullback f S).arrows (gg ≫ g)) hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), FamilyOfElements.Compatible (y g) z : ⦃Z : C⦄ → ⦃g : Z ⟶ Y⦄ → (Sieve.pullback f R).arrows g → P.obj (Opposite.op Z) hz : ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : (Sieve.pullback f R).arrows g), FamilyOfElements.IsAmalgamation (y g) (z hg) q : FamilyOfElements P (Sieve.pullback f R).arrows := fun Z g hg => z hg hq : FamilyOfElements.Compatible q t : P.obj (Opposite.op Y) ht : FamilyOfElements.IsAmalgamation q t Z : C g : Z ⟶ Y hg : (Sieve.pullback f S).arrows g ZZ : C gg : ZZ ⟶ Z hgg : (Sieve.pullback (g ≫ f) R).arrows gg ⊢ q (gg ≫ g) ?mpr.transitive.refine_2.intro.h = P.map gg.op (x g hg)
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply] rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz] · dsimp; congr 1; simp only [Category.assoc, h] · simpa [reassoc_of% h] using hgg · simpa using hgg obtain ⟨t, ht⟩ := H1' f q hq refine ⟨t, fun Z g hg => ?_⟩ refine (H1 (g ≫ f)).ext (fun ZZ gg hgg => ?_) rw [← types_comp_apply _ (P.map gg.op), ← P.map_comp, ← op_comp, ht] swap;
simpa using hgg
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply] rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz] · dsimp; congr 1; simp only [Category.assoc, h] · simpa [reassoc_of% h] using hgg · simpa using hgg obtain ⟨t, ht⟩ := H1' f q hq refine ⟨t, fun Z g hg => ?_⟩ refine (H1 (g ≫ f)).ext (fun ZZ gg hgg => ?_) rw [← types_comp_apply _ (P.map gg.op), ← P.map_comp, ← op_comp, ht] swap;
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr.transitive.refine_2.intro C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) Y : C f : Y ⟶ X H : ∀ {X : C}, ∀ R ∈ covering K X, IsSeparatedFor P R ∧ ∀ (x : FamilyOfElements P R), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H1 : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSeparatedFor P (Sieve.pullback f R).arrows H1' : ∀ ⦃Y : C⦄ (f : Y ⟶ X) (x : FamilyOfElements P (Sieve.pullback f R).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y), IsSeparatedFor P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows H2' : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y) (x : FamilyOfElements P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t x : FamilyOfElements P (Sieve.pullback f S).arrows hx : FamilyOfElements.Compatible x y : ⦃Z : C⦄ → (g : Z ⟶ Y) → FamilyOfElements P (Sieve.pullback (𝟙 Z) (Sieve.pullback (g ≫ f) S)).arrows := fun Z g ZZ gg hgg => x (gg ≫ g) (_ : (Sieve.pullback f S).arrows (gg ≫ g)) hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), FamilyOfElements.Compatible (y g) z : ⦃Z : C⦄ → ⦃g : Z ⟶ Y⦄ → (Sieve.pullback f R).arrows g → P.obj (Opposite.op Z) hz : ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : (Sieve.pullback f R).arrows g), FamilyOfElements.IsAmalgamation (y g) (z hg) q : FamilyOfElements P (Sieve.pullback f R).arrows := fun Z g hg => z hg hq : FamilyOfElements.Compatible q t : P.obj (Opposite.op Y) ht : FamilyOfElements.IsAmalgamation q t Z : C g : Z ⟶ Y hg : (Sieve.pullback f S).arrows g ZZ : C gg : ZZ ⟶ Z hgg : (Sieve.pullback (g ≫ f) R).arrows gg ⊢ q (gg ≫ g) (_ : (Sieve.pullback f R).arrows (gg ≫ g)) = P.map gg.op (x g hg)
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply] rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz] · dsimp; congr 1; simp only [Category.assoc, h] · simpa [reassoc_of% h] using hgg · simpa using hgg obtain ⟨t, ht⟩ := H1' f q hq refine ⟨t, fun Z g hg => ?_⟩ refine (H1 (g ≫ f)).ext (fun ZZ gg hgg => ?_) rw [← types_comp_apply _ (P.map gg.op), ← P.map_comp, ← op_comp, ht] swap; simpa using hgg
refine (H2 hgg (𝟙 _)).ext (fun ZZZ ggg hggg => ?_)
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply] rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz] · dsimp; congr 1; simp only [Category.assoc, h] · simpa [reassoc_of% h] using hgg · simpa using hgg obtain ⟨t, ht⟩ := H1' f q hq refine ⟨t, fun Z g hg => ?_⟩ refine (H1 (g ≫ f)).ext (fun ZZ gg hgg => ?_) rw [← types_comp_apply _ (P.map gg.op), ← P.map_comp, ← op_comp, ht] swap; simpa using hgg
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr.transitive.refine_2.intro C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) Y : C f : Y ⟶ X H : ∀ {X : C}, ∀ R ∈ covering K X, IsSeparatedFor P R ∧ ∀ (x : FamilyOfElements P R), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H1 : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSeparatedFor P (Sieve.pullback f R).arrows H1' : ∀ ⦃Y : C⦄ (f : Y ⟶ X) (x : FamilyOfElements P (Sieve.pullback f R).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y), IsSeparatedFor P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows H2' : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y) (x : FamilyOfElements P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t x : FamilyOfElements P (Sieve.pullback f S).arrows hx : FamilyOfElements.Compatible x y : ⦃Z : C⦄ → (g : Z ⟶ Y) → FamilyOfElements P (Sieve.pullback (𝟙 Z) (Sieve.pullback (g ≫ f) S)).arrows := fun Z g ZZ gg hgg => x (gg ≫ g) (_ : (Sieve.pullback f S).arrows (gg ≫ g)) hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), FamilyOfElements.Compatible (y g) z : ⦃Z : C⦄ → ⦃g : Z ⟶ Y⦄ → (Sieve.pullback f R).arrows g → P.obj (Opposite.op Z) hz : ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : (Sieve.pullback f R).arrows g), FamilyOfElements.IsAmalgamation (y g) (z hg) q : FamilyOfElements P (Sieve.pullback f R).arrows := fun Z g hg => z hg hq : FamilyOfElements.Compatible q t : P.obj (Opposite.op Y) ht : FamilyOfElements.IsAmalgamation q t Z : C g : Z ⟶ Y hg : (Sieve.pullback f S).arrows g ZZ : C gg : ZZ ⟶ Z hgg : (Sieve.pullback (g ≫ f) R).arrows gg ZZZ : C ggg : ZZZ ⟶ ZZ hggg : (Sieve.pullback (𝟙 ZZ) (Sieve.pullback (gg ≫ g ≫ f) S)).arrows ggg ⊢ P.map ggg.op (q (gg ≫ g) (_ : (Sieve.pullback f R).arrows (gg ≫ g))) = P.map ggg.op (P.map gg.op (x g hg))
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply] rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz] · dsimp; congr 1; simp only [Category.assoc, h] · simpa [reassoc_of% h] using hgg · simpa using hgg obtain ⟨t, ht⟩ := H1' f q hq refine ⟨t, fun Z g hg => ?_⟩ refine (H1 (g ≫ f)).ext (fun ZZ gg hgg => ?_) rw [← types_comp_apply _ (P.map gg.op), ← P.map_comp, ← op_comp, ht] swap; simpa using hgg refine (H2 hgg (𝟙 _)).ext (fun ZZZ ggg hggg => ?_)
rw [← types_comp_apply _ (P.map ggg.op), ← P.map_comp, ← op_comp, hz]
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply] rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz] · dsimp; congr 1; simp only [Category.assoc, h] · simpa [reassoc_of% h] using hgg · simpa using hgg obtain ⟨t, ht⟩ := H1' f q hq refine ⟨t, fun Z g hg => ?_⟩ refine (H1 (g ≫ f)).ext (fun ZZ gg hgg => ?_) rw [← types_comp_apply _ (P.map gg.op), ← P.map_comp, ← op_comp, ht] swap; simpa using hgg refine (H2 hgg (𝟙 _)).ext (fun ZZZ ggg hggg => ?_)
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr.transitive.refine_2.intro C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) Y : C f : Y ⟶ X H : ∀ {X : C}, ∀ R ∈ covering K X, IsSeparatedFor P R ∧ ∀ (x : FamilyOfElements P R), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H1 : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSeparatedFor P (Sieve.pullback f R).arrows H1' : ∀ ⦃Y : C⦄ (f : Y ⟶ X) (x : FamilyOfElements P (Sieve.pullback f R).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y), IsSeparatedFor P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows H2' : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y) (x : FamilyOfElements P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t x : FamilyOfElements P (Sieve.pullback f S).arrows hx : FamilyOfElements.Compatible x y : ⦃Z : C⦄ → (g : Z ⟶ Y) → FamilyOfElements P (Sieve.pullback (𝟙 Z) (Sieve.pullback (g ≫ f) S)).arrows := fun Z g ZZ gg hgg => x (gg ≫ g) (_ : (Sieve.pullback f S).arrows (gg ≫ g)) hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), FamilyOfElements.Compatible (y g) z : ⦃Z : C⦄ → ⦃g : Z ⟶ Y⦄ → (Sieve.pullback f R).arrows g → P.obj (Opposite.op Z) hz : ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : (Sieve.pullback f R).arrows g), FamilyOfElements.IsAmalgamation (y g) (z hg) q : FamilyOfElements P (Sieve.pullback f R).arrows := fun Z g hg => z hg hq : FamilyOfElements.Compatible q t : P.obj (Opposite.op Y) ht : FamilyOfElements.IsAmalgamation q t Z : C g : Z ⟶ Y hg : (Sieve.pullback f S).arrows g ZZ : C gg : ZZ ⟶ Z hgg : (Sieve.pullback (g ≫ f) R).arrows gg ZZZ : C ggg : ZZZ ⟶ ZZ hggg : (Sieve.pullback (𝟙 ZZ) (Sieve.pullback (gg ≫ g ≫ f) S)).arrows ggg ⊢ y (gg ≫ g) ggg ?mpr.transitive.refine_2.intro.h = P.map (ggg ≫ gg).op (x g hg) case mpr.transitive.refine_2.intro.h C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) Y : C f : Y ⟶ X H : ∀ {X : C}, ∀ R ∈ covering K X, IsSeparatedFor P R ∧ ∀ (x : FamilyOfElements P R), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H1 : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSeparatedFor P (Sieve.pullback f R).arrows H1' : ∀ ⦃Y : C⦄ (f : Y ⟶ X) (x : FamilyOfElements P (Sieve.pullback f R).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y), IsSeparatedFor P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows H2' : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y) (x : FamilyOfElements P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t x : FamilyOfElements P (Sieve.pullback f S).arrows hx : FamilyOfElements.Compatible x y : ⦃Z : C⦄ → (g : Z ⟶ Y) → FamilyOfElements P (Sieve.pullback (𝟙 Z) (Sieve.pullback (g ≫ f) S)).arrows := fun Z g ZZ gg hgg => x (gg ≫ g) (_ : (Sieve.pullback f S).arrows (gg ≫ g)) hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), FamilyOfElements.Compatible (y g) z : ⦃Z : C⦄ → ⦃g : Z ⟶ Y⦄ → (Sieve.pullback f R).arrows g → P.obj (Opposite.op Z) hz : ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : (Sieve.pullback f R).arrows g), FamilyOfElements.IsAmalgamation (y g) (z hg) q : FamilyOfElements P (Sieve.pullback f R).arrows := fun Z g hg => z hg hq : FamilyOfElements.Compatible q t : P.obj (Opposite.op Y) ht : FamilyOfElements.IsAmalgamation q t Z : C g : Z ⟶ Y hg : (Sieve.pullback f S).arrows g ZZ : C gg : ZZ ⟶ Z hgg : (Sieve.pullback (g ≫ f) R).arrows gg ZZZ : C ggg : ZZZ ⟶ ZZ hggg : (Sieve.pullback (𝟙 ZZ) (Sieve.pullback (gg ≫ g ≫ f) S)).arrows ggg ⊢ (Sieve.pullback (𝟙 ZZ) (Sieve.pullback ((gg ≫ g) ≫ f) S)).arrows ggg
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply] rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz] · dsimp; congr 1; simp only [Category.assoc, h] · simpa [reassoc_of% h] using hgg · simpa using hgg obtain ⟨t, ht⟩ := H1' f q hq refine ⟨t, fun Z g hg => ?_⟩ refine (H1 (g ≫ f)).ext (fun ZZ gg hgg => ?_) rw [← types_comp_apply _ (P.map gg.op), ← P.map_comp, ← op_comp, ht] swap; simpa using hgg refine (H2 hgg (𝟙 _)).ext (fun ZZZ ggg hggg => ?_) rw [← types_comp_apply _ (P.map ggg.op), ← P.map_comp, ← op_comp, hz]
swap
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply] rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz] · dsimp; congr 1; simp only [Category.assoc, h] · simpa [reassoc_of% h] using hgg · simpa using hgg obtain ⟨t, ht⟩ := H1' f q hq refine ⟨t, fun Z g hg => ?_⟩ refine (H1 (g ≫ f)).ext (fun ZZ gg hgg => ?_) rw [← types_comp_apply _ (P.map gg.op), ← P.map_comp, ← op_comp, ht] swap; simpa using hgg refine (H2 hgg (𝟙 _)).ext (fun ZZZ ggg hggg => ?_) rw [← types_comp_apply _ (P.map ggg.op), ← P.map_comp, ← op_comp, hz]
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr.transitive.refine_2.intro.h C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) Y : C f : Y ⟶ X H : ∀ {X : C}, ∀ R ∈ covering K X, IsSeparatedFor P R ∧ ∀ (x : FamilyOfElements P R), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H1 : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSeparatedFor P (Sieve.pullback f R).arrows H1' : ∀ ⦃Y : C⦄ (f : Y ⟶ X) (x : FamilyOfElements P (Sieve.pullback f R).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y), IsSeparatedFor P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows H2' : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y) (x : FamilyOfElements P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t x : FamilyOfElements P (Sieve.pullback f S).arrows hx : FamilyOfElements.Compatible x y : ⦃Z : C⦄ → (g : Z ⟶ Y) → FamilyOfElements P (Sieve.pullback (𝟙 Z) (Sieve.pullback (g ≫ f) S)).arrows := fun Z g ZZ gg hgg => x (gg ≫ g) (_ : (Sieve.pullback f S).arrows (gg ≫ g)) hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), FamilyOfElements.Compatible (y g) z : ⦃Z : C⦄ → ⦃g : Z ⟶ Y⦄ → (Sieve.pullback f R).arrows g → P.obj (Opposite.op Z) hz : ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : (Sieve.pullback f R).arrows g), FamilyOfElements.IsAmalgamation (y g) (z hg) q : FamilyOfElements P (Sieve.pullback f R).arrows := fun Z g hg => z hg hq : FamilyOfElements.Compatible q t : P.obj (Opposite.op Y) ht : FamilyOfElements.IsAmalgamation q t Z : C g : Z ⟶ Y hg : (Sieve.pullback f S).arrows g ZZ : C gg : ZZ ⟶ Z hgg : (Sieve.pullback (g ≫ f) R).arrows gg ZZZ : C ggg : ZZZ ⟶ ZZ hggg : (Sieve.pullback (𝟙 ZZ) (Sieve.pullback (gg ≫ g ≫ f) S)).arrows ggg ⊢ (Sieve.pullback (𝟙 ZZ) (Sieve.pullback ((gg ≫ g) ≫ f) S)).arrows ggg case mpr.transitive.refine_2.intro C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) Y : C f : Y ⟶ X H : ∀ {X : C}, ∀ R ∈ covering K X, IsSeparatedFor P R ∧ ∀ (x : FamilyOfElements P R), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H1 : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSeparatedFor P (Sieve.pullback f R).arrows H1' : ∀ ⦃Y : C⦄ (f : Y ⟶ X) (x : FamilyOfElements P (Sieve.pullback f R).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y), IsSeparatedFor P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows H2' : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y) (x : FamilyOfElements P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t x : FamilyOfElements P (Sieve.pullback f S).arrows hx : FamilyOfElements.Compatible x y : ⦃Z : C⦄ → (g : Z ⟶ Y) → FamilyOfElements P (Sieve.pullback (𝟙 Z) (Sieve.pullback (g ≫ f) S)).arrows := fun Z g ZZ gg hgg => x (gg ≫ g) (_ : (Sieve.pullback f S).arrows (gg ≫ g)) hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), FamilyOfElements.Compatible (y g) z : ⦃Z : C⦄ → ⦃g : Z ⟶ Y⦄ → (Sieve.pullback f R).arrows g → P.obj (Opposite.op Z) hz : ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : (Sieve.pullback f R).arrows g), FamilyOfElements.IsAmalgamation (y g) (z hg) q : FamilyOfElements P (Sieve.pullback f R).arrows := fun Z g hg => z hg hq : FamilyOfElements.Compatible q t : P.obj (Opposite.op Y) ht : FamilyOfElements.IsAmalgamation q t Z : C g : Z ⟶ Y hg : (Sieve.pullback f S).arrows g ZZ : C gg : ZZ ⟶ Z hgg : (Sieve.pullback (g ≫ f) R).arrows gg ZZZ : C ggg : ZZZ ⟶ ZZ hggg : (Sieve.pullback (𝟙 ZZ) (Sieve.pullback (gg ≫ g ≫ f) S)).arrows ggg ⊢ y (gg ≫ g) ggg ?mpr.transitive.refine_2.intro.h = P.map (ggg ≫ gg).op (x g hg)
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply] rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz] · dsimp; congr 1; simp only [Category.assoc, h] · simpa [reassoc_of% h] using hgg · simpa using hgg obtain ⟨t, ht⟩ := H1' f q hq refine ⟨t, fun Z g hg => ?_⟩ refine (H1 (g ≫ f)).ext (fun ZZ gg hgg => ?_) rw [← types_comp_apply _ (P.map gg.op), ← P.map_comp, ← op_comp, ht] swap; simpa using hgg refine (H2 hgg (𝟙 _)).ext (fun ZZZ ggg hggg => ?_) rw [← types_comp_apply _ (P.map ggg.op), ← P.map_comp, ← op_comp, hz] swap;
simpa using hggg
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply] rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz] · dsimp; congr 1; simp only [Category.assoc, h] · simpa [reassoc_of% h] using hgg · simpa using hgg obtain ⟨t, ht⟩ := H1' f q hq refine ⟨t, fun Z g hg => ?_⟩ refine (H1 (g ≫ f)).ext (fun ZZ gg hgg => ?_) rw [← types_comp_apply _ (P.map gg.op), ← P.map_comp, ← op_comp, ht] swap; simpa using hgg refine (H2 hgg (𝟙 _)).ext (fun ZZZ ggg hggg => ?_) rw [← types_comp_apply _ (P.map ggg.op), ← P.map_comp, ← op_comp, hz] swap;
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr.transitive.refine_2.intro C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) Y : C f : Y ⟶ X H : ∀ {X : C}, ∀ R ∈ covering K X, IsSeparatedFor P R ∧ ∀ (x : FamilyOfElements P R), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H1 : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSeparatedFor P (Sieve.pullback f R).arrows H1' : ∀ ⦃Y : C⦄ (f : Y ⟶ X) (x : FamilyOfElements P (Sieve.pullback f R).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y), IsSeparatedFor P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows H2' : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y) (x : FamilyOfElements P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t x : FamilyOfElements P (Sieve.pullback f S).arrows hx : FamilyOfElements.Compatible x y : ⦃Z : C⦄ → (g : Z ⟶ Y) → FamilyOfElements P (Sieve.pullback (𝟙 Z) (Sieve.pullback (g ≫ f) S)).arrows := fun Z g ZZ gg hgg => x (gg ≫ g) (_ : (Sieve.pullback f S).arrows (gg ≫ g)) hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), FamilyOfElements.Compatible (y g) z : ⦃Z : C⦄ → ⦃g : Z ⟶ Y⦄ → (Sieve.pullback f R).arrows g → P.obj (Opposite.op Z) hz : ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : (Sieve.pullback f R).arrows g), FamilyOfElements.IsAmalgamation (y g) (z hg) q : FamilyOfElements P (Sieve.pullback f R).arrows := fun Z g hg => z hg hq : FamilyOfElements.Compatible q t : P.obj (Opposite.op Y) ht : FamilyOfElements.IsAmalgamation q t Z : C g : Z ⟶ Y hg : (Sieve.pullback f S).arrows g ZZ : C gg : ZZ ⟶ Z hgg : (Sieve.pullback (g ≫ f) R).arrows gg ZZZ : C ggg : ZZZ ⟶ ZZ hggg : (Sieve.pullback (𝟙 ZZ) (Sieve.pullback (gg ≫ g ≫ f) S)).arrows ggg ⊢ y (gg ≫ g) ggg (_ : (Sieve.pullback (𝟙 ZZ) (Sieve.pullback ((gg ≫ g) ≫ f) S)).arrows ggg) = P.map (ggg ≫ gg).op (x g hg)
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply] rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz] · dsimp; congr 1; simp only [Category.assoc, h] · simpa [reassoc_of% h] using hgg · simpa using hgg obtain ⟨t, ht⟩ := H1' f q hq refine ⟨t, fun Z g hg => ?_⟩ refine (H1 (g ≫ f)).ext (fun ZZ gg hgg => ?_) rw [← types_comp_apply _ (P.map gg.op), ← P.map_comp, ← op_comp, ht] swap; simpa using hgg refine (H2 hgg (𝟙 _)).ext (fun ZZZ ggg hggg => ?_) rw [← types_comp_apply _ (P.map ggg.op), ← P.map_comp, ← op_comp, hz] swap; simpa using hggg
refine (H2 hgg ggg).ext (fun ZZZZ gggg _ => ?_)
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply] rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz] · dsimp; congr 1; simp only [Category.assoc, h] · simpa [reassoc_of% h] using hgg · simpa using hgg obtain ⟨t, ht⟩ := H1' f q hq refine ⟨t, fun Z g hg => ?_⟩ refine (H1 (g ≫ f)).ext (fun ZZ gg hgg => ?_) rw [← types_comp_apply _ (P.map gg.op), ← P.map_comp, ← op_comp, ht] swap; simpa using hgg refine (H2 hgg (𝟙 _)).ext (fun ZZZ ggg hggg => ?_) rw [← types_comp_apply _ (P.map ggg.op), ← P.map_comp, ← op_comp, hz] swap; simpa using hggg
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr.transitive.refine_2.intro C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) Y : C f : Y ⟶ X H : ∀ {X : C}, ∀ R ∈ covering K X, IsSeparatedFor P R ∧ ∀ (x : FamilyOfElements P R), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H1 : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSeparatedFor P (Sieve.pullback f R).arrows H1' : ∀ ⦃Y : C⦄ (f : Y ⟶ X) (x : FamilyOfElements P (Sieve.pullback f R).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y), IsSeparatedFor P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows H2' : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y) (x : FamilyOfElements P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t x : FamilyOfElements P (Sieve.pullback f S).arrows hx : FamilyOfElements.Compatible x y : ⦃Z : C⦄ → (g : Z ⟶ Y) → FamilyOfElements P (Sieve.pullback (𝟙 Z) (Sieve.pullback (g ≫ f) S)).arrows := fun Z g ZZ gg hgg => x (gg ≫ g) (_ : (Sieve.pullback f S).arrows (gg ≫ g)) hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), FamilyOfElements.Compatible (y g) z : ⦃Z : C⦄ → ⦃g : Z ⟶ Y⦄ → (Sieve.pullback f R).arrows g → P.obj (Opposite.op Z) hz : ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : (Sieve.pullback f R).arrows g), FamilyOfElements.IsAmalgamation (y g) (z hg) q : FamilyOfElements P (Sieve.pullback f R).arrows := fun Z g hg => z hg hq : FamilyOfElements.Compatible q t : P.obj (Opposite.op Y) ht : FamilyOfElements.IsAmalgamation q t Z : C g : Z ⟶ Y hg : (Sieve.pullback f S).arrows g ZZ : C gg : ZZ ⟶ Z hgg : (Sieve.pullback (g ≫ f) R).arrows gg ZZZ : C ggg : ZZZ ⟶ ZZ hggg : (Sieve.pullback (𝟙 ZZ) (Sieve.pullback (gg ≫ g ≫ f) S)).arrows ggg ZZZZ : C gggg : ZZZZ ⟶ ZZZ x✝ : (Sieve.pullback ggg (Sieve.pullback (gg ≫ g ≫ f) S)).arrows gggg ⊢ P.map gggg.op (y (gg ≫ g) ggg (_ : (Sieve.pullback (𝟙 ZZ) (Sieve.pullback ((gg ≫ g) ≫ f) S)).arrows ggg)) = P.map gggg.op (P.map (ggg ≫ gg).op (x g hg))
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply] rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz] · dsimp; congr 1; simp only [Category.assoc, h] · simpa [reassoc_of% h] using hgg · simpa using hgg obtain ⟨t, ht⟩ := H1' f q hq refine ⟨t, fun Z g hg => ?_⟩ refine (H1 (g ≫ f)).ext (fun ZZ gg hgg => ?_) rw [← types_comp_apply _ (P.map gg.op), ← P.map_comp, ← op_comp, ht] swap; simpa using hgg refine (H2 hgg (𝟙 _)).ext (fun ZZZ ggg hggg => ?_) rw [← types_comp_apply _ (P.map ggg.op), ← P.map_comp, ← op_comp, hz] swap; simpa using hggg refine (H2 hgg ggg).ext (fun ZZZZ gggg _ => ?_)
rw [← types_comp_apply _ (P.map gggg.op), ← P.map_comp, ← op_comp]
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply] rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz] · dsimp; congr 1; simp only [Category.assoc, h] · simpa [reassoc_of% h] using hgg · simpa using hgg obtain ⟨t, ht⟩ := H1' f q hq refine ⟨t, fun Z g hg => ?_⟩ refine (H1 (g ≫ f)).ext (fun ZZ gg hgg => ?_) rw [← types_comp_apply _ (P.map gg.op), ← P.map_comp, ← op_comp, ht] swap; simpa using hgg refine (H2 hgg (𝟙 _)).ext (fun ZZZ ggg hggg => ?_) rw [← types_comp_apply _ (P.map ggg.op), ← P.map_comp, ← op_comp, hz] swap; simpa using hggg refine (H2 hgg ggg).ext (fun ZZZZ gggg _ => ?_)
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr.transitive.refine_2.intro C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) Y : C f : Y ⟶ X H : ∀ {X : C}, ∀ R ∈ covering K X, IsSeparatedFor P R ∧ ∀ (x : FamilyOfElements P R), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H1 : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSeparatedFor P (Sieve.pullback f R).arrows H1' : ∀ ⦃Y : C⦄ (f : Y ⟶ X) (x : FamilyOfElements P (Sieve.pullback f R).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y), IsSeparatedFor P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows H2' : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y) (x : FamilyOfElements P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t x : FamilyOfElements P (Sieve.pullback f S).arrows hx : FamilyOfElements.Compatible x y : ⦃Z : C⦄ → (g : Z ⟶ Y) → FamilyOfElements P (Sieve.pullback (𝟙 Z) (Sieve.pullback (g ≫ f) S)).arrows := fun Z g ZZ gg hgg => x (gg ≫ g) (_ : (Sieve.pullback f S).arrows (gg ≫ g)) hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), FamilyOfElements.Compatible (y g) z : ⦃Z : C⦄ → ⦃g : Z ⟶ Y⦄ → (Sieve.pullback f R).arrows g → P.obj (Opposite.op Z) hz : ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : (Sieve.pullback f R).arrows g), FamilyOfElements.IsAmalgamation (y g) (z hg) q : FamilyOfElements P (Sieve.pullback f R).arrows := fun Z g hg => z hg hq : FamilyOfElements.Compatible q t : P.obj (Opposite.op Y) ht : FamilyOfElements.IsAmalgamation q t Z : C g : Z ⟶ Y hg : (Sieve.pullback f S).arrows g ZZ : C gg : ZZ ⟶ Z hgg : (Sieve.pullback (g ≫ f) R).arrows gg ZZZ : C ggg : ZZZ ⟶ ZZ hggg : (Sieve.pullback (𝟙 ZZ) (Sieve.pullback (gg ≫ g ≫ f) S)).arrows ggg ZZZZ : C gggg : ZZZZ ⟶ ZZZ x✝ : (Sieve.pullback ggg (Sieve.pullback (gg ≫ g ≫ f) S)).arrows gggg ⊢ P.map gggg.op (y (gg ≫ g) ggg (_ : (Sieve.pullback (𝟙 ZZ) (Sieve.pullback ((gg ≫ g) ≫ f) S)).arrows ggg)) = P.map (gggg ≫ ggg ≫ gg).op (x g hg)
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply] rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz] · dsimp; congr 1; simp only [Category.assoc, h] · simpa [reassoc_of% h] using hgg · simpa using hgg obtain ⟨t, ht⟩ := H1' f q hq refine ⟨t, fun Z g hg => ?_⟩ refine (H1 (g ≫ f)).ext (fun ZZ gg hgg => ?_) rw [← types_comp_apply _ (P.map gg.op), ← P.map_comp, ← op_comp, ht] swap; simpa using hgg refine (H2 hgg (𝟙 _)).ext (fun ZZZ ggg hggg => ?_) rw [← types_comp_apply _ (P.map ggg.op), ← P.map_comp, ← op_comp, hz] swap; simpa using hggg refine (H2 hgg ggg).ext (fun ZZZZ gggg _ => ?_) rw [← types_comp_apply _ (P.map gggg.op), ← P.map_comp, ← op_comp]
apply hx
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply] rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz] · dsimp; congr 1; simp only [Category.assoc, h] · simpa [reassoc_of% h] using hgg · simpa using hgg obtain ⟨t, ht⟩ := H1' f q hq refine ⟨t, fun Z g hg => ?_⟩ refine (H1 (g ≫ f)).ext (fun ZZ gg hgg => ?_) rw [← types_comp_apply _ (P.map gg.op), ← P.map_comp, ← op_comp, ht] swap; simpa using hgg refine (H2 hgg (𝟙 _)).ext (fun ZZZ ggg hggg => ?_) rw [← types_comp_apply _ (P.map ggg.op), ← P.map_comp, ← op_comp, hz] swap; simpa using hggg refine (H2 hgg ggg).ext (fun ZZZZ gggg _ => ?_) rw [← types_comp_apply _ (P.map gggg.op), ← P.map_comp, ← op_comp]
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
case mpr.transitive.refine_2.intro.a C : Type u_1 inst✝ : Category.{u_2, u_1} C K : Coverage C P : Cᵒᵖ ⥤ Type w X✝ : C S✝ : Sieve X✝ X : C R S : Sieve X a✝¹ : saturate K X R a✝ : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → saturate K Y (Sieve.pullback f S) Y : C f : Y ⟶ X H : ∀ {X : C}, ∀ R ∈ covering K X, IsSeparatedFor P R ∧ ∀ (x : FamilyOfElements P R), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H1 : ∀ ⦃Y : C⦄ (f : Y ⟶ X), IsSeparatedFor P (Sieve.pullback f R).arrows H1' : ∀ ⦃Y : C⦄ (f : Y ⟶ X) (x : FamilyOfElements P (Sieve.pullback f R).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t H2 : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y), IsSeparatedFor P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows H2' : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → ∀ ⦃Y_1 : C⦄ (f_1 : Y_1 ⟶ Y) (x : FamilyOfElements P (Sieve.pullback f_1 (Sieve.pullback f S)).arrows), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t x : FamilyOfElements P (Sieve.pullback f S).arrows hx : FamilyOfElements.Compatible x y : ⦃Z : C⦄ → (g : Z ⟶ Y) → FamilyOfElements P (Sieve.pullback (𝟙 Z) (Sieve.pullback (g ≫ f) S)).arrows := fun Z g ZZ gg hgg => x (gg ≫ g) (_ : (Sieve.pullback f S).arrows (gg ≫ g)) hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), FamilyOfElements.Compatible (y g) z : ⦃Z : C⦄ → ⦃g : Z ⟶ Y⦄ → (Sieve.pullback f R).arrows g → P.obj (Opposite.op Z) hz : ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : (Sieve.pullback f R).arrows g), FamilyOfElements.IsAmalgamation (y g) (z hg) q : FamilyOfElements P (Sieve.pullback f R).arrows := fun Z g hg => z hg hq : FamilyOfElements.Compatible q t : P.obj (Opposite.op Y) ht : FamilyOfElements.IsAmalgamation q t Z : C g : Z ⟶ Y hg : (Sieve.pullback f S).arrows g ZZ : C gg : ZZ ⟶ Z hgg : (Sieve.pullback (g ≫ f) R).arrows gg ZZZ : C ggg : ZZZ ⟶ ZZ hggg : (Sieve.pullback (𝟙 ZZ) (Sieve.pullback (gg ≫ g ≫ f) S)).arrows ggg ZZZZ : C gggg : ZZZZ ⟶ ZZZ x✝ : (Sieve.pullback ggg (Sieve.pullback (gg ≫ g ≫ f) S)).arrows gggg ⊢ gggg ≫ ggg ≫ gg ≫ g = (gggg ≫ ggg ≫ gg) ≫ g
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply] rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz] · dsimp; congr 1; simp only [Category.assoc, h] · simpa [reassoc_of% h] using hgg · simpa using hgg obtain ⟨t, ht⟩ := H1' f q hq refine ⟨t, fun Z g hg => ?_⟩ refine (H1 (g ≫ f)).ext (fun ZZ gg hgg => ?_) rw [← types_comp_apply _ (P.map gg.op), ← P.map_comp, ← op_comp, ht] swap; simpa using hgg refine (H2 hgg (𝟙 _)).ext (fun ZZZ ggg hggg => ?_) rw [← types_comp_apply _ (P.map ggg.op), ← P.map_comp, ← op_comp, hz] swap; simpa using hggg refine (H2 hgg ggg).ext (fun ZZZZ gggg _ => ?_) rw [← types_comp_apply _ (P.map gggg.op), ← P.map_comp, ← op_comp] apply hx
simp
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply] rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz] · dsimp; congr 1; simp only [Category.assoc, h] · simpa [reassoc_of% h] using hgg · simpa using hgg obtain ⟨t, ht⟩ := H1' f q hq refine ⟨t, fun Z g hg => ?_⟩ refine (H1 (g ≫ f)).ext (fun ZZ gg hgg => ?_) rw [← types_comp_apply _ (P.map gg.op), ← P.map_comp, ← op_comp, ht] swap; simpa using hgg refine (H2 hgg (𝟙 _)).ext (fun ZZZ ggg hggg => ?_) rw [← types_comp_apply _ (P.map ggg.op), ← P.map_comp, ← op_comp, hz] swap; simpa using hggg refine (H2 hgg ggg).ext (fun ZZZZ gggg _ => ?_) rw [← types_comp_apply _ (P.map gggg.op), ← P.map_comp, ← op_comp] apply hx
Mathlib.CategoryTheory.Sites.Coverage.313_0.qkZFgqEgDC2P633
/-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R)
Mathlib_CategoryTheory_Sites_Coverage
C : Type u_1 inst✝ : Category.{u_2, u_1} C K L : Coverage C P : Cᵒᵖ ⥤ Type w ⊢ IsSheaf (toGrothendieck C (K ⊔ L)) P ↔ IsSheaf (toGrothendieck C K) P ∧ IsSheaf (toGrothendieck C L) P
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply] rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz] · dsimp; congr 1; simp only [Category.assoc, h] · simpa [reassoc_of% h] using hgg · simpa using hgg obtain ⟨t, ht⟩ := H1' f q hq refine ⟨t, fun Z g hg => ?_⟩ refine (H1 (g ≫ f)).ext (fun ZZ gg hgg => ?_) rw [← types_comp_apply _ (P.map gg.op), ← P.map_comp, ← op_comp, ht] swap; simpa using hgg refine (H2 hgg (𝟙 _)).ext (fun ZZZ ggg hggg => ?_) rw [← types_comp_apply _ (P.map ggg.op), ← P.map_comp, ← op_comp, hz] swap; simpa using hggg refine (H2 hgg ggg).ext (fun ZZZZ gggg _ => ?_) rw [← types_comp_apply _ (P.map gggg.op), ← P.map_comp, ← op_comp] apply hx simp /-- A presheaf is a sheaf for the Grothendieck topology generated by a union of coverages iff it is a sheaf for the Grothendieck topology generated by each coverage separately. -/ theorem isSheaf_sup (K L : Coverage C) (P : Cᵒᵖ ⥤ Type w) : (Presieve.IsSheaf ((K ⊔ L).toGrothendieck C)) P ↔ (Presieve.IsSheaf (K.toGrothendieck C)) P ∧ (Presieve.IsSheaf (L.toGrothendieck C)) P := by
refine ⟨fun h ↦ ⟨Presieve.isSheaf_of_le _ ((gi C).gc.monotone_l le_sup_left) h, Presieve.isSheaf_of_le _ ((gi C).gc.monotone_l le_sup_right) h⟩, fun h ↦ ?_⟩
/-- A presheaf is a sheaf for the Grothendieck topology generated by a union of coverages iff it is a sheaf for the Grothendieck topology generated by each coverage separately. -/ theorem isSheaf_sup (K L : Coverage C) (P : Cᵒᵖ ⥤ Type w) : (Presieve.IsSheaf ((K ⊔ L).toGrothendieck C)) P ↔ (Presieve.IsSheaf (K.toGrothendieck C)) P ∧ (Presieve.IsSheaf (L.toGrothendieck C)) P := by
Mathlib.CategoryTheory.Sites.Coverage.388_0.qkZFgqEgDC2P633
/-- A presheaf is a sheaf for the Grothendieck topology generated by a union of coverages iff it is a sheaf for the Grothendieck topology generated by each coverage separately. -/ theorem isSheaf_sup (K L : Coverage C) (P : Cᵒᵖ ⥤ Type w) : (Presieve.IsSheaf ((K ⊔ L).toGrothendieck C)) P ↔ (Presieve.IsSheaf (K.toGrothendieck C)) P ∧ (Presieve.IsSheaf (L.toGrothendieck C)) P
Mathlib_CategoryTheory_Sites_Coverage
C : Type u_1 inst✝ : Category.{u_2, u_1} C K L : Coverage C P : Cᵒᵖ ⥤ Type w h : IsSheaf (toGrothendieck C K) P ∧ IsSheaf (toGrothendieck C L) P ⊢ IsSheaf (toGrothendieck C (K ⊔ L)) P
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply] rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz] · dsimp; congr 1; simp only [Category.assoc, h] · simpa [reassoc_of% h] using hgg · simpa using hgg obtain ⟨t, ht⟩ := H1' f q hq refine ⟨t, fun Z g hg => ?_⟩ refine (H1 (g ≫ f)).ext (fun ZZ gg hgg => ?_) rw [← types_comp_apply _ (P.map gg.op), ← P.map_comp, ← op_comp, ht] swap; simpa using hgg refine (H2 hgg (𝟙 _)).ext (fun ZZZ ggg hggg => ?_) rw [← types_comp_apply _ (P.map ggg.op), ← P.map_comp, ← op_comp, hz] swap; simpa using hggg refine (H2 hgg ggg).ext (fun ZZZZ gggg _ => ?_) rw [← types_comp_apply _ (P.map gggg.op), ← P.map_comp, ← op_comp] apply hx simp /-- A presheaf is a sheaf for the Grothendieck topology generated by a union of coverages iff it is a sheaf for the Grothendieck topology generated by each coverage separately. -/ theorem isSheaf_sup (K L : Coverage C) (P : Cᵒᵖ ⥤ Type w) : (Presieve.IsSheaf ((K ⊔ L).toGrothendieck C)) P ↔ (Presieve.IsSheaf (K.toGrothendieck C)) P ∧ (Presieve.IsSheaf (L.toGrothendieck C)) P := by refine ⟨fun h ↦ ⟨Presieve.isSheaf_of_le _ ((gi C).gc.monotone_l le_sup_left) h, Presieve.isSheaf_of_le _ ((gi C).gc.monotone_l le_sup_right) h⟩, fun h ↦ ?_⟩
rw [isSheaf_coverage, isSheaf_coverage] at h
/-- A presheaf is a sheaf for the Grothendieck topology generated by a union of coverages iff it is a sheaf for the Grothendieck topology generated by each coverage separately. -/ theorem isSheaf_sup (K L : Coverage C) (P : Cᵒᵖ ⥤ Type w) : (Presieve.IsSheaf ((K ⊔ L).toGrothendieck C)) P ↔ (Presieve.IsSheaf (K.toGrothendieck C)) P ∧ (Presieve.IsSheaf (L.toGrothendieck C)) P := by refine ⟨fun h ↦ ⟨Presieve.isSheaf_of_le _ ((gi C).gc.monotone_l le_sup_left) h, Presieve.isSheaf_of_le _ ((gi C).gc.monotone_l le_sup_right) h⟩, fun h ↦ ?_⟩
Mathlib.CategoryTheory.Sites.Coverage.388_0.qkZFgqEgDC2P633
/-- A presheaf is a sheaf for the Grothendieck topology generated by a union of coverages iff it is a sheaf for the Grothendieck topology generated by each coverage separately. -/ theorem isSheaf_sup (K L : Coverage C) (P : Cᵒᵖ ⥤ Type w) : (Presieve.IsSheaf ((K ⊔ L).toGrothendieck C)) P ↔ (Presieve.IsSheaf (K.toGrothendieck C)) P ∧ (Presieve.IsSheaf (L.toGrothendieck C)) P
Mathlib_CategoryTheory_Sites_Coverage
C : Type u_1 inst✝ : Category.{u_2, u_1} C K L : Coverage C P : Cᵒᵖ ⥤ Type w h : (∀ {X : C}, ∀ R ∈ covering K X, IsSheafFor P R) ∧ ∀ {X : C}, ∀ R ∈ covering L X, IsSheafFor P R ⊢ IsSheaf (toGrothendieck C (K ⊔ L)) P
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply] rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz] · dsimp; congr 1; simp only [Category.assoc, h] · simpa [reassoc_of% h] using hgg · simpa using hgg obtain ⟨t, ht⟩ := H1' f q hq refine ⟨t, fun Z g hg => ?_⟩ refine (H1 (g ≫ f)).ext (fun ZZ gg hgg => ?_) rw [← types_comp_apply _ (P.map gg.op), ← P.map_comp, ← op_comp, ht] swap; simpa using hgg refine (H2 hgg (𝟙 _)).ext (fun ZZZ ggg hggg => ?_) rw [← types_comp_apply _ (P.map ggg.op), ← P.map_comp, ← op_comp, hz] swap; simpa using hggg refine (H2 hgg ggg).ext (fun ZZZZ gggg _ => ?_) rw [← types_comp_apply _ (P.map gggg.op), ← P.map_comp, ← op_comp] apply hx simp /-- A presheaf is a sheaf for the Grothendieck topology generated by a union of coverages iff it is a sheaf for the Grothendieck topology generated by each coverage separately. -/ theorem isSheaf_sup (K L : Coverage C) (P : Cᵒᵖ ⥤ Type w) : (Presieve.IsSheaf ((K ⊔ L).toGrothendieck C)) P ↔ (Presieve.IsSheaf (K.toGrothendieck C)) P ∧ (Presieve.IsSheaf (L.toGrothendieck C)) P := by refine ⟨fun h ↦ ⟨Presieve.isSheaf_of_le _ ((gi C).gc.monotone_l le_sup_left) h, Presieve.isSheaf_of_le _ ((gi C).gc.monotone_l le_sup_right) h⟩, fun h ↦ ?_⟩ rw [isSheaf_coverage, isSheaf_coverage] at h
rw [isSheaf_coverage]
/-- A presheaf is a sheaf for the Grothendieck topology generated by a union of coverages iff it is a sheaf for the Grothendieck topology generated by each coverage separately. -/ theorem isSheaf_sup (K L : Coverage C) (P : Cᵒᵖ ⥤ Type w) : (Presieve.IsSheaf ((K ⊔ L).toGrothendieck C)) P ↔ (Presieve.IsSheaf (K.toGrothendieck C)) P ∧ (Presieve.IsSheaf (L.toGrothendieck C)) P := by refine ⟨fun h ↦ ⟨Presieve.isSheaf_of_le _ ((gi C).gc.monotone_l le_sup_left) h, Presieve.isSheaf_of_le _ ((gi C).gc.monotone_l le_sup_right) h⟩, fun h ↦ ?_⟩ rw [isSheaf_coverage, isSheaf_coverage] at h
Mathlib.CategoryTheory.Sites.Coverage.388_0.qkZFgqEgDC2P633
/-- A presheaf is a sheaf for the Grothendieck topology generated by a union of coverages iff it is a sheaf for the Grothendieck topology generated by each coverage separately. -/ theorem isSheaf_sup (K L : Coverage C) (P : Cᵒᵖ ⥤ Type w) : (Presieve.IsSheaf ((K ⊔ L).toGrothendieck C)) P ↔ (Presieve.IsSheaf (K.toGrothendieck C)) P ∧ (Presieve.IsSheaf (L.toGrothendieck C)) P
Mathlib_CategoryTheory_Sites_Coverage
C : Type u_1 inst✝ : Category.{u_2, u_1} C K L : Coverage C P : Cᵒᵖ ⥤ Type w h : (∀ {X : C}, ∀ R ∈ covering K X, IsSheafFor P R) ∧ ∀ {X : C}, ∀ R ∈ covering L X, IsSheafFor P R ⊢ ∀ {X : C}, ∀ R ∈ covering (K ⊔ L) X, IsSheafFor P R
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply] rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz] · dsimp; congr 1; simp only [Category.assoc, h] · simpa [reassoc_of% h] using hgg · simpa using hgg obtain ⟨t, ht⟩ := H1' f q hq refine ⟨t, fun Z g hg => ?_⟩ refine (H1 (g ≫ f)).ext (fun ZZ gg hgg => ?_) rw [← types_comp_apply _ (P.map gg.op), ← P.map_comp, ← op_comp, ht] swap; simpa using hgg refine (H2 hgg (𝟙 _)).ext (fun ZZZ ggg hggg => ?_) rw [← types_comp_apply _ (P.map ggg.op), ← P.map_comp, ← op_comp, hz] swap; simpa using hggg refine (H2 hgg ggg).ext (fun ZZZZ gggg _ => ?_) rw [← types_comp_apply _ (P.map gggg.op), ← P.map_comp, ← op_comp] apply hx simp /-- A presheaf is a sheaf for the Grothendieck topology generated by a union of coverages iff it is a sheaf for the Grothendieck topology generated by each coverage separately. -/ theorem isSheaf_sup (K L : Coverage C) (P : Cᵒᵖ ⥤ Type w) : (Presieve.IsSheaf ((K ⊔ L).toGrothendieck C)) P ↔ (Presieve.IsSheaf (K.toGrothendieck C)) P ∧ (Presieve.IsSheaf (L.toGrothendieck C)) P := by refine ⟨fun h ↦ ⟨Presieve.isSheaf_of_le _ ((gi C).gc.monotone_l le_sup_left) h, Presieve.isSheaf_of_le _ ((gi C).gc.monotone_l le_sup_right) h⟩, fun h ↦ ?_⟩ rw [isSheaf_coverage, isSheaf_coverage] at h rw [isSheaf_coverage]
intro X R hR
/-- A presheaf is a sheaf for the Grothendieck topology generated by a union of coverages iff it is a sheaf for the Grothendieck topology generated by each coverage separately. -/ theorem isSheaf_sup (K L : Coverage C) (P : Cᵒᵖ ⥤ Type w) : (Presieve.IsSheaf ((K ⊔ L).toGrothendieck C)) P ↔ (Presieve.IsSheaf (K.toGrothendieck C)) P ∧ (Presieve.IsSheaf (L.toGrothendieck C)) P := by refine ⟨fun h ↦ ⟨Presieve.isSheaf_of_le _ ((gi C).gc.monotone_l le_sup_left) h, Presieve.isSheaf_of_le _ ((gi C).gc.monotone_l le_sup_right) h⟩, fun h ↦ ?_⟩ rw [isSheaf_coverage, isSheaf_coverage] at h rw [isSheaf_coverage]
Mathlib.CategoryTheory.Sites.Coverage.388_0.qkZFgqEgDC2P633
/-- A presheaf is a sheaf for the Grothendieck topology generated by a union of coverages iff it is a sheaf for the Grothendieck topology generated by each coverage separately. -/ theorem isSheaf_sup (K L : Coverage C) (P : Cᵒᵖ ⥤ Type w) : (Presieve.IsSheaf ((K ⊔ L).toGrothendieck C)) P ↔ (Presieve.IsSheaf (K.toGrothendieck C)) P ∧ (Presieve.IsSheaf (L.toGrothendieck C)) P
Mathlib_CategoryTheory_Sites_Coverage
C : Type u_1 inst✝ : Category.{u_2, u_1} C K L : Coverage C P : Cᵒᵖ ⥤ Type w h : (∀ {X : C}, ∀ R ∈ covering K X, IsSheafFor P R) ∧ ∀ {X : C}, ∀ R ∈ covering L X, IsSheafFor P R X : C R : Presieve X hR : R ∈ covering (K ⊔ L) X ⊢ IsSheafFor P R
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply] rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz] · dsimp; congr 1; simp only [Category.assoc, h] · simpa [reassoc_of% h] using hgg · simpa using hgg obtain ⟨t, ht⟩ := H1' f q hq refine ⟨t, fun Z g hg => ?_⟩ refine (H1 (g ≫ f)).ext (fun ZZ gg hgg => ?_) rw [← types_comp_apply _ (P.map gg.op), ← P.map_comp, ← op_comp, ht] swap; simpa using hgg refine (H2 hgg (𝟙 _)).ext (fun ZZZ ggg hggg => ?_) rw [← types_comp_apply _ (P.map ggg.op), ← P.map_comp, ← op_comp, hz] swap; simpa using hggg refine (H2 hgg ggg).ext (fun ZZZZ gggg _ => ?_) rw [← types_comp_apply _ (P.map gggg.op), ← P.map_comp, ← op_comp] apply hx simp /-- A presheaf is a sheaf for the Grothendieck topology generated by a union of coverages iff it is a sheaf for the Grothendieck topology generated by each coverage separately. -/ theorem isSheaf_sup (K L : Coverage C) (P : Cᵒᵖ ⥤ Type w) : (Presieve.IsSheaf ((K ⊔ L).toGrothendieck C)) P ↔ (Presieve.IsSheaf (K.toGrothendieck C)) P ∧ (Presieve.IsSheaf (L.toGrothendieck C)) P := by refine ⟨fun h ↦ ⟨Presieve.isSheaf_of_le _ ((gi C).gc.monotone_l le_sup_left) h, Presieve.isSheaf_of_le _ ((gi C).gc.monotone_l le_sup_right) h⟩, fun h ↦ ?_⟩ rw [isSheaf_coverage, isSheaf_coverage] at h rw [isSheaf_coverage] intro X R hR
cases' hR with hR hR
/-- A presheaf is a sheaf for the Grothendieck topology generated by a union of coverages iff it is a sheaf for the Grothendieck topology generated by each coverage separately. -/ theorem isSheaf_sup (K L : Coverage C) (P : Cᵒᵖ ⥤ Type w) : (Presieve.IsSheaf ((K ⊔ L).toGrothendieck C)) P ↔ (Presieve.IsSheaf (K.toGrothendieck C)) P ∧ (Presieve.IsSheaf (L.toGrothendieck C)) P := by refine ⟨fun h ↦ ⟨Presieve.isSheaf_of_le _ ((gi C).gc.monotone_l le_sup_left) h, Presieve.isSheaf_of_le _ ((gi C).gc.monotone_l le_sup_right) h⟩, fun h ↦ ?_⟩ rw [isSheaf_coverage, isSheaf_coverage] at h rw [isSheaf_coverage] intro X R hR
Mathlib.CategoryTheory.Sites.Coverage.388_0.qkZFgqEgDC2P633
/-- A presheaf is a sheaf for the Grothendieck topology generated by a union of coverages iff it is a sheaf for the Grothendieck topology generated by each coverage separately. -/ theorem isSheaf_sup (K L : Coverage C) (P : Cᵒᵖ ⥤ Type w) : (Presieve.IsSheaf ((K ⊔ L).toGrothendieck C)) P ↔ (Presieve.IsSheaf (K.toGrothendieck C)) P ∧ (Presieve.IsSheaf (L.toGrothendieck C)) P
Mathlib_CategoryTheory_Sites_Coverage
case inl C : Type u_1 inst✝ : Category.{u_2, u_1} C K L : Coverage C P : Cᵒᵖ ⥤ Type w h : (∀ {X : C}, ∀ R ∈ covering K X, IsSheafFor P R) ∧ ∀ {X : C}, ∀ R ∈ covering L X, IsSheafFor P R X : C R : Presieve X hR : R ∈ covering K X ⊢ IsSheafFor P R
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply] rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz] · dsimp; congr 1; simp only [Category.assoc, h] · simpa [reassoc_of% h] using hgg · simpa using hgg obtain ⟨t, ht⟩ := H1' f q hq refine ⟨t, fun Z g hg => ?_⟩ refine (H1 (g ≫ f)).ext (fun ZZ gg hgg => ?_) rw [← types_comp_apply _ (P.map gg.op), ← P.map_comp, ← op_comp, ht] swap; simpa using hgg refine (H2 hgg (𝟙 _)).ext (fun ZZZ ggg hggg => ?_) rw [← types_comp_apply _ (P.map ggg.op), ← P.map_comp, ← op_comp, hz] swap; simpa using hggg refine (H2 hgg ggg).ext (fun ZZZZ gggg _ => ?_) rw [← types_comp_apply _ (P.map gggg.op), ← P.map_comp, ← op_comp] apply hx simp /-- A presheaf is a sheaf for the Grothendieck topology generated by a union of coverages iff it is a sheaf for the Grothendieck topology generated by each coverage separately. -/ theorem isSheaf_sup (K L : Coverage C) (P : Cᵒᵖ ⥤ Type w) : (Presieve.IsSheaf ((K ⊔ L).toGrothendieck C)) P ↔ (Presieve.IsSheaf (K.toGrothendieck C)) P ∧ (Presieve.IsSheaf (L.toGrothendieck C)) P := by refine ⟨fun h ↦ ⟨Presieve.isSheaf_of_le _ ((gi C).gc.monotone_l le_sup_left) h, Presieve.isSheaf_of_le _ ((gi C).gc.monotone_l le_sup_right) h⟩, fun h ↦ ?_⟩ rw [isSheaf_coverage, isSheaf_coverage] at h rw [isSheaf_coverage] intro X R hR cases' hR with hR hR ·
exact h.1 R hR
/-- A presheaf is a sheaf for the Grothendieck topology generated by a union of coverages iff it is a sheaf for the Grothendieck topology generated by each coverage separately. -/ theorem isSheaf_sup (K L : Coverage C) (P : Cᵒᵖ ⥤ Type w) : (Presieve.IsSheaf ((K ⊔ L).toGrothendieck C)) P ↔ (Presieve.IsSheaf (K.toGrothendieck C)) P ∧ (Presieve.IsSheaf (L.toGrothendieck C)) P := by refine ⟨fun h ↦ ⟨Presieve.isSheaf_of_le _ ((gi C).gc.monotone_l le_sup_left) h, Presieve.isSheaf_of_le _ ((gi C).gc.monotone_l le_sup_right) h⟩, fun h ↦ ?_⟩ rw [isSheaf_coverage, isSheaf_coverage] at h rw [isSheaf_coverage] intro X R hR cases' hR with hR hR ·
Mathlib.CategoryTheory.Sites.Coverage.388_0.qkZFgqEgDC2P633
/-- A presheaf is a sheaf for the Grothendieck topology generated by a union of coverages iff it is a sheaf for the Grothendieck topology generated by each coverage separately. -/ theorem isSheaf_sup (K L : Coverage C) (P : Cᵒᵖ ⥤ Type w) : (Presieve.IsSheaf ((K ⊔ L).toGrothendieck C)) P ↔ (Presieve.IsSheaf (K.toGrothendieck C)) P ∧ (Presieve.IsSheaf (L.toGrothendieck C)) P
Mathlib_CategoryTheory_Sites_Coverage
case inr C : Type u_1 inst✝ : Category.{u_2, u_1} C K L : Coverage C P : Cᵒᵖ ⥤ Type w h : (∀ {X : C}, ∀ R ∈ covering K X, IsSheafFor P R) ∧ ∀ {X : C}, ∀ R ∈ covering L X, IsSheafFor P R X : C R : Presieve X hR : R ∈ covering L X ⊢ IsSheafFor P R
/- Copyright (c) 2023 Adam Topaz. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Adam Topaz -/ import Mathlib.CategoryTheory.Sites.SheafOfTypes /-! # Coverages A coverage `K` on a category `C` is a set of presieves associated to every object `X : C`, called "covering presieves". This collection must satisfy a certain "pullback compatibility" condition, saying that whenever `S` is a covering presieve on `X` and `f : Y ⟶ X` is a morphism, then there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. The main difference between a coverage and a Grothendieck pretopology is that we *do not* require `C` to have pullbacks. This is useful, for example, when we want to consider the Grothendieck topology on the category of extremally disconnected sets in the context of condensed mathematics. A more concrete example: If `ℬ` is a basis for a topology on a type `X` (in the sense of `TopologicalSpace.IsTopologicalBasis`) then it naturally induces a coverage on `Opens X` whose associated Grothendieck topology is the one induced by the topology on `X` generated by `ℬ`. (Project: Formalize this!) ## Main Definitions and Results: All definitions are in the `CategoryTheory` namespace. - `Coverage C`: The type of coverages on `C`. - `Coverage.ofGrothendieck C`: A function which associates a coverage to any Grothendieck topology. - `Coverage.toGrothendieck C`: A function which associates a Grothendieck topology to any coverage. - `Coverage.gi`: The two functions above form a Galois insertion. - `Presieve.isSheaf_coverage`: Given `K : Coverage C` with associated Grothendieck topology `J`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for `J`. # References We don't follow any particular reference, but the arguments can probably be distilled from the following sources: - [Elephant]: *Sketches of an Elephant*, P. T. Johnstone: C2.1. - [nLab, *Coverage*](https://ncatlab.org/nlab/show/coverage) -/ set_option autoImplicit true namespace CategoryTheory variable {C : Type _} [Category C] namespace Presieve /-- Given a morphism `f : Y ⟶ X`, a presieve `S` on `Y` and presieve `T` on `X`, we say that *`S` factors through `T` along `f`*, written `S.FactorsThruAlong T f`, provided that for any morphism `g : Z ⟶ Y` in `S`, there exists some morphism `e : W ⟶ X` in `T` and some morphism `i : Z ⟶ W` such that the obvious square commutes: `i ≫ e = g ≫ f`. This is used in the definition of a coverage. -/ def FactorsThruAlong {X Y : C} (S : Presieve Y) (T : Presieve X) (f : Y ⟶ X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g ≫ f /-- Given `S T : Presieve X`, we say that `S` factors through `T` if any morphism in `S` factors through some morphism in `T`. The lemma `Presieve.isSheafFor_of_factorsThru` gives a *sufficient* condition for a presheaf to be a sheaf for a presieve `T`, in terms of `S.FactorsThru T`, provided that the presheaf is a sheaf for `S`. -/ def FactorsThru {X : C} (S T : Presieve X) : Prop := ∀ ⦃Z : C⦄ ⦃g : Z ⟶ X⦄, S g → ∃ (W : C) (i : Z ⟶ W) (e : W ⟶ X), T e ∧ i ≫ e = g @[simp] lemma factorsThruAlong_id {X : C} (S T : Presieve X) : S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T := by simp [FactorsThruAlong, FactorsThru] lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) : S.FactorsThru T := fun Y g hg => ⟨Y, 𝟙 _, g, h _ hg, by simp⟩ lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) : S ≤ T := by rintro Y f hf obtain ⟨W, i, e, h1, rfl⟩ := h hf exact T.downward_closed h1 _ lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ := factorsThru_of_le _ _ le_top lemma isSheafFor_of_factorsThru {X : C} {S T : Presieve X} (P : Cᵒᵖ ⥤ Type w) (H : S.FactorsThru T) (hS : S.IsSheafFor P) (h : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, T f → ∃ (R : Presieve Y), R.IsSeparatedFor P ∧ R.FactorsThruAlong S f): T.IsSheafFor P := by simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose W i e h1 h2 using H refine ⟨?_, fun x hx => ?_⟩ · intro x y₁ y₂ h₁ h₂ refine hS.1.ext (fun Y g hg => ?_) simp only [← h2 hg, op_comp, P.map_comp, types_comp_apply, h₁ _ (h1 _ ), h₂ _ (h1 _)] let y : S.FamilyOfElements P := fun Y g hg => P.map (i _).op (x (e hg) (h1 _)) have hy : y.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h rw [← types_comp_apply (P.map (i h₁).op) (P.map g₁.op), ← types_comp_apply (P.map (i h₂).op) (P.map g₂.op), ← P.map_comp, ← op_comp, ← P.map_comp, ← op_comp] apply hx simp only [h2, h, Category.assoc] let ⟨_, h2'⟩ := hS obtain ⟨z, hz⟩ := h2' y hy refine ⟨z, fun Y g hg => ?_⟩ obtain ⟨R, hR1, hR2⟩ := h hg choose WW ii ee hh1 hh2 using hR2 refine hR1.ext (fun Q t ht => ?_) rw [← types_comp_apply (P.map g.op) (P.map t.op), ← P.map_comp, ← op_comp, ← hh2 ht, op_comp, P.map_comp, types_comp_apply, hz _ (hh1 _), ← types_comp_apply _ (P.map (ii ht).op), ← P.map_comp, ← op_comp] apply hx simp only [Category.assoc, h2, hh2] end Presieve variable (C) in /-- The type `Coverage C` of coverages on `C`. A coverage is a collection of *covering* presieves on every object `X : C`, which satisfies a *pullback compatibility* condition. Explicitly, this condition says that whenever `S` is a covering presieve for `X` and `f : Y ⟶ X` is a morphism, then there exists some covering presieve `T` for `Y` such that `T` factors through `S` along `f`. -/ @[ext] structure Coverage where /-- The collection of covering presieves for an object `X`. -/ covering : ∀ (X : C), Set (Presieve X) /-- Given any covering sieve `S` on `X` and a morphism `f : Y ⟶ X`, there exists some covering sieve `T` on `Y` such that `T` factors through `S` along `f`. -/ pullback : ∀ ⦃X Y : C⦄ (f : Y ⟶ X) (S : Presieve X) (_ : S ∈ covering X), ∃ (T : Presieve Y), T ∈ covering Y ∧ T.FactorsThruAlong S f namespace Coverage instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) where coe := covering variable (C) in /-- Associate a coverage to any Grothendieck topology. If `J` is a Grothendieck topology, and `K` is the associated coverage, then a presieve `S` is a covering presieve for `K` if and only if the sieve that it generates is a covering sieve for `J`. -/ def ofGrothendieck (J : GrothendieckTopology C) : Coverage C where covering X := { S | Sieve.generate S ∈ J X } pullback := by intro X Y f S (hS : Sieve.generate S ∈ J X) refine ⟨(Sieve.generate S).pullback f, ?_, fun Z g h => h⟩ dsimp rw [Sieve.generate_sieve] exact J.pullback_stable _ hS lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) : S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X := Iff.rfl /-- An auxiliary definition used to define the Grothendieck topology associated to a coverage. See `Coverage.toGrothendieck`. -/ inductive saturate (K : Coverage C) : (X : C) → Sieve X → Prop where | of (X : C) (S : Presieve X) (hS : S ∈ K X) : saturate K X (Sieve.generate S) | top (X : C) : saturate K X ⊤ | transitive (X : C) (R S : Sieve X) : saturate K X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R f → saturate K Y (S.pullback f)) → saturate K X S lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) : T.pullback f = ⊤ := by ext Z g simp only [Sieve.pullback_apply, Sieve.top_apply, iff_true] apply h apply S.downward_closed exact hf lemma saturate_of_superset (K : Coverage C) {X : C} {S T : Sieve X} (h : S ≤ T) (hS : saturate K X S) : saturate K X T := by apply saturate.transitive _ _ _ hS intro Y g hg rw [eq_top_pullback (h := h)] · apply saturate.top · assumption variable (C) in /-- The Grothendieck topology associated to a coverage `K`. It is defined *inductively* as follows: 1. If `S` is a covering presieve for `K`, then the sieve generated by `S` is a covering sieve for the associated Grothendieck topology. 2. The top sieves are in the associated Grothendieck topology. 3. Add all sieves required by the *local character* axiom of a Grothendieck topology. The pullback compatibility condition for a coverage ensures that the associated Grothendieck topology is pullback stable, and so an additional constructor in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C where sieves := saturate K top_mem' := .top pullback_stable' := by intro X Y S f hS induction hS generalizing Y with | of X S hS => obtain ⟨R,hR1,hR2⟩ := K.pullback f S hS suffices Sieve.generate R ≤ (Sieve.generate S).pullback f from saturate_of_superset _ this (saturate.of _ _ hR1) rintro Z g ⟨W, i, e, h1, h2⟩ obtain ⟨WW, ii, ee, hh1, hh2⟩ := hR2 h1 refine ⟨WW, i ≫ ii, ee, hh1, ?_⟩ simp only [hh2, reassoc_of% h2, Category.assoc] | top X => apply saturate.top | transitive X R S _ hS H1 _ => apply saturate.transitive apply H1 f intro Z g hg rw [← Sieve.pullback_comp] exact hS hg transitive' X S hS R hR := .transitive _ _ _ hS hR instance : PartialOrder (Coverage C) where le A B := A.covering ≤ B.covering le_refl A X := le_refl _ le_trans A B C h1 h2 X := le_trans (h1 X) (h2 X) le_antisymm A B h1 h2 := Coverage.ext A B <| funext <| fun X => le_antisymm (h1 X) (h2 X) variable (C) in /-- The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form a Galois insertion. -/ def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) where choice K _ := toGrothendieck _ K choice_eq := fun _ _ => rfl le_l_u J X S hS := by rw [← Sieve.generate_sieve S] apply saturate.of dsimp [ofGrothendieck] rwa [Sieve.generate_sieve S] gc K J := by constructor · intro H X S hS exact H _ <| saturate.of _ _ hS · intro H X S hS induction hS with | of X S hS => exact H _ hS | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 /-- An alternative characterization of the Grothendieck topology associated to a coverage `K`: it is the infimum of all Grothendieck topologies whose associated coverage contains `K`. -/ theorem toGrothendieck_eq_sInf (K : Coverage C) : toGrothendieck _ K = sInf {J | K ≤ ofGrothendieck _ J } := by apply le_antisymm · apply le_sInf; intro J hJ intro X S hS induction hS with | of X S hS => apply hJ; assumption | top => apply J.top_mem | transitive X R S _ _ H1 H2 => exact J.transitive H1 _ H2 · apply sInf_le intro X S hS apply saturate.of _ _ hS instance : SemilatticeSup (Coverage C) where sup x y := { covering := fun B ↦ x.covering B ∪ y.covering B pullback := by rintro X Y f S (hx | hy) · obtain ⟨T, hT⟩ := x.pullback f S hx exact ⟨T, Or.inl hT.1, hT.2⟩ · obtain ⟨T, hT⟩ := y.pullback f S hy exact ⟨T, Or.inr hT.1, hT.2⟩ } toPartialOrder := inferInstance le_sup_left _ _ _ := Set.subset_union_left _ _ le_sup_right _ _ _ := Set.subset_union_right _ _ sup_le _ _ _ hx hy X := Set.union_subset_iff.mpr ⟨hx X, hy X⟩ @[simp] lemma sup_covering (x y : Coverage C) (B : C) : (x ⊔ y).covering B = x.covering B ∪ y.covering B := rfl end Coverage open Coverage namespace Presieve /-- The main theorem of this file: Given a coverage `K` on `C`, a `Type*`-valued presheaf on `C` is a sheaf for `K` if and only if it is a sheaf for the associated Grothendieck topology. -/ theorem isSheaf_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ Type w) : Presieve.IsSheaf (toGrothendieck _ K) P ↔ (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) := by constructor · intro H X R hR rw [Presieve.isSheafFor_iff_generate] apply H _ <| saturate.of _ _ hR · intro H X S hS -- This is the key point of the proof: -- We must generalize the induction in the correct way. suffices ∀ ⦃Y : C⦄ (f : Y ⟶ X), Presieve.IsSheafFor P (S.pullback f).arrows by simpa using this (f := 𝟙 _) induction hS with | of X S hS => intro Y f obtain ⟨T, hT1, hT2⟩ := K.pullback f S hS apply Presieve.isSheafFor_of_factorsThru (S := T) · intro Z g hg obtain ⟨W, i, e, h1, h2⟩ := hT2 hg exact ⟨Z, 𝟙 _, g, ⟨W, i, e, h1, h2⟩, by simp⟩ · apply H; assumption · intro Z g _ obtain ⟨R, hR1, hR2⟩ := K.pullback g _ hT1 refine ⟨R, (H _ hR1).isSeparatedFor, hR2⟩ | top => intros; simpa using Presieve.isSheafFor_top_sieve _ | transitive X R S _ _ H1 H2 => intro Y f simp only [← Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor] at * choose H1 H1' using H1 choose H2 H2' using H2 refine ⟨?_, fun x hx => ?_⟩ · intro x t₁ t₂ h₁ h₂ refine (H1 f).ext (fun Z g hg => ?_) refine (H2 hg (𝟙 _)).ext (fun ZZ gg hgg => ?_) simp only [Sieve.pullback_id, Sieve.pullback_apply] at hgg simp only [← types_comp_apply] rw [← P.map_comp, ← op_comp, h₁, h₂] simpa only [Sieve.pullback_apply, Category.assoc] using hgg let y : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), ((S.pullback (g ≫ f)).pullback (𝟙 _)).arrows.FamilyOfElements P := fun Z g ZZ gg hgg => x (gg ≫ g) (by simpa using hgg) have hy : ∀ ⦃Z : C⦄ (g : Z ⟶ Y), (y g).Compatible := by intro Z g Y₁ Y₂ ZZ g₁ g₂ f₁ f₂ h₁ h₂ h rw [hx] rw [reassoc_of% h] choose z hz using fun ⦃Z : C⦄ ⦃g : Z ⟶ Y⦄ (hg : R.pullback f g) => H2' hg (𝟙 _) (y g) (hy g) let q : (R.pullback f).arrows.FamilyOfElements P := fun Z g hg => z hg have hq : q.Compatible := by intro Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ h apply (H2 h₁ g₁).ext intro ZZ gg hgg simp only [← types_comp_apply] rw [← P.map_comp, ← P.map_comp, ← op_comp, ← op_comp, hz, hz] · dsimp; congr 1; simp only [Category.assoc, h] · simpa [reassoc_of% h] using hgg · simpa using hgg obtain ⟨t, ht⟩ := H1' f q hq refine ⟨t, fun Z g hg => ?_⟩ refine (H1 (g ≫ f)).ext (fun ZZ gg hgg => ?_) rw [← types_comp_apply _ (P.map gg.op), ← P.map_comp, ← op_comp, ht] swap; simpa using hgg refine (H2 hgg (𝟙 _)).ext (fun ZZZ ggg hggg => ?_) rw [← types_comp_apply _ (P.map ggg.op), ← P.map_comp, ← op_comp, hz] swap; simpa using hggg refine (H2 hgg ggg).ext (fun ZZZZ gggg _ => ?_) rw [← types_comp_apply _ (P.map gggg.op), ← P.map_comp, ← op_comp] apply hx simp /-- A presheaf is a sheaf for the Grothendieck topology generated by a union of coverages iff it is a sheaf for the Grothendieck topology generated by each coverage separately. -/ theorem isSheaf_sup (K L : Coverage C) (P : Cᵒᵖ ⥤ Type w) : (Presieve.IsSheaf ((K ⊔ L).toGrothendieck C)) P ↔ (Presieve.IsSheaf (K.toGrothendieck C)) P ∧ (Presieve.IsSheaf (L.toGrothendieck C)) P := by refine ⟨fun h ↦ ⟨Presieve.isSheaf_of_le _ ((gi C).gc.monotone_l le_sup_left) h, Presieve.isSheaf_of_le _ ((gi C).gc.monotone_l le_sup_right) h⟩, fun h ↦ ?_⟩ rw [isSheaf_coverage, isSheaf_coverage] at h rw [isSheaf_coverage] intro X R hR cases' hR with hR hR · exact h.1 R hR ·
exact h.2 R hR
/-- A presheaf is a sheaf for the Grothendieck topology generated by a union of coverages iff it is a sheaf for the Grothendieck topology generated by each coverage separately. -/ theorem isSheaf_sup (K L : Coverage C) (P : Cᵒᵖ ⥤ Type w) : (Presieve.IsSheaf ((K ⊔ L).toGrothendieck C)) P ↔ (Presieve.IsSheaf (K.toGrothendieck C)) P ∧ (Presieve.IsSheaf (L.toGrothendieck C)) P := by refine ⟨fun h ↦ ⟨Presieve.isSheaf_of_le _ ((gi C).gc.monotone_l le_sup_left) h, Presieve.isSheaf_of_le _ ((gi C).gc.monotone_l le_sup_right) h⟩, fun h ↦ ?_⟩ rw [isSheaf_coverage, isSheaf_coverage] at h rw [isSheaf_coverage] intro X R hR cases' hR with hR hR · exact h.1 R hR ·
Mathlib.CategoryTheory.Sites.Coverage.388_0.qkZFgqEgDC2P633
/-- A presheaf is a sheaf for the Grothendieck topology generated by a union of coverages iff it is a sheaf for the Grothendieck topology generated by each coverage separately. -/ theorem isSheaf_sup (K L : Coverage C) (P : Cᵒᵖ ⥤ Type w) : (Presieve.IsSheaf ((K ⊔ L).toGrothendieck C)) P ↔ (Presieve.IsSheaf (K.toGrothendieck C)) P ∧ (Presieve.IsSheaf (L.toGrothendieck C)) P
Mathlib_CategoryTheory_Sites_Coverage
f : ℕ →. ℕ hf : Partrec f ⊢ Partrec₂ fun a m => Part.map (fun x => x + m) (Nat.rfind fun n => (fun m => decide (m = 0)) <$> f (Nat.pair a (n + m)))
/- Copyright (c) 2018 Mario Carneiro. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mario Carneiro -/ import Mathlib.Computability.Partrec #align_import computability.partrec_code from "leanprover-community/mathlib"@"6155d4351090a6fad236e3d2e4e0e4e7342668e8" /-! # Gödel Numbering for Partial Recursive Functions. This file defines `Nat.Partrec.Code`, an inductive datatype describing code for partial recursive functions on ℕ. It defines an encoding for these codes, and proves that the constructors are primitive recursive with respect to the encoding. It also defines the evaluation of these codes as partial functions using `PFun`, and proves that a function is partially recursive (as defined by `Nat.Partrec`) if and only if it is the evaluation of some code. ## Main Definitions * `Nat.Partrec.Code`: Inductive datatype for partial recursive codes. * `Nat.Partrec.Code.encodeCode`: A (computable) encoding of codes as natural numbers. * `Nat.Partrec.Code.ofNatCode`: The inverse of this encoding. * `Nat.Partrec.Code.eval`: The interpretation of a `Nat.Partrec.Code` as a partial function. ## Main Results * `Nat.Partrec.Code.rec_prim`: Recursion on `Nat.Partrec.Code` is primitive recursive. * `Nat.Partrec.Code.rec_computable`: Recursion on `Nat.Partrec.Code` is computable. * `Nat.Partrec.Code.smn`: The $S_n^m$ theorem. * `Nat.Partrec.Code.exists_code`: Partial recursiveness is equivalent to being the eval of a code. * `Nat.Partrec.Code.evaln_prim`: `evaln` is primitive recursive. * `Nat.Partrec.Code.fixed_point`: Roger's fixed point theorem. ## References * [Mario Carneiro, *Formalizing computability theory via partial recursive functions*][carneiro2019] -/ open Encodable Denumerable Primrec namespace Nat.Partrec open Nat (pair) theorem rfind' {f} (hf : Nat.Partrec f) : Nat.Partrec (Nat.unpaired fun a m => (Nat.rfind fun n => (fun m => m = 0) <$> f (Nat.pair a (n + m))).map (· + m)) := Partrec₂.unpaired'.2 <| by
refine' Partrec.map ((@Partrec₂.unpaired' fun a b : ℕ => Nat.rfind fun n => (fun m => m = 0) <$> f (Nat.pair a (n + b))).1 _) (Primrec.nat_add.comp Primrec.snd <| Primrec.snd.comp Primrec.fst).to_comp.to₂
theorem rfind' {f} (hf : Nat.Partrec f) : Nat.Partrec (Nat.unpaired fun a m => (Nat.rfind fun n => (fun m => m = 0) <$> f (Nat.pair a (n + m))).map (· + m)) := Partrec₂.unpaired'.2 <| by
Mathlib.Computability.PartrecCode.50_0.A3c3Aev6SyIRjCJ
theorem rfind' {f} (hf : Nat.Partrec f) : Nat.Partrec (Nat.unpaired fun a m => (Nat.rfind fun n => (fun m => m = 0) <$> f (Nat.pair a (n + m))).map (· + m))
Mathlib_Computability_PartrecCode
f : ℕ →. ℕ hf : Partrec f ⊢ Partrec (unpaired fun a b => Nat.rfind fun n => (fun m => decide (m = 0)) <$> f (Nat.pair a (n + b)))
/- Copyright (c) 2018 Mario Carneiro. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mario Carneiro -/ import Mathlib.Computability.Partrec #align_import computability.partrec_code from "leanprover-community/mathlib"@"6155d4351090a6fad236e3d2e4e0e4e7342668e8" /-! # Gödel Numbering for Partial Recursive Functions. This file defines `Nat.Partrec.Code`, an inductive datatype describing code for partial recursive functions on ℕ. It defines an encoding for these codes, and proves that the constructors are primitive recursive with respect to the encoding. It also defines the evaluation of these codes as partial functions using `PFun`, and proves that a function is partially recursive (as defined by `Nat.Partrec`) if and only if it is the evaluation of some code. ## Main Definitions * `Nat.Partrec.Code`: Inductive datatype for partial recursive codes. * `Nat.Partrec.Code.encodeCode`: A (computable) encoding of codes as natural numbers. * `Nat.Partrec.Code.ofNatCode`: The inverse of this encoding. * `Nat.Partrec.Code.eval`: The interpretation of a `Nat.Partrec.Code` as a partial function. ## Main Results * `Nat.Partrec.Code.rec_prim`: Recursion on `Nat.Partrec.Code` is primitive recursive. * `Nat.Partrec.Code.rec_computable`: Recursion on `Nat.Partrec.Code` is computable. * `Nat.Partrec.Code.smn`: The $S_n^m$ theorem. * `Nat.Partrec.Code.exists_code`: Partial recursiveness is equivalent to being the eval of a code. * `Nat.Partrec.Code.evaln_prim`: `evaln` is primitive recursive. * `Nat.Partrec.Code.fixed_point`: Roger's fixed point theorem. ## References * [Mario Carneiro, *Formalizing computability theory via partial recursive functions*][carneiro2019] -/ open Encodable Denumerable Primrec namespace Nat.Partrec open Nat (pair) theorem rfind' {f} (hf : Nat.Partrec f) : Nat.Partrec (Nat.unpaired fun a m => (Nat.rfind fun n => (fun m => m = 0) <$> f (Nat.pair a (n + m))).map (· + m)) := Partrec₂.unpaired'.2 <| by refine' Partrec.map ((@Partrec₂.unpaired' fun a b : ℕ => Nat.rfind fun n => (fun m => m = 0) <$> f (Nat.pair a (n + b))).1 _) (Primrec.nat_add.comp Primrec.snd <| Primrec.snd.comp Primrec.fst).to_comp.to₂
have : Nat.Partrec (fun a => Nat.rfind (fun n => (fun m => decide (m = 0)) <$> Nat.unpaired (fun a b => f (Nat.pair (Nat.unpair a).1 (b + (Nat.unpair a).2))) (Nat.pair a n))) := rfind (Partrec₂.unpaired'.2 ((Partrec.nat_iff.2 hf).comp (Primrec₂.pair.comp (Primrec.fst.comp <| Primrec.unpair.comp Primrec.fst) (Primrec.nat_add.comp Primrec.snd (Primrec.snd.comp <| Primrec.unpair.comp Primrec.fst))).to_comp))
theorem rfind' {f} (hf : Nat.Partrec f) : Nat.Partrec (Nat.unpaired fun a m => (Nat.rfind fun n => (fun m => m = 0) <$> f (Nat.pair a (n + m))).map (· + m)) := Partrec₂.unpaired'.2 <| by refine' Partrec.map ((@Partrec₂.unpaired' fun a b : ℕ => Nat.rfind fun n => (fun m => m = 0) <$> f (Nat.pair a (n + b))).1 _) (Primrec.nat_add.comp Primrec.snd <| Primrec.snd.comp Primrec.fst).to_comp.to₂
Mathlib.Computability.PartrecCode.50_0.A3c3Aev6SyIRjCJ
theorem rfind' {f} (hf : Nat.Partrec f) : Nat.Partrec (Nat.unpaired fun a m => (Nat.rfind fun n => (fun m => m = 0) <$> f (Nat.pair a (n + m))).map (· + m))
Mathlib_Computability_PartrecCode
f : ℕ →. ℕ hf : Partrec f this : Partrec fun a => Nat.rfind fun n => (fun m => decide (m = 0)) <$> unpaired (fun a b => f (Nat.pair (unpair a).1 (b + (unpair a).2))) (Nat.pair a n) ⊢ Partrec (unpaired fun a b => Nat.rfind fun n => (fun m => decide (m = 0)) <$> f (Nat.pair a (n + b)))
/- Copyright (c) 2018 Mario Carneiro. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mario Carneiro -/ import Mathlib.Computability.Partrec #align_import computability.partrec_code from "leanprover-community/mathlib"@"6155d4351090a6fad236e3d2e4e0e4e7342668e8" /-! # Gödel Numbering for Partial Recursive Functions. This file defines `Nat.Partrec.Code`, an inductive datatype describing code for partial recursive functions on ℕ. It defines an encoding for these codes, and proves that the constructors are primitive recursive with respect to the encoding. It also defines the evaluation of these codes as partial functions using `PFun`, and proves that a function is partially recursive (as defined by `Nat.Partrec`) if and only if it is the evaluation of some code. ## Main Definitions * `Nat.Partrec.Code`: Inductive datatype for partial recursive codes. * `Nat.Partrec.Code.encodeCode`: A (computable) encoding of codes as natural numbers. * `Nat.Partrec.Code.ofNatCode`: The inverse of this encoding. * `Nat.Partrec.Code.eval`: The interpretation of a `Nat.Partrec.Code` as a partial function. ## Main Results * `Nat.Partrec.Code.rec_prim`: Recursion on `Nat.Partrec.Code` is primitive recursive. * `Nat.Partrec.Code.rec_computable`: Recursion on `Nat.Partrec.Code` is computable. * `Nat.Partrec.Code.smn`: The $S_n^m$ theorem. * `Nat.Partrec.Code.exists_code`: Partial recursiveness is equivalent to being the eval of a code. * `Nat.Partrec.Code.evaln_prim`: `evaln` is primitive recursive. * `Nat.Partrec.Code.fixed_point`: Roger's fixed point theorem. ## References * [Mario Carneiro, *Formalizing computability theory via partial recursive functions*][carneiro2019] -/ open Encodable Denumerable Primrec namespace Nat.Partrec open Nat (pair) theorem rfind' {f} (hf : Nat.Partrec f) : Nat.Partrec (Nat.unpaired fun a m => (Nat.rfind fun n => (fun m => m = 0) <$> f (Nat.pair a (n + m))).map (· + m)) := Partrec₂.unpaired'.2 <| by refine' Partrec.map ((@Partrec₂.unpaired' fun a b : ℕ => Nat.rfind fun n => (fun m => m = 0) <$> f (Nat.pair a (n + b))).1 _) (Primrec.nat_add.comp Primrec.snd <| Primrec.snd.comp Primrec.fst).to_comp.to₂ have : Nat.Partrec (fun a => Nat.rfind (fun n => (fun m => decide (m = 0)) <$> Nat.unpaired (fun a b => f (Nat.pair (Nat.unpair a).1 (b + (Nat.unpair a).2))) (Nat.pair a n))) := rfind (Partrec₂.unpaired'.2 ((Partrec.nat_iff.2 hf).comp (Primrec₂.pair.comp (Primrec.fst.comp <| Primrec.unpair.comp Primrec.fst) (Primrec.nat_add.comp Primrec.snd (Primrec.snd.comp <| Primrec.unpair.comp Primrec.fst))).to_comp))
simp at this
theorem rfind' {f} (hf : Nat.Partrec f) : Nat.Partrec (Nat.unpaired fun a m => (Nat.rfind fun n => (fun m => m = 0) <$> f (Nat.pair a (n + m))).map (· + m)) := Partrec₂.unpaired'.2 <| by refine' Partrec.map ((@Partrec₂.unpaired' fun a b : ℕ => Nat.rfind fun n => (fun m => m = 0) <$> f (Nat.pair a (n + b))).1 _) (Primrec.nat_add.comp Primrec.snd <| Primrec.snd.comp Primrec.fst).to_comp.to₂ have : Nat.Partrec (fun a => Nat.rfind (fun n => (fun m => decide (m = 0)) <$> Nat.unpaired (fun a b => f (Nat.pair (Nat.unpair a).1 (b + (Nat.unpair a).2))) (Nat.pair a n))) := rfind (Partrec₂.unpaired'.2 ((Partrec.nat_iff.2 hf).comp (Primrec₂.pair.comp (Primrec.fst.comp <| Primrec.unpair.comp Primrec.fst) (Primrec.nat_add.comp Primrec.snd (Primrec.snd.comp <| Primrec.unpair.comp Primrec.fst))).to_comp))
Mathlib.Computability.PartrecCode.50_0.A3c3Aev6SyIRjCJ
theorem rfind' {f} (hf : Nat.Partrec f) : Nat.Partrec (Nat.unpaired fun a m => (Nat.rfind fun n => (fun m => m = 0) <$> f (Nat.pair a (n + m))).map (· + m))
Mathlib_Computability_PartrecCode
f : ℕ →. ℕ hf : Partrec f this : Partrec fun a => Nat.rfind fun n => Part.map (fun m => decide (m = 0)) (f (Nat.pair (unpair a).1 (n + (unpair a).2))) ⊢ Partrec (unpaired fun a b => Nat.rfind fun n => (fun m => decide (m = 0)) <$> f (Nat.pair a (n + b)))
/- Copyright (c) 2018 Mario Carneiro. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mario Carneiro -/ import Mathlib.Computability.Partrec #align_import computability.partrec_code from "leanprover-community/mathlib"@"6155d4351090a6fad236e3d2e4e0e4e7342668e8" /-! # Gödel Numbering for Partial Recursive Functions. This file defines `Nat.Partrec.Code`, an inductive datatype describing code for partial recursive functions on ℕ. It defines an encoding for these codes, and proves that the constructors are primitive recursive with respect to the encoding. It also defines the evaluation of these codes as partial functions using `PFun`, and proves that a function is partially recursive (as defined by `Nat.Partrec`) if and only if it is the evaluation of some code. ## Main Definitions * `Nat.Partrec.Code`: Inductive datatype for partial recursive codes. * `Nat.Partrec.Code.encodeCode`: A (computable) encoding of codes as natural numbers. * `Nat.Partrec.Code.ofNatCode`: The inverse of this encoding. * `Nat.Partrec.Code.eval`: The interpretation of a `Nat.Partrec.Code` as a partial function. ## Main Results * `Nat.Partrec.Code.rec_prim`: Recursion on `Nat.Partrec.Code` is primitive recursive. * `Nat.Partrec.Code.rec_computable`: Recursion on `Nat.Partrec.Code` is computable. * `Nat.Partrec.Code.smn`: The $S_n^m$ theorem. * `Nat.Partrec.Code.exists_code`: Partial recursiveness is equivalent to being the eval of a code. * `Nat.Partrec.Code.evaln_prim`: `evaln` is primitive recursive. * `Nat.Partrec.Code.fixed_point`: Roger's fixed point theorem. ## References * [Mario Carneiro, *Formalizing computability theory via partial recursive functions*][carneiro2019] -/ open Encodable Denumerable Primrec namespace Nat.Partrec open Nat (pair) theorem rfind' {f} (hf : Nat.Partrec f) : Nat.Partrec (Nat.unpaired fun a m => (Nat.rfind fun n => (fun m => m = 0) <$> f (Nat.pair a (n + m))).map (· + m)) := Partrec₂.unpaired'.2 <| by refine' Partrec.map ((@Partrec₂.unpaired' fun a b : ℕ => Nat.rfind fun n => (fun m => m = 0) <$> f (Nat.pair a (n + b))).1 _) (Primrec.nat_add.comp Primrec.snd <| Primrec.snd.comp Primrec.fst).to_comp.to₂ have : Nat.Partrec (fun a => Nat.rfind (fun n => (fun m => decide (m = 0)) <$> Nat.unpaired (fun a b => f (Nat.pair (Nat.unpair a).1 (b + (Nat.unpair a).2))) (Nat.pair a n))) := rfind (Partrec₂.unpaired'.2 ((Partrec.nat_iff.2 hf).comp (Primrec₂.pair.comp (Primrec.fst.comp <| Primrec.unpair.comp Primrec.fst) (Primrec.nat_add.comp Primrec.snd (Primrec.snd.comp <| Primrec.unpair.comp Primrec.fst))).to_comp)) simp at this;
exact this
theorem rfind' {f} (hf : Nat.Partrec f) : Nat.Partrec (Nat.unpaired fun a m => (Nat.rfind fun n => (fun m => m = 0) <$> f (Nat.pair a (n + m))).map (· + m)) := Partrec₂.unpaired'.2 <| by refine' Partrec.map ((@Partrec₂.unpaired' fun a b : ℕ => Nat.rfind fun n => (fun m => m = 0) <$> f (Nat.pair a (n + b))).1 _) (Primrec.nat_add.comp Primrec.snd <| Primrec.snd.comp Primrec.fst).to_comp.to₂ have : Nat.Partrec (fun a => Nat.rfind (fun n => (fun m => decide (m = 0)) <$> Nat.unpaired (fun a b => f (Nat.pair (Nat.unpair a).1 (b + (Nat.unpair a).2))) (Nat.pair a n))) := rfind (Partrec₂.unpaired'.2 ((Partrec.nat_iff.2 hf).comp (Primrec₂.pair.comp (Primrec.fst.comp <| Primrec.unpair.comp Primrec.fst) (Primrec.nat_add.comp Primrec.snd (Primrec.snd.comp <| Primrec.unpair.comp Primrec.fst))).to_comp)) simp at this;
Mathlib.Computability.PartrecCode.50_0.A3c3Aev6SyIRjCJ
theorem rfind' {f} (hf : Nat.Partrec f) : Nat.Partrec (Nat.unpaired fun a m => (Nat.rfind fun n => (fun m => m = 0) <$> f (Nat.pair a (n + m))).map (· + m))
Mathlib_Computability_PartrecCode
x✝ : Code.const 0 = Code.const 0 ⊢ 0 = 0
/- Copyright (c) 2018 Mario Carneiro. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mario Carneiro -/ import Mathlib.Computability.Partrec #align_import computability.partrec_code from "leanprover-community/mathlib"@"6155d4351090a6fad236e3d2e4e0e4e7342668e8" /-! # Gödel Numbering for Partial Recursive Functions. This file defines `Nat.Partrec.Code`, an inductive datatype describing code for partial recursive functions on ℕ. It defines an encoding for these codes, and proves that the constructors are primitive recursive with respect to the encoding. It also defines the evaluation of these codes as partial functions using `PFun`, and proves that a function is partially recursive (as defined by `Nat.Partrec`) if and only if it is the evaluation of some code. ## Main Definitions * `Nat.Partrec.Code`: Inductive datatype for partial recursive codes. * `Nat.Partrec.Code.encodeCode`: A (computable) encoding of codes as natural numbers. * `Nat.Partrec.Code.ofNatCode`: The inverse of this encoding. * `Nat.Partrec.Code.eval`: The interpretation of a `Nat.Partrec.Code` as a partial function. ## Main Results * `Nat.Partrec.Code.rec_prim`: Recursion on `Nat.Partrec.Code` is primitive recursive. * `Nat.Partrec.Code.rec_computable`: Recursion on `Nat.Partrec.Code` is computable. * `Nat.Partrec.Code.smn`: The $S_n^m$ theorem. * `Nat.Partrec.Code.exists_code`: Partial recursiveness is equivalent to being the eval of a code. * `Nat.Partrec.Code.evaln_prim`: `evaln` is primitive recursive. * `Nat.Partrec.Code.fixed_point`: Roger's fixed point theorem. ## References * [Mario Carneiro, *Formalizing computability theory via partial recursive functions*][carneiro2019] -/ open Encodable Denumerable Primrec namespace Nat.Partrec open Nat (pair) theorem rfind' {f} (hf : Nat.Partrec f) : Nat.Partrec (Nat.unpaired fun a m => (Nat.rfind fun n => (fun m => m = 0) <$> f (Nat.pair a (n + m))).map (· + m)) := Partrec₂.unpaired'.2 <| by refine' Partrec.map ((@Partrec₂.unpaired' fun a b : ℕ => Nat.rfind fun n => (fun m => m = 0) <$> f (Nat.pair a (n + b))).1 _) (Primrec.nat_add.comp Primrec.snd <| Primrec.snd.comp Primrec.fst).to_comp.to₂ have : Nat.Partrec (fun a => Nat.rfind (fun n => (fun m => decide (m = 0)) <$> Nat.unpaired (fun a b => f (Nat.pair (Nat.unpair a).1 (b + (Nat.unpair a).2))) (Nat.pair a n))) := rfind (Partrec₂.unpaired'.2 ((Partrec.nat_iff.2 hf).comp (Primrec₂.pair.comp (Primrec.fst.comp <| Primrec.unpair.comp Primrec.fst) (Primrec.nat_add.comp Primrec.snd (Primrec.snd.comp <| Primrec.unpair.comp Primrec.fst))).to_comp)) simp at this; exact this #align nat.partrec.rfind' Nat.Partrec.rfind' /-- Code for partial recursive functions from ℕ to ℕ. See `Nat.Partrec.Code.eval` for the interpretation of these constructors. -/ inductive Code : Type | zero : Code | succ : Code | left : Code | right : Code | pair : Code → Code → Code | comp : Code → Code → Code | prec : Code → Code → Code | rfind' : Code → Code #align nat.partrec.code Nat.Partrec.Code -- Porting note: `Nat.Partrec.Code.recOn` is noncomputable in Lean4, so we make it computable. compile_inductive% Code end Nat.Partrec namespace Nat.Partrec.Code open Nat (pair unpair) open Nat.Partrec (Code) instance instInhabited : Inhabited Code := ⟨zero⟩ #align nat.partrec.code.inhabited Nat.Partrec.Code.instInhabited /-- Returns a code for the constant function outputting a particular natural. -/ protected def const : ℕ → Code | 0 => zero | n + 1 => comp succ (Code.const n) #align nat.partrec.code.const Nat.Partrec.Code.const theorem const_inj : ∀ {n₁ n₂}, Nat.Partrec.Code.const n₁ = Nat.Partrec.Code.const n₂ → n₁ = n₂ | 0, 0, _ => by
simp
theorem const_inj : ∀ {n₁ n₂}, Nat.Partrec.Code.const n₁ = Nat.Partrec.Code.const n₂ → n₁ = n₂ | 0, 0, _ => by
Mathlib.Computability.PartrecCode.108_0.A3c3Aev6SyIRjCJ
theorem const_inj : ∀ {n₁ n₂}, Nat.Partrec.Code.const n₁ = Nat.Partrec.Code.const n₂ → n₁ = n₂ | 0, 0, _ => by simp | n₁ + 1, n₂ + 1, h => by dsimp [Nat.add_one, Nat.Partrec.Code.const] at h injection h with h₁ h₂ simp only [const_inj h₂]
Mathlib_Computability_PartrecCode