File: Mathlib/CategoryTheory/Sites/Coverage.lean

full_name: CategoryTheory.Presieve.FactorsThruAlong
code: /--
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 
goal: Prop

full_name: CategoryTheory.Presieve.FactorsThru
code: /--
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 
goal: Prop

full_name: CategoryTheory.Presieve.factorsThruAlong_id
code: @[simp]
lemma factorsThruAlong_id {X : C} (S T : Presieve X) :
    S.FactorsThruAlong T (𝟙 X) ↔ S.FactorsThru T 
goal: S.FactorsThruAlong T (CategoryTheory.CategoryStruct.id X) ↔ S.FactorsThru T

full_name: CategoryTheory.Presieve.factorsThru_of_le
code: lemma factorsThru_of_le {X : C} (S T : Presieve X) (h : S ≤ T) :
    S.FactorsThru T 
goal: S.FactorsThru T

full_name: CategoryTheory.Presieve.le_of_factorsThru_sieve
code: lemma le_of_factorsThru_sieve {X : C} (S : Presieve X) (T : Sieve X) (h : S.FactorsThru T) :
    S ≤ T 
goal: S ≤ T.arrows

full_name: CategoryTheory.Presieve.factorsThru_top
code: lemma factorsThru_top {X : C} (S : Presieve X) : S.FactorsThru ⊤ 
goal: S.FactorsThru ⊤

full_name: CategoryTheory.Presieve.isSheafFor_of_factorsThru
code: lemma isSheafFor_of_factorsThru
    {X : C} {S T : Presieve X}
    (P : Cᵒᵖ ⥤ Type*)
    (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 
goal: CategoryTheory.Presieve.IsSheafFor P T

full_name: CategoryTheory.Coverage
code: /--
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
goal: Type (max u_1 u_2)

full_name: CategoryTheory.Coverage.pullback
code: /--
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
goal: S ∈ self.covering X → ∃ T ∈ self.covering Y, T.FactorsThruAlong S f

full_name: CategoryTheory.Coverage.covering
code: /--
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
goal: Set (CategoryTheory.Presieve X)

full_name: CategoryTheory.Coverage.instCoeFunForallSetPresieve
code: instance : CoeFun (Coverage C) (fun _ => (X : C) → Set (Presieve X)) 
goal: CoeFun (CategoryTheory.Coverage C) fun x => (X : C) → Set (CategoryTheory.Presieve X)

full_name: CategoryTheory.Coverage.ofGrothendieck
code: /--
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 
goal: CategoryTheory.Coverage C

full_name: CategoryTheory.Coverage.ofGrothendieck_iff
code: lemma ofGrothendieck_iff {X : C} {S : Presieve X} (J : GrothendieckTopology C) :
    S ∈ ofGrothendieck _ J X ↔ Sieve.generate S ∈ J X 
goal: S ∈ (CategoryTheory.Coverage.ofGrothendieck C J).covering X ↔ CategoryTheory.Sieve.generate S ∈ J.sieves X

full_name: CategoryTheory.Coverage.Saturate
code: /--
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
goal: CategoryTheory.Sieve X → Prop

full_name: CategoryTheory.Coverage.Saturate.top
code: /--
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
goal: K.Saturate X ⊤

full_name: CategoryTheory.Coverage.Saturate.transitive
code: /--
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
goal: K.Saturate X R → (∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → K.Saturate Y (CategoryTheory.Sieve.pullback f S)) → K.Saturate X S

full_name: CategoryTheory.Coverage.Saturate.of
code: /--
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
goal: K.Saturate X (CategoryTheory.Sieve.generate S)

full_name: CategoryTheory.Coverage.eq_top_pullback
code: lemma eq_top_pullback {X Y : C} {S T : Sieve X} (h : S ≤ T) (f : Y ⟶ X) (hf : S f) :
    T.pullback f = ⊤ 
goal: CategoryTheory.Sieve.pullback f T = ⊤

full_name: CategoryTheory.Coverage.saturate_of_superset
code: 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 
goal: K.Saturate X T

full_name: CategoryTheory.Coverage.toGrothendieck
code: /--
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 
goal: CategoryTheory.GrothendieckTopology C

full_name: CategoryTheory.Coverage.instPartialOrder
code: instance : PartialOrder (Coverage C) 
goal: PartialOrder (CategoryTheory.Coverage C)

full_name: CategoryTheory.Coverage.gi
code: /--
The two constructions `Coverage.toGrothendieck` and `Coverage.ofGrothendieck` form
a Galois insertion.
-/
def gi : GaloisInsertion (toGrothendieck C) (ofGrothendieck C) 
goal: GaloisInsertion (CategoryTheory.Coverage.toGrothendieck C) (CategoryTheory.Coverage.ofGrothendieck C)

full_name: CategoryTheory.Coverage.toGrothendieck_eq_sInf
code: /--
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 } 
goal: CategoryTheory.Coverage.toGrothendieck C K = sInf {J | K ≤ CategoryTheory.Coverage.ofGrothendieck C J}

full_name: CategoryTheory.Coverage.instSemilatticeSup
code: instance : SemilatticeSup (Coverage C) 
goal: SemilatticeSup (CategoryTheory.Coverage C)

full_name: CategoryTheory.Coverage.sup_covering
code: @[simp]
lemma sup_covering (x y : Coverage C) (B : C) :
    (x ⊔ y).covering B = x.covering B ∪ y.covering B 
goal: (x ⊔ y).covering B = x.covering B ∪ y.covering B

full_name: CategoryTheory.Coverage.mem_toGrothendieck_sieves_of_superset
code: /--
Any sieve that contains a covering presieve for a coverage is a covering sieve for the associated
Grothendieck topology.
-/
theorem mem_toGrothendieck_sieves_of_superset (K : Coverage C) {X : C} {S : Sieve X}
    {R : Presieve X} (h : R ≤ S) (hR : R ∈ K.covering X) : S ∈ (K.toGrothendieck C).sieves X 
goal: S ∈ (CategoryTheory.Coverage.toGrothendieck C K).sieves X

full_name: CategoryTheory.Presieve.isSheaf_coverage
code: /--
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*) :
    Presieve.IsSheaf (toGrothendieck _ K) P ↔
    (∀ {X : C} (R : Presieve X), R ∈ K X → Presieve.IsSheafFor P R) 
goal: CategoryTheory.Presieve.IsSheaf (CategoryTheory.Coverage.toGrothendieck C K) P ↔
  ∀ {X : C}, ∀ R ∈ K.covering X, CategoryTheory.Presieve.IsSheafFor P R

full_name: CategoryTheory.Presieve.isSheaf_sup
code: /--
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*) :
    (Presieve.IsSheaf ((K ⊔ L).toGrothendieck C)) P ↔
    (Presieve.IsSheaf (K.toGrothendieck C)) P ∧ (Presieve.IsSheaf (L.toGrothendieck C)) P 
goal: CategoryTheory.Presieve.IsSheaf (CategoryTheory.Coverage.toGrothendieck C (K ⊔ L)) P ↔
  CategoryTheory.Presieve.IsSheaf (CategoryTheory.Coverage.toGrothendieck C K) P ∧
    CategoryTheory.Presieve.IsSheaf (CategoryTheory.Coverage.toGrothendieck C L) P

full_name: CategoryTheory.Presheaf.isSheaf_iff_isLimit_coverage
code: theorem isSheaf_iff_isLimit_coverage (K : Coverage C) (P : Cᵒᵖ ⥤ D) :
    Presheaf.IsSheaf (toGrothendieck _ K) P ↔ ∀ ⦃X : C⦄ (R : Presieve X),
      R ∈ K.covering X →
        Nonempty (IsLimit (P.mapCone (Sieve.generate R).arrows.cocone.op)) 
goal: CategoryTheory.Presheaf.IsSheaf (CategoryTheory.Coverage.toGrothendieck C K) P ↔
  ∀ ⦃X : C⦄,
    ∀ R ∈ K.covering X,
      Nonempty (CategoryTheory.Limits.IsLimit (P.mapCone (CategoryTheory.Sieve.generate R).arrows.cocone.op))

full_name: CategoryTheory.Presheaf.isSheaf_sup
code: theorem isSheaf_sup (K L : Coverage C) (P : Cᵒᵖ ⥤ D) :
    (IsSheaf ((K ⊔ L).toGrothendieck C)) P ↔
    (IsSheaf (K.toGrothendieck C)) P ∧ (IsSheaf (L.toGrothendieck C)) P 
goal: CategoryTheory.Presheaf.IsSheaf (CategoryTheory.Coverage.toGrothendieck C (K ⊔ L)) P ↔
  CategoryTheory.Presheaf.IsSheaf (CategoryTheory.Coverage.toGrothendieck C K) P ∧
    CategoryTheory.Presheaf.IsSheaf (CategoryTheory.Coverage.toGrothendieck C L) P