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 intro.intro.intro
C : Type u
inst✝² : Category.{v, u} C
B : C
F : Cᵒᵖ ⥤ Type (max u v)
hF : EqualizerCondition F
X : C
π : X ⟶ B
πsurj : EffectiveEpi π
inst✝¹ : regular (ofArrows (fun x => X) fun x => π)
inst✝ : hasPullbacks (ofArrows (fun x => X) fun x => π)
y : Unit → F.obj (op X)
h : Arrows.PullbackCompatible F (fun x => π) y
⊢ ∃! t, ∀ (i : Unit), F.map π.op t = y i | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
| have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance | lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
| Mathlib.CategoryTheory.Sites.RegularExtensive.243_0.rkSRr0zuqme90Yu | lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F | Mathlib_CategoryTheory_Sites_RegularExtensive |
C : Type u
inst✝² : Category.{v, u} C
B : C
F : Cᵒᵖ ⥤ Type (max u v)
hF : EqualizerCondition F
X : C
π : X ⟶ B
πsurj : EffectiveEpi π
inst✝¹ : regular (ofArrows (fun x => X) fun x => π)
inst✝ : hasPullbacks (ofArrows (fun x => X) fun x => π)
y : Unit → F.obj (op X)
h : Arrows.PullbackCompatible F (fun x => π) y
⊢ hasPullbacks (Presieve.singleton π) | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by | rw [← ofArrows_pUnit] | lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by | Mathlib.CategoryTheory.Sites.RegularExtensive.243_0.rkSRr0zuqme90Yu | lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F | Mathlib_CategoryTheory_Sites_RegularExtensive |
C : Type u
inst✝² : Category.{v, u} C
B : C
F : Cᵒᵖ ⥤ Type (max u v)
hF : EqualizerCondition F
X : C
π : X ⟶ B
πsurj : EffectiveEpi π
inst✝¹ : regular (ofArrows (fun x => X) fun x => π)
inst✝ : hasPullbacks (ofArrows (fun x => X) fun x => π)
y : Unit → F.obj (op X)
h : Arrows.PullbackCompatible F (fun x => π) y
⊢ hasPullbacks (ofArrows (fun x => X) fun x => π) | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; | infer_instance | lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; | Mathlib.CategoryTheory.Sites.RegularExtensive.243_0.rkSRr0zuqme90Yu | lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F | Mathlib_CategoryTheory_Sites_RegularExtensive |
case intro.intro.intro
C : Type u
inst✝² : Category.{v, u} C
B : C
F : Cᵒᵖ ⥤ Type (max u v)
hF : EqualizerCondition F
X : C
π : X ⟶ B
πsurj : EffectiveEpi π
inst✝¹ : regular (ofArrows (fun x => X) fun x => π)
inst✝ : hasPullbacks (ofArrows (fun x => X) fun x => π)
y : Unit → F.obj (op X)
h : Arrows.PullbackCompatible F (fun x => π) y
this : hasPullbacks (Presieve.singleton π)
⊢ ∃! t, ∀ (i : Unit), F.map π.op t = y i | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
| have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk | lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
| Mathlib.CategoryTheory.Sites.RegularExtensive.243_0.rkSRr0zuqme90Yu | lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F | Mathlib_CategoryTheory_Sites_RegularExtensive |
case intro.intro.intro
C : Type u
inst✝² : Category.{v, u} C
B : C
F : Cᵒᵖ ⥤ Type (max u v)
hF : EqualizerCondition F
X : C
π : X ⟶ B
πsurj : EffectiveEpi π
inst✝¹ : regular (ofArrows (fun x => X) fun x => π)
inst✝ : hasPullbacks (ofArrows (fun x => X) fun x => π)
y : Unit → F.obj (op X)
h : Arrows.PullbackCompatible F (fun x => π) y
this✝ : hasPullbacks (Presieve.singleton π)
this : HasPullback π π
⊢ ∃! t, ∀ (i : Unit), F.map π.op t = y i | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
| specialize hF X B π | lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
| Mathlib.CategoryTheory.Sites.RegularExtensive.243_0.rkSRr0zuqme90Yu | lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F | Mathlib_CategoryTheory_Sites_RegularExtensive |
case intro.intro.intro
C : Type u
inst✝² : Category.{v, u} C
B : C
F : Cᵒᵖ ⥤ Type (max u v)
X : C
π : X ⟶ B
πsurj : EffectiveEpi π
inst✝¹ : regular (ofArrows (fun x => X) fun x => π)
inst✝ : hasPullbacks (ofArrows (fun x => X) fun x => π)
y : Unit → F.obj (op X)
h : Arrows.PullbackCompatible F (fun x => π) y
this✝ : hasPullbacks (Presieve.singleton π)
this : HasPullback π π
hF : Function.Bijective (MapToEqualizer F π pullback.fst pullback.snd (_ : pullback.fst ≫ π = pullback.snd ≫ π))
⊢ ∃! t, ∀ (i : Unit), F.map π.op t = y i | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
| rw [Function.bijective_iff_existsUnique] at hF | lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
| Mathlib.CategoryTheory.Sites.RegularExtensive.243_0.rkSRr0zuqme90Yu | lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F | Mathlib_CategoryTheory_Sites_RegularExtensive |
case intro.intro.intro
C : Type u
inst✝² : Category.{v, u} C
B : C
F : Cᵒᵖ ⥤ Type (max u v)
X : C
π : X ⟶ B
πsurj : EffectiveEpi π
inst✝¹ : regular (ofArrows (fun x => X) fun x => π)
inst✝ : hasPullbacks (ofArrows (fun x => X) fun x => π)
y : Unit → F.obj (op X)
h : Arrows.PullbackCompatible F (fun x => π) y
this✝ : hasPullbacks (Presieve.singleton π)
this : HasPullback π π
hF :
∀ (b : ↑{x | F.map pullback.fst.op x = F.map pullback.snd.op x}),
∃! a, MapToEqualizer F π pullback.fst pullback.snd (_ : pullback.fst ≫ π = pullback.snd ≫ π) a = b
⊢ ∃! t, ∀ (i : Unit), F.map π.op t = y i | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
| obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩ | lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
| Mathlib.CategoryTheory.Sites.RegularExtensive.243_0.rkSRr0zuqme90Yu | lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F | Mathlib_CategoryTheory_Sites_RegularExtensive |
case intro.intro.intro.intro.intro
C : Type u
inst✝² : Category.{v, u} C
B : C
F : Cᵒᵖ ⥤ Type (max u v)
X : C
π : X ⟶ B
πsurj : EffectiveEpi π
inst✝¹ : regular (ofArrows (fun x => X) fun x => π)
inst✝ : hasPullbacks (ofArrows (fun x => X) fun x => π)
y : Unit → F.obj (op X)
h : Arrows.PullbackCompatible F (fun x => π) y
this✝ : hasPullbacks (Presieve.singleton π)
this : HasPullback π π
hF :
∀ (b : ↑{x | F.map pullback.fst.op x = F.map pullback.snd.op x}),
∃! a, MapToEqualizer F π pullback.fst pullback.snd (_ : pullback.fst ≫ π = pullback.snd ≫ π) a = b
t : F.obj (op B)
ht :
MapToEqualizer F π pullback.fst pullback.snd (_ : pullback.fst ≫ π = pullback.snd ≫ π) t =
{ val := y (), property := (_ : F.map pullback.fst.op (y ()) = F.map pullback.snd.op (y ())) }
ht' :
∀ (y_1 : F.obj (op B)),
(fun a =>
MapToEqualizer F π pullback.fst pullback.snd (_ : pullback.fst ≫ π = pullback.snd ≫ π) a =
{ val := y (), property := (_ : F.map pullback.fst.op (y ()) = F.map pullback.snd.op (y ())) })
y_1 →
y_1 = t
⊢ ∃! t, ∀ (i : Unit), F.map π.op t = y i | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
| refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩ | lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
| Mathlib.CategoryTheory.Sites.RegularExtensive.243_0.rkSRr0zuqme90Yu | lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F | Mathlib_CategoryTheory_Sites_RegularExtensive |
case intro.intro.intro.intro.intro.refine_1
C : Type u
inst✝² : Category.{v, u} C
B : C
F : Cᵒᵖ ⥤ Type (max u v)
X : C
π : X ⟶ B
πsurj : EffectiveEpi π
inst✝¹ : regular (ofArrows (fun x => X) fun x => π)
inst✝ : hasPullbacks (ofArrows (fun x => X) fun x => π)
y : Unit → F.obj (op X)
h : Arrows.PullbackCompatible F (fun x => π) y
this✝ : hasPullbacks (Presieve.singleton π)
this : HasPullback π π
hF :
∀ (b : ↑{x | F.map pullback.fst.op x = F.map pullback.snd.op x}),
∃! a, MapToEqualizer F π pullback.fst pullback.snd (_ : pullback.fst ≫ π = pullback.snd ≫ π) a = b
t : F.obj (op B)
ht :
MapToEqualizer F π pullback.fst pullback.snd (_ : pullback.fst ≫ π = pullback.snd ≫ π) t =
{ val := y (), property := (_ : F.map pullback.fst.op (y ()) = F.map pullback.snd.op (y ())) }
ht' :
∀ (y_1 : F.obj (op B)),
(fun a =>
MapToEqualizer F π pullback.fst pullback.snd (_ : pullback.fst ≫ π = pullback.snd ≫ π) a =
{ val := y (), property := (_ : F.map pullback.fst.op (y ()) = F.map pullback.snd.op (y ())) })
y_1 →
y_1 = t
x✝ : Unit
⊢ F.map π.op t = y x✝ | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· | simpa [MapToEqualizer] using ht | lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· | Mathlib.CategoryTheory.Sites.RegularExtensive.243_0.rkSRr0zuqme90Yu | lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F | Mathlib_CategoryTheory_Sites_RegularExtensive |
case intro.intro.intro.intro.intro.refine_2
C : Type u
inst✝² : Category.{v, u} C
B : C
F : Cᵒᵖ ⥤ Type (max u v)
X : C
π : X ⟶ B
πsurj : EffectiveEpi π
inst✝¹ : regular (ofArrows (fun x => X) fun x => π)
inst✝ : hasPullbacks (ofArrows (fun x => X) fun x => π)
y : Unit → F.obj (op X)
h✝ : Arrows.PullbackCompatible F (fun x => π) y
this✝ : hasPullbacks (Presieve.singleton π)
this : HasPullback π π
hF :
∀ (b : ↑{x | F.map pullback.fst.op x = F.map pullback.snd.op x}),
∃! a, MapToEqualizer F π pullback.fst pullback.snd (_ : pullback.fst ≫ π = pullback.snd ≫ π) a = b
t : F.obj (op B)
ht :
MapToEqualizer F π pullback.fst pullback.snd (_ : pullback.fst ≫ π = pullback.snd ≫ π) t =
{ val := y (), property := (_ : F.map pullback.fst.op (y ()) = F.map pullback.snd.op (y ())) }
ht' :
∀ (y_1 : F.obj (op B)),
(fun a =>
MapToEqualizer F π pullback.fst pullback.snd (_ : pullback.fst ≫ π = pullback.snd ≫ π) a =
{ val := y (), property := (_ : F.map pullback.fst.op (y ()) = F.map pullback.snd.op (y ())) })
y_1 →
y_1 = t
x : F.obj (op B)
h : (fun t => ∀ (i : Unit), F.map π.op t = y i) x
⊢ (fun a =>
MapToEqualizer F π pullback.fst pullback.snd (_ : pullback.fst ≫ π = pullback.snd ≫ π) a =
{ val := y (), property := (_ : F.map pullback.fst.op (y ()) = F.map pullback.snd.op (y ())) })
x | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· | simpa [MapToEqualizer] using h () | lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· | Mathlib.CategoryTheory.Sites.RegularExtensive.243_0.rkSRr0zuqme90Yu | lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F | Mathlib_CategoryTheory_Sites_RegularExtensive |
C : Type u
inst✝ : Category.{v, u} C
F : Cᵒᵖ ⥤ Type (max u v)
hSF : ∀ {B : C} (S : Presieve B) [inst : regular S] [inst : hasPullbacks S], IsSheafFor F S
⊢ EqualizerCondition F | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
| intro X B π _ _ | lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
| Mathlib.CategoryTheory.Sites.RegularExtensive.259_0.rkSRr0zuqme90Yu | lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F | Mathlib_CategoryTheory_Sites_RegularExtensive |
C : Type u
inst✝² : Category.{v, u} C
F : Cᵒᵖ ⥤ Type (max u v)
hSF : ∀ {B : C} (S : Presieve B) [inst : regular S] [inst : hasPullbacks S], IsSheafFor F S
X B : C
π : X ⟶ B
inst✝¹ : EffectiveEpi π
inst✝ : HasPullback π π
⊢ Function.Bijective (MapToEqualizer F π pullback.fst pullback.snd (_ : pullback.fst ≫ π = pullback.snd ≫ π)) | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
| have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩ | lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
| Mathlib.CategoryTheory.Sites.RegularExtensive.259_0.rkSRr0zuqme90Yu | lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F | Mathlib_CategoryTheory_Sites_RegularExtensive |
C : Type u
inst✝² : Category.{v, u} C
F : Cᵒᵖ ⥤ Type (max u v)
hSF : ∀ {B : C} (S : Presieve B) [inst : regular S] [inst : hasPullbacks S], IsSheafFor F S
X B : C
π : X ⟶ B
inst✝¹ : EffectiveEpi π
inst✝ : HasPullback π π
this : regular (ofArrows (fun x => X) fun x => π)
⊢ Function.Bijective (MapToEqualizer F π pullback.fst pullback.snd (_ : pullback.fst ≫ π = pullback.snd ≫ π)) | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
| have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩ | lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
| Mathlib.CategoryTheory.Sites.RegularExtensive.259_0.rkSRr0zuqme90Yu | lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F | Mathlib_CategoryTheory_Sites_RegularExtensive |
C : Type u
inst✝² : Category.{v, u} C
F : Cᵒᵖ ⥤ Type (max u v)
hSF : ∀ {B : C} (S : Presieve B) [inst : regular S] [inst : hasPullbacks S], IsSheafFor F S
X B : C
π : X ⟶ B
inst✝¹ : EffectiveEpi π
inst✝ : HasPullback π π
this : regular (ofArrows (fun x => X) fun x => π)
Y✝ Z✝ : C
f✝ : Y✝ ⟶ B
hf : ofArrows (fun x => X) (fun x => π) f✝
x✝ : Z✝ ⟶ B
hg : ofArrows (fun x => X) (fun x => π) x✝
⊢ HasPullback f✝ x✝ | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by | cases hf | lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by | Mathlib.CategoryTheory.Sites.RegularExtensive.259_0.rkSRr0zuqme90Yu | lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F | Mathlib_CategoryTheory_Sites_RegularExtensive |
case mk
C : Type u
inst✝² : Category.{v, u} C
F : Cᵒᵖ ⥤ Type (max u v)
hSF : ∀ {B : C} (S : Presieve B) [inst : regular S] [inst : hasPullbacks S], IsSheafFor F S
X B : C
π : X ⟶ B
inst✝¹ : EffectiveEpi π
inst✝ : HasPullback π π
this : regular (ofArrows (fun x => X) fun x => π)
Z✝ : C
x✝ : Z✝ ⟶ B
hg : ofArrows (fun x => X) (fun x => π) x✝
i✝ : Unit
⊢ HasPullback π x✝ | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; | cases hg | lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; | Mathlib.CategoryTheory.Sites.RegularExtensive.259_0.rkSRr0zuqme90Yu | lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F | Mathlib_CategoryTheory_Sites_RegularExtensive |
case mk.mk
C : Type u
inst✝² : Category.{v, u} C
F : Cᵒᵖ ⥤ Type (max u v)
hSF : ∀ {B : C} (S : Presieve B) [inst : regular S] [inst : hasPullbacks S], IsSheafFor F S
X B : C
π : X ⟶ B
inst✝¹ : EffectiveEpi π
inst✝ : HasPullback π π
this : regular (ofArrows (fun x => X) fun x => π)
i✝¹ i✝ : Unit
⊢ HasPullback π π | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; | infer_instance | lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; | Mathlib.CategoryTheory.Sites.RegularExtensive.259_0.rkSRr0zuqme90Yu | lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F | Mathlib_CategoryTheory_Sites_RegularExtensive |
C : Type u
inst✝² : Category.{v, u} C
F : Cᵒᵖ ⥤ Type (max u v)
hSF : ∀ {B : C} (S : Presieve B) [inst : regular S] [inst : hasPullbacks S], IsSheafFor F S
X B : C
π : X ⟶ B
inst✝¹ : EffectiveEpi π
inst✝ : HasPullback π π
this✝ : regular (ofArrows (fun x => X) fun x => π)
this : hasPullbacks (ofArrows (fun x => X) fun x => π)
⊢ Function.Bijective (MapToEqualizer F π pullback.fst pullback.snd (_ : pullback.fst ≫ π = pullback.snd ≫ π)) | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
| specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π)) | lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
| Mathlib.CategoryTheory.Sites.RegularExtensive.259_0.rkSRr0zuqme90Yu | lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F | Mathlib_CategoryTheory_Sites_RegularExtensive |
C : Type u
inst✝² : Category.{v, u} C
F : Cᵒᵖ ⥤ Type (max u v)
X B : C
π : X ⟶ B
inst✝¹ : EffectiveEpi π
inst✝ : HasPullback π π
this✝ : regular (ofArrows (fun x => X) fun x => π)
this : hasPullbacks (ofArrows (fun x => X) fun x => π)
hSF : IsSheafFor F (ofArrows (fun x => X) fun x => π)
⊢ Function.Bijective (MapToEqualizer F π pullback.fst pullback.snd (_ : pullback.fst ≫ π = pullback.snd ≫ π)) | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
| rw [isSheafFor_arrows_iff_pullbacks] at hSF | lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
| Mathlib.CategoryTheory.Sites.RegularExtensive.259_0.rkSRr0zuqme90Yu | lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F | Mathlib_CategoryTheory_Sites_RegularExtensive |
C : Type u
inst✝² : Category.{v, u} C
F : Cᵒᵖ ⥤ Type (max u v)
X B : C
π : X ⟶ B
inst✝¹ : EffectiveEpi π
inst✝ : HasPullback π π
this✝ : regular (ofArrows (fun x => X) fun x => π)
this : hasPullbacks (ofArrows (fun x => X) fun x => π)
hSF : ∀ (x : Unit → F.obj (op X)), Arrows.PullbackCompatible F (fun x => π) x → ∃! t, ∀ (i : Unit), F.map π.op t = x i
⊢ Function.Bijective (MapToEqualizer F π pullback.fst pullback.snd (_ : pullback.fst ≫ π = pullback.snd ≫ π)) | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
| rw [Function.bijective_iff_existsUnique] | lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
| Mathlib.CategoryTheory.Sites.RegularExtensive.259_0.rkSRr0zuqme90Yu | lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F | Mathlib_CategoryTheory_Sites_RegularExtensive |
C : Type u
inst✝² : Category.{v, u} C
F : Cᵒᵖ ⥤ Type (max u v)
X B : C
π : X ⟶ B
inst✝¹ : EffectiveEpi π
inst✝ : HasPullback π π
this✝ : regular (ofArrows (fun x => X) fun x => π)
this : hasPullbacks (ofArrows (fun x => X) fun x => π)
hSF : ∀ (x : Unit → F.obj (op X)), Arrows.PullbackCompatible F (fun x => π) x → ∃! t, ∀ (i : Unit), F.map π.op t = x i
⊢ ∀ (b : ↑{x | F.map pullback.fst.op x = F.map pullback.snd.op x}),
∃! a, MapToEqualizer F π pullback.fst pullback.snd (_ : pullback.fst ≫ π = pullback.snd ≫ π) a = b | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
| intro ⟨x, hx⟩ | lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
| Mathlib.CategoryTheory.Sites.RegularExtensive.259_0.rkSRr0zuqme90Yu | lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F | Mathlib_CategoryTheory_Sites_RegularExtensive |
C : Type u
inst✝² : Category.{v, u} C
F : Cᵒᵖ ⥤ Type (max u v)
X B : C
π : X ⟶ B
inst✝¹ : EffectiveEpi π
inst✝ : HasPullback π π
this✝ : regular (ofArrows (fun x => X) fun x => π)
this : hasPullbacks (ofArrows (fun x => X) fun x => π)
hSF : ∀ (x : Unit → F.obj (op X)), Arrows.PullbackCompatible F (fun x => π) x → ∃! t, ∀ (i : Unit), F.map π.op t = x i
x : F.obj (op X)
hx : x ∈ {x | F.map pullback.fst.op x = F.map pullback.snd.op x}
⊢ ∃! a,
MapToEqualizer F π pullback.fst pullback.snd (_ : pullback.fst ≫ π = pullback.snd ≫ π) a =
{ val := x, property := hx } | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
| obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx) | lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
| Mathlib.CategoryTheory.Sites.RegularExtensive.259_0.rkSRr0zuqme90Yu | lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F | Mathlib_CategoryTheory_Sites_RegularExtensive |
case intro.intro
C : Type u
inst✝² : Category.{v, u} C
F : Cᵒᵖ ⥤ Type (max u v)
X B : C
π : X ⟶ B
inst✝¹ : EffectiveEpi π
inst✝ : HasPullback π π
this✝ : regular (ofArrows (fun x => X) fun x => π)
this : hasPullbacks (ofArrows (fun x => X) fun x => π)
hSF : ∀ (x : Unit → F.obj (op X)), Arrows.PullbackCompatible F (fun x => π) x → ∃! t, ∀ (i : Unit), F.map π.op t = x i
x : F.obj (op X)
hx : x ∈ {x | F.map pullback.fst.op x = F.map pullback.snd.op x}
t : F.obj (op B)
ht : Unit → F.map π.op t = x
ht' : ∀ (y : F.obj (op B)), (fun t => Unit → F.map π.op t = x) y → y = t
⊢ ∃! a,
MapToEqualizer F π pullback.fst pullback.snd (_ : pullback.fst ≫ π = pullback.snd ≫ π) a =
{ val := x, property := hx } | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
| refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩ | lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
| Mathlib.CategoryTheory.Sites.RegularExtensive.259_0.rkSRr0zuqme90Yu | lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F | Mathlib_CategoryTheory_Sites_RegularExtensive |
case intro.intro.refine_1
C : Type u
inst✝² : Category.{v, u} C
F : Cᵒᵖ ⥤ Type (max u v)
X B : C
π : X ⟶ B
inst✝¹ : EffectiveEpi π
inst✝ : HasPullback π π
this✝ : regular (ofArrows (fun x => X) fun x => π)
this : hasPullbacks (ofArrows (fun x => X) fun x => π)
hSF : ∀ (x : Unit → F.obj (op X)), Arrows.PullbackCompatible F (fun x => π) x → ∃! t, ∀ (i : Unit), F.map π.op t = x i
x : F.obj (op X)
hx : x ∈ {x | F.map pullback.fst.op x = F.map pullback.snd.op x}
t : F.obj (op B)
ht : Unit → F.map π.op t = x
ht' : ∀ (y : F.obj (op B)), (fun t => Unit → F.map π.op t = x) y → y = t
⊢ (fun a =>
MapToEqualizer F π pullback.fst pullback.snd (_ : pullback.fst ≫ π = pullback.snd ≫ π) a =
{ val := x, property := hx })
t | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· | simpa [MapToEqualizer] using ht () | lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· | Mathlib.CategoryTheory.Sites.RegularExtensive.259_0.rkSRr0zuqme90Yu | lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F | Mathlib_CategoryTheory_Sites_RegularExtensive |
case intro.intro.refine_2
C : Type u
inst✝² : Category.{v, u} C
F : Cᵒᵖ ⥤ Type (max u v)
X B : C
π : X ⟶ B
inst✝¹ : EffectiveEpi π
inst✝ : HasPullback π π
this✝ : regular (ofArrows (fun x => X) fun x => π)
this : hasPullbacks (ofArrows (fun x => X) fun x => π)
hSF : ∀ (x : Unit → F.obj (op X)), Arrows.PullbackCompatible F (fun x => π) x → ∃! t, ∀ (i : Unit), F.map π.op t = x i
x : F.obj (op X)
hx : x ∈ {x | F.map pullback.fst.op x = F.map pullback.snd.op x}
t : F.obj (op B)
ht : Unit → F.map π.op t = x
ht' : ∀ (y : F.obj (op B)), (fun t => Unit → F.map π.op t = x) y → y = t
y : F.obj (op B)
h :
(fun a =>
MapToEqualizer F π pullback.fst pullback.snd (_ : pullback.fst ≫ π = pullback.snd ≫ π) a =
{ val := x, property := hx })
y
⊢ (fun t => Unit → F.map π.op t = x) y | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· | simpa [MapToEqualizer] using h | lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· | Mathlib.CategoryTheory.Sites.RegularExtensive.259_0.rkSRr0zuqme90Yu | lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F | Mathlib_CategoryTheory_Sites_RegularExtensive |
C : Type u
inst✝² : Category.{v, u} C
X : C
S : Presieve X
inst✝¹ : regular S
inst✝ : Projective X
F : Cᵒᵖ ⥤ Type (max u v)
⊢ IsSheafFor F S | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
| obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S) | lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
| Mathlib.CategoryTheory.Sites.RegularExtensive.275_0.rkSRr0zuqme90Yu | lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F | Mathlib_CategoryTheory_Sites_RegularExtensive |
case intro.intro.intro
C : Type u
inst✝² : Category.{v, u} C
X : C
inst✝¹ : Projective X
F : Cᵒᵖ ⥤ Type (max u v)
Y : C
f : Y ⟶ X
hf : EffectiveEpi f
inst✝ : regular (ofArrows (fun x => Y) fun x => f)
⊢ IsSheafFor F (ofArrows (fun x => Y) fun x => f) | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
| rw [isSheafFor_arrows_iff] | lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
| Mathlib.CategoryTheory.Sites.RegularExtensive.275_0.rkSRr0zuqme90Yu | lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F | Mathlib_CategoryTheory_Sites_RegularExtensive |
case intro.intro.intro
C : Type u
inst✝² : Category.{v, u} C
X : C
inst✝¹ : Projective X
F : Cᵒᵖ ⥤ Type (max u v)
Y : C
f : Y ⟶ X
hf : EffectiveEpi f
inst✝ : regular (ofArrows (fun x => Y) fun x => f)
⊢ ∀ (x : Unit → F.obj (op Y)), Arrows.Compatible F (fun x => f) x → ∃! t, ∀ (i : Unit), F.map f.op t = x i | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
| refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩ | lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
| Mathlib.CategoryTheory.Sites.RegularExtensive.275_0.rkSRr0zuqme90Yu | lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F | Mathlib_CategoryTheory_Sites_RegularExtensive |
case intro.intro.intro.refine_1
C : Type u
inst✝² : Category.{v, u} C
X : C
inst✝¹ : Projective X
F : Cᵒᵖ ⥤ Type (max u v)
Y : C
f : Y ⟶ X
hf : EffectiveEpi f
inst✝ : regular (ofArrows (fun x => Y) fun x => f)
x : Unit → F.obj (op Y)
hx : Arrows.Compatible F (fun x => f) x
x✝ : Unit
⊢ F.map f.op (F.map (Projective.factorThru (𝟙 X) f).op (x ())) = x x✝ | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· | simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm | lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· | Mathlib.CategoryTheory.Sites.RegularExtensive.275_0.rkSRr0zuqme90Yu | lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F | Mathlib_CategoryTheory_Sites_RegularExtensive |
C : Type u
inst✝² : Category.{v, u} C
X : C
inst✝¹ : Projective X
F : Cᵒᵖ ⥤ Type (max u v)
Y : C
f : Y ⟶ X
hf : EffectiveEpi f
inst✝ : regular (ofArrows (fun x => Y) fun x => f)
x : Unit → F.obj (op Y)
hx : Arrows.Compatible F (fun x => f) x
x✝ : Unit
⊢ 𝟙 Y ≫ (fun x => f) () = (f ≫ Projective.factorThru (𝟙 X) f) ≫ (fun x => f) () | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by | simp | lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by | Mathlib.CategoryTheory.Sites.RegularExtensive.275_0.rkSRr0zuqme90Yu | lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F | Mathlib_CategoryTheory_Sites_RegularExtensive |
case intro.intro.intro.refine_2
C : Type u
inst✝² : Category.{v, u} C
X : C
inst✝¹ : Projective X
F : Cᵒᵖ ⥤ Type (max u v)
Y : C
f : Y ⟶ X
hf : EffectiveEpi f
inst✝ : regular (ofArrows (fun x => Y) fun x => f)
x : Unit → F.obj (op Y)
hx : Arrows.Compatible F (fun x => f) x
y : F.obj (op X)
h : (fun t => ∀ (i : Unit), F.map f.op t = x i) y
⊢ y = F.map (Projective.factorThru (𝟙 X) f).op (x ()) | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· | simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply] | lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· | Mathlib.CategoryTheory.Sites.RegularExtensive.275_0.rkSRr0zuqme90Yu | lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F | Mathlib_CategoryTheory_Sites_RegularExtensive |
C : Type u
inst✝² : Category.{v, u} C
F : Cᵒᵖ ⥤ Type (max u v)
inst✝¹ : ∀ ⦃X Y : C⦄ (π : X ⟶ Y) [inst : EffectiveEpi π], HasPullback π π
inst✝ : Preregular C
⊢ IsSheaf (Coverage.toGrothendieck C (regularCoverage C)) F ↔ EqualizerCondition F | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
| rw [Presieve.isSheaf_coverage] | lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
| Mathlib.CategoryTheory.Sites.RegularExtensive.284_0.rkSRr0zuqme90Yu | lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F | Mathlib_CategoryTheory_Sites_RegularExtensive |
C : Type u
inst✝² : Category.{v, u} C
F : Cᵒᵖ ⥤ Type (max u v)
inst✝¹ : ∀ ⦃X Y : C⦄ (π : X ⟶ Y) [inst : EffectiveEpi π], HasPullback π π
inst✝ : Preregular C
⊢ (∀ {X : C}, ∀ R ∈ Coverage.covering (regularCoverage C) X, IsSheafFor F R) ↔ EqualizerCondition F | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
| refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩ | lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
| Mathlib.CategoryTheory.Sites.RegularExtensive.284_0.rkSRr0zuqme90Yu | lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F | Mathlib_CategoryTheory_Sites_RegularExtensive |
C : Type u
inst✝² : Category.{v, u} C
F : Cᵒᵖ ⥤ Type (max u v)
inst✝¹ : ∀ ⦃X Y : C⦄ (π : X ⟶ Y) [inst : EffectiveEpi π], HasPullback π π
inst✝ : Preregular C
⊢ EqualizerCondition F → ∀ {X : C}, ∀ R ∈ Coverage.covering (regularCoverage C) X, IsSheafFor F R | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
| rintro h X S ⟨Y, f, rfl, hf⟩ | lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
| Mathlib.CategoryTheory.Sites.RegularExtensive.284_0.rkSRr0zuqme90Yu | lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F | Mathlib_CategoryTheory_Sites_RegularExtensive |
case intro.intro.intro
C : Type u
inst✝² : Category.{v, u} C
F : Cᵒᵖ ⥤ Type (max u v)
inst✝¹ : ∀ ⦃X Y : C⦄ (π : X ⟶ Y) [inst : EffectiveEpi π], HasPullback π π
inst✝ : Preregular C
h : EqualizerCondition F
X Y : C
f : Y ⟶ X
hf : EffectiveEpi f
⊢ IsSheafFor F (ofArrows (fun x => Y) fun x => f) | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
| exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; cases h; infer_instance⟩ _ h | lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
| Mathlib.CategoryTheory.Sites.RegularExtensive.284_0.rkSRr0zuqme90Yu | lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F | Mathlib_CategoryTheory_Sites_RegularExtensive |
C : Type u
inst✝² : Category.{v, u} C
F : Cᵒᵖ ⥤ Type (max u v)
inst✝¹ : ∀ ⦃X Y : C⦄ (π : X ⟶ Y) [inst : EffectiveEpi π], HasPullback π π
inst✝ : Preregular C
h✝ : EqualizerCondition F
X Y : C
f : Y ⟶ X
hf : EffectiveEpi f
Y✝ Z✝ : C
f✝ : Y✝ ⟶ X
g : ofArrows (fun x => Y) (fun x => f) f✝
x✝ : Z✝ ⟶ X
h : ofArrows (fun x => Y) (fun x => f) x✝
⊢ HasPullback f✝ x✝ | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by | cases g | lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by | Mathlib.CategoryTheory.Sites.RegularExtensive.284_0.rkSRr0zuqme90Yu | lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F | Mathlib_CategoryTheory_Sites_RegularExtensive |
case mk
C : Type u
inst✝² : Category.{v, u} C
F : Cᵒᵖ ⥤ Type (max u v)
inst✝¹ : ∀ ⦃X Y : C⦄ (π : X ⟶ Y) [inst : EffectiveEpi π], HasPullback π π
inst✝ : Preregular C
h✝ : EqualizerCondition F
X Y : C
f : Y ⟶ X
hf : EffectiveEpi f
Z✝ : C
x✝ : Z✝ ⟶ X
h : ofArrows (fun x => Y) (fun x => f) x✝
i✝ : Unit
⊢ HasPullback f x✝ | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; | cases h | lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; | Mathlib.CategoryTheory.Sites.RegularExtensive.284_0.rkSRr0zuqme90Yu | lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F | Mathlib_CategoryTheory_Sites_RegularExtensive |
case mk.mk
C : Type u
inst✝² : Category.{v, u} C
F : Cᵒᵖ ⥤ Type (max u v)
inst✝¹ : ∀ ⦃X Y : C⦄ (π : X ⟶ Y) [inst : EffectiveEpi π], HasPullback π π
inst✝ : Preregular C
h : EqualizerCondition F
X Y : C
f : Y ⟶ X
hf : EffectiveEpi f
i✝¹ i✝ : Unit
⊢ HasPullback f f | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; cases h; | infer_instance | lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; cases h; | Mathlib.CategoryTheory.Sites.RegularExtensive.284_0.rkSRr0zuqme90Yu | lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F | Mathlib_CategoryTheory_Sites_RegularExtensive |
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : Preregular C
W : C
⊢ IsSheaf (Coverage.toGrothendieck C (regularCoverage C)) (yoneda.obj W) | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; cases h; infer_instance⟩ _ h
lemma isSheaf_of_projective (F : Cᵒᵖ ⥤ Type (max u v)) [Preregular C] [∀ (X : C), Projective X] :
IsSheaf (regularCoverage C).toGrothendieck F :=
(isSheaf_coverage _ _).mpr fun S ⟨_, h⟩ ↦ have : S.regular := ⟨_, h⟩
isSheafFor_regular_of_projective _ _
/-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
| rw [isSheaf_coverage] | /-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
| Mathlib.CategoryTheory.Sites.RegularExtensive.297_0.rkSRr0zuqme90Yu | /-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) | Mathlib_CategoryTheory_Sites_RegularExtensive |
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : Preregular C
W : C
⊢ ∀ {X : C}, ∀ R ∈ Coverage.covering (regularCoverage C) X, IsSheafFor (yoneda.obj W) R | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; cases h; infer_instance⟩ _ h
lemma isSheaf_of_projective (F : Cᵒᵖ ⥤ Type (max u v)) [Preregular C] [∀ (X : C), Projective X] :
IsSheaf (regularCoverage C).toGrothendieck F :=
(isSheaf_coverage _ _).mpr fun S ⟨_, h⟩ ↦ have : S.regular := ⟨_, h⟩
isSheafFor_regular_of_projective _ _
/-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
| intro X S ⟨_, hS⟩ | /-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
| Mathlib.CategoryTheory.Sites.RegularExtensive.297_0.rkSRr0zuqme90Yu | /-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) | Mathlib_CategoryTheory_Sites_RegularExtensive |
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : Preregular C
W X : C
S : Presieve X
w✝ : C
hS : ∃ f, (S = ofArrows (fun x => w✝) fun x => f) ∧ EffectiveEpi f
⊢ IsSheafFor (yoneda.obj W) S | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; cases h; infer_instance⟩ _ h
lemma isSheaf_of_projective (F : Cᵒᵖ ⥤ Type (max u v)) [Preregular C] [∀ (X : C), Projective X] :
IsSheaf (regularCoverage C).toGrothendieck F :=
(isSheaf_coverage _ _).mpr fun S ⟨_, h⟩ ↦ have : S.regular := ⟨_, h⟩
isSheafFor_regular_of_projective _ _
/-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
| have : S.regular := ⟨_, hS⟩ | /-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
| Mathlib.CategoryTheory.Sites.RegularExtensive.297_0.rkSRr0zuqme90Yu | /-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) | Mathlib_CategoryTheory_Sites_RegularExtensive |
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : Preregular C
W X : C
S : Presieve X
w✝ : C
hS : ∃ f, (S = ofArrows (fun x => w✝) fun x => f) ∧ EffectiveEpi f
this : regular S
⊢ IsSheafFor (yoneda.obj W) S | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; cases h; infer_instance⟩ _ h
lemma isSheaf_of_projective (F : Cᵒᵖ ⥤ Type (max u v)) [Preregular C] [∀ (X : C), Projective X] :
IsSheaf (regularCoverage C).toGrothendieck F :=
(isSheaf_coverage _ _).mpr fun S ⟨_, h⟩ ↦ have : S.regular := ⟨_, h⟩
isSheafFor_regular_of_projective _ _
/-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
| obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S) | /-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
| Mathlib.CategoryTheory.Sites.RegularExtensive.297_0.rkSRr0zuqme90Yu | /-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) | Mathlib_CategoryTheory_Sites_RegularExtensive |
case intro.intro.intro
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : Preregular C
W X w✝ Y : C
f : Y ⟶ X
hf : EffectiveEpi f
hS : ∃ f_1, ((ofArrows (fun x => Y) fun x => f) = ofArrows (fun x => w✝) fun x => f_1) ∧ EffectiveEpi f_1
this : regular (ofArrows (fun x => Y) fun x => f)
⊢ IsSheafFor (yoneda.obj W) (ofArrows (fun x => Y) fun x => f) | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; cases h; infer_instance⟩ _ h
lemma isSheaf_of_projective (F : Cᵒᵖ ⥤ Type (max u v)) [Preregular C] [∀ (X : C), Projective X] :
IsSheaf (regularCoverage C).toGrothendieck F :=
(isSheaf_coverage _ _).mpr fun S ⟨_, h⟩ ↦ have : S.regular := ⟨_, h⟩
isSheafFor_regular_of_projective _ _
/-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
| have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some | /-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
| Mathlib.CategoryTheory.Sites.RegularExtensive.297_0.rkSRr0zuqme90Yu | /-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) | Mathlib_CategoryTheory_Sites_RegularExtensive |
case intro.intro.intro
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : Preregular C
W X w✝ Y : C
f : Y ⟶ X
hf : EffectiveEpi f
hS : ∃ f_1, ((ofArrows (fun x => Y) fun x => f) = ofArrows (fun x => w✝) fun x => f_1) ∧ EffectiveEpi f_1
this : regular (ofArrows (fun x => Y) fun x => f)
h_colim : IsColimit (cocone (Sieve.generateSingleton f).arrows)
⊢ IsSheafFor (yoneda.obj W) (ofArrows (fun x => Y) fun x => f) | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; cases h; infer_instance⟩ _ h
lemma isSheaf_of_projective (F : Cᵒᵖ ⥤ Type (max u v)) [Preregular C] [∀ (X : C), Projective X] :
IsSheaf (regularCoverage C).toGrothendieck F :=
(isSheaf_coverage _ _).mpr fun S ⟨_, h⟩ ↦ have : S.regular := ⟨_, h⟩
isSheafFor_regular_of_projective _ _
/-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
| rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim | /-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
| Mathlib.CategoryTheory.Sites.RegularExtensive.297_0.rkSRr0zuqme90Yu | /-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) | Mathlib_CategoryTheory_Sites_RegularExtensive |
case intro.intro.intro
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : Preregular C
W X w✝ Y : C
f : Y ⟶ X
hf : EffectiveEpi f
hS : ∃ f_1, ((ofArrows (fun x => Y) fun x => f) = ofArrows (fun x => w✝) fun x => f_1) ∧ EffectiveEpi f_1
this : regular (ofArrows (fun x => Y) fun x => f)
h_colim : IsColimit (cocone (Sieve.generate (ofArrows (fun x => Y) fun x => f)).arrows)
⊢ IsSheafFor (yoneda.obj W) (ofArrows (fun x => Y) fun x => f) | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; cases h; infer_instance⟩ _ h
lemma isSheaf_of_projective (F : Cᵒᵖ ⥤ Type (max u v)) [Preregular C] [∀ (X : C), Projective X] :
IsSheaf (regularCoverage C).toGrothendieck F :=
(isSheaf_coverage _ _).mpr fun S ⟨_, h⟩ ↦ have : S.regular := ⟨_, h⟩
isSheafFor_regular_of_projective _ _
/-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim
| intro x hx | /-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim
| Mathlib.CategoryTheory.Sites.RegularExtensive.297_0.rkSRr0zuqme90Yu | /-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) | Mathlib_CategoryTheory_Sites_RegularExtensive |
case intro.intro.intro
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : Preregular C
W X w✝ Y : C
f : Y ⟶ X
hf : EffectiveEpi f
hS : ∃ f_1, ((ofArrows (fun x => Y) fun x => f) = ofArrows (fun x => w✝) fun x => f_1) ∧ EffectiveEpi f_1
this : regular (ofArrows (fun x => Y) fun x => f)
h_colim : IsColimit (cocone (Sieve.generate (ofArrows (fun x => Y) fun x => f)).arrows)
x : FamilyOfElements (yoneda.obj W) (ofArrows (fun x => Y) fun x => f)
hx : FamilyOfElements.Compatible x
⊢ ∃! t, FamilyOfElements.IsAmalgamation x t | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; cases h; infer_instance⟩ _ h
lemma isSheaf_of_projective (F : Cᵒᵖ ⥤ Type (max u v)) [Preregular C] [∀ (X : C), Projective X] :
IsSheaf (regularCoverage C).toGrothendieck F :=
(isSheaf_coverage _ _).mpr fun S ⟨_, h⟩ ↦ have : S.regular := ⟨_, h⟩
isSheafFor_regular_of_projective _ _
/-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim
intro x hx
| let x_ext := Presieve.FamilyOfElements.sieveExtend x | /-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim
intro x hx
| Mathlib.CategoryTheory.Sites.RegularExtensive.297_0.rkSRr0zuqme90Yu | /-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) | Mathlib_CategoryTheory_Sites_RegularExtensive |
case intro.intro.intro
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : Preregular C
W X w✝ Y : C
f : Y ⟶ X
hf : EffectiveEpi f
hS : ∃ f_1, ((ofArrows (fun x => Y) fun x => f) = ofArrows (fun x => w✝) fun x => f_1) ∧ EffectiveEpi f_1
this : regular (ofArrows (fun x => Y) fun x => f)
h_colim : IsColimit (cocone (Sieve.generate (ofArrows (fun x => Y) fun x => f)).arrows)
x : FamilyOfElements (yoneda.obj W) (ofArrows (fun x => Y) fun x => f)
hx : FamilyOfElements.Compatible x
x_ext : FamilyOfElements (yoneda.obj W) (Sieve.generate (ofArrows (fun x => Y) fun x => f)).arrows :=
FamilyOfElements.sieveExtend x
⊢ ∃! t, FamilyOfElements.IsAmalgamation x t | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; cases h; infer_instance⟩ _ h
lemma isSheaf_of_projective (F : Cᵒᵖ ⥤ Type (max u v)) [Preregular C] [∀ (X : C), Projective X] :
IsSheaf (regularCoverage C).toGrothendieck F :=
(isSheaf_coverage _ _).mpr fun S ⟨_, h⟩ ↦ have : S.regular := ⟨_, h⟩
isSheafFor_regular_of_projective _ _
/-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim
intro x hx
let x_ext := Presieve.FamilyOfElements.sieveExtend x
| have hx_ext := Presieve.FamilyOfElements.Compatible.sieveExtend hx | /-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim
intro x hx
let x_ext := Presieve.FamilyOfElements.sieveExtend x
| Mathlib.CategoryTheory.Sites.RegularExtensive.297_0.rkSRr0zuqme90Yu | /-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) | Mathlib_CategoryTheory_Sites_RegularExtensive |
case intro.intro.intro
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : Preregular C
W X w✝ Y : C
f : Y ⟶ X
hf : EffectiveEpi f
hS : ∃ f_1, ((ofArrows (fun x => Y) fun x => f) = ofArrows (fun x => w✝) fun x => f_1) ∧ EffectiveEpi f_1
this : regular (ofArrows (fun x => Y) fun x => f)
h_colim : IsColimit (cocone (Sieve.generate (ofArrows (fun x => Y) fun x => f)).arrows)
x : FamilyOfElements (yoneda.obj W) (ofArrows (fun x => Y) fun x => f)
hx : FamilyOfElements.Compatible x
x_ext : FamilyOfElements (yoneda.obj W) (Sieve.generate (ofArrows (fun x => Y) fun x => f)).arrows :=
FamilyOfElements.sieveExtend x
hx_ext : FamilyOfElements.Compatible (FamilyOfElements.sieveExtend x)
⊢ ∃! t, FamilyOfElements.IsAmalgamation x t | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; cases h; infer_instance⟩ _ h
lemma isSheaf_of_projective (F : Cᵒᵖ ⥤ Type (max u v)) [Preregular C] [∀ (X : C), Projective X] :
IsSheaf (regularCoverage C).toGrothendieck F :=
(isSheaf_coverage _ _).mpr fun S ⟨_, h⟩ ↦ have : S.regular := ⟨_, h⟩
isSheafFor_regular_of_projective _ _
/-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim
intro x hx
let x_ext := Presieve.FamilyOfElements.sieveExtend x
have hx_ext := Presieve.FamilyOfElements.Compatible.sieveExtend hx
| let S := Sieve.generate (Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f)) | /-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim
intro x hx
let x_ext := Presieve.FamilyOfElements.sieveExtend x
have hx_ext := Presieve.FamilyOfElements.Compatible.sieveExtend hx
| Mathlib.CategoryTheory.Sites.RegularExtensive.297_0.rkSRr0zuqme90Yu | /-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) | Mathlib_CategoryTheory_Sites_RegularExtensive |
case intro.intro.intro
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : Preregular C
W X w✝ Y : C
f : Y ⟶ X
hf : EffectiveEpi f
hS : ∃ f_1, ((ofArrows (fun x => Y) fun x => f) = ofArrows (fun x => w✝) fun x => f_1) ∧ EffectiveEpi f_1
this : regular (ofArrows (fun x => Y) fun x => f)
h_colim : IsColimit (cocone (Sieve.generate (ofArrows (fun x => Y) fun x => f)).arrows)
x : FamilyOfElements (yoneda.obj W) (ofArrows (fun x => Y) fun x => f)
hx : FamilyOfElements.Compatible x
x_ext : FamilyOfElements (yoneda.obj W) (Sieve.generate (ofArrows (fun x => Y) fun x => f)).arrows :=
FamilyOfElements.sieveExtend x
hx_ext : FamilyOfElements.Compatible (FamilyOfElements.sieveExtend x)
S : Sieve X :=
Sieve.generate
(ofArrows (fun x => Y) fun x =>
match x with
| PUnit.unit => f)
⊢ ∃! t, FamilyOfElements.IsAmalgamation x t | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; cases h; infer_instance⟩ _ h
lemma isSheaf_of_projective (F : Cᵒᵖ ⥤ Type (max u v)) [Preregular C] [∀ (X : C), Projective X] :
IsSheaf (regularCoverage C).toGrothendieck F :=
(isSheaf_coverage _ _).mpr fun S ⟨_, h⟩ ↦ have : S.regular := ⟨_, h⟩
isSheafFor_regular_of_projective _ _
/-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim
intro x hx
let x_ext := Presieve.FamilyOfElements.sieveExtend x
have hx_ext := Presieve.FamilyOfElements.Compatible.sieveExtend hx
let S := Sieve.generate (Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))
| obtain ⟨t, t_amalg, t_uniq⟩ :=
(Sieve.forallYonedaIsSheaf_iff_colimit S).mpr ⟨h_colim⟩ W x_ext hx_ext | /-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim
intro x hx
let x_ext := Presieve.FamilyOfElements.sieveExtend x
have hx_ext := Presieve.FamilyOfElements.Compatible.sieveExtend hx
let S := Sieve.generate (Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))
| Mathlib.CategoryTheory.Sites.RegularExtensive.297_0.rkSRr0zuqme90Yu | /-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) | Mathlib_CategoryTheory_Sites_RegularExtensive |
case intro.intro.intro.intro.intro
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : Preregular C
W X w✝ Y : C
f : Y ⟶ X
hf : EffectiveEpi f
hS : ∃ f_1, ((ofArrows (fun x => Y) fun x => f) = ofArrows (fun x => w✝) fun x => f_1) ∧ EffectiveEpi f_1
this : regular (ofArrows (fun x => Y) fun x => f)
h_colim : IsColimit (cocone (Sieve.generate (ofArrows (fun x => Y) fun x => f)).arrows)
x : FamilyOfElements (yoneda.obj W) (ofArrows (fun x => Y) fun x => f)
hx : FamilyOfElements.Compatible x
x_ext : FamilyOfElements (yoneda.obj W) (Sieve.generate (ofArrows (fun x => Y) fun x => f)).arrows :=
FamilyOfElements.sieveExtend x
hx_ext : FamilyOfElements.Compatible (FamilyOfElements.sieveExtend x)
S : Sieve X :=
Sieve.generate
(ofArrows (fun x => Y) fun x =>
match x with
| PUnit.unit => f)
t : (yoneda.obj W).obj (op X)
t_amalg : FamilyOfElements.IsAmalgamation x_ext t
t_uniq : ∀ (y : (yoneda.obj W).obj (op X)), (fun t => FamilyOfElements.IsAmalgamation x_ext t) y → y = t
⊢ ∃! t, FamilyOfElements.IsAmalgamation x t | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; cases h; infer_instance⟩ _ h
lemma isSheaf_of_projective (F : Cᵒᵖ ⥤ Type (max u v)) [Preregular C] [∀ (X : C), Projective X] :
IsSheaf (regularCoverage C).toGrothendieck F :=
(isSheaf_coverage _ _).mpr fun S ⟨_, h⟩ ↦ have : S.regular := ⟨_, h⟩
isSheafFor_regular_of_projective _ _
/-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim
intro x hx
let x_ext := Presieve.FamilyOfElements.sieveExtend x
have hx_ext := Presieve.FamilyOfElements.Compatible.sieveExtend hx
let S := Sieve.generate (Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))
obtain ⟨t, t_amalg, t_uniq⟩ :=
(Sieve.forallYonedaIsSheaf_iff_colimit S).mpr ⟨h_colim⟩ W x_ext hx_ext
| refine ⟨t, ?_, ?_⟩ | /-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim
intro x hx
let x_ext := Presieve.FamilyOfElements.sieveExtend x
have hx_ext := Presieve.FamilyOfElements.Compatible.sieveExtend hx
let S := Sieve.generate (Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))
obtain ⟨t, t_amalg, t_uniq⟩ :=
(Sieve.forallYonedaIsSheaf_iff_colimit S).mpr ⟨h_colim⟩ W x_ext hx_ext
| Mathlib.CategoryTheory.Sites.RegularExtensive.297_0.rkSRr0zuqme90Yu | /-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) | Mathlib_CategoryTheory_Sites_RegularExtensive |
case intro.intro.intro.intro.intro.refine_1
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : Preregular C
W X w✝ Y : C
f : Y ⟶ X
hf : EffectiveEpi f
hS : ∃ f_1, ((ofArrows (fun x => Y) fun x => f) = ofArrows (fun x => w✝) fun x => f_1) ∧ EffectiveEpi f_1
this : regular (ofArrows (fun x => Y) fun x => f)
h_colim : IsColimit (cocone (Sieve.generate (ofArrows (fun x => Y) fun x => f)).arrows)
x : FamilyOfElements (yoneda.obj W) (ofArrows (fun x => Y) fun x => f)
hx : FamilyOfElements.Compatible x
x_ext : FamilyOfElements (yoneda.obj W) (Sieve.generate (ofArrows (fun x => Y) fun x => f)).arrows :=
FamilyOfElements.sieveExtend x
hx_ext : FamilyOfElements.Compatible (FamilyOfElements.sieveExtend x)
S : Sieve X :=
Sieve.generate
(ofArrows (fun x => Y) fun x =>
match x with
| PUnit.unit => f)
t : (yoneda.obj W).obj (op X)
t_amalg : FamilyOfElements.IsAmalgamation x_ext t
t_uniq : ∀ (y : (yoneda.obj W).obj (op X)), (fun t => FamilyOfElements.IsAmalgamation x_ext t) y → y = t
⊢ (fun t => FamilyOfElements.IsAmalgamation x t) t | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; cases h; infer_instance⟩ _ h
lemma isSheaf_of_projective (F : Cᵒᵖ ⥤ Type (max u v)) [Preregular C] [∀ (X : C), Projective X] :
IsSheaf (regularCoverage C).toGrothendieck F :=
(isSheaf_coverage _ _).mpr fun S ⟨_, h⟩ ↦ have : S.regular := ⟨_, h⟩
isSheafFor_regular_of_projective _ _
/-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim
intro x hx
let x_ext := Presieve.FamilyOfElements.sieveExtend x
have hx_ext := Presieve.FamilyOfElements.Compatible.sieveExtend hx
let S := Sieve.generate (Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))
obtain ⟨t, t_amalg, t_uniq⟩ :=
(Sieve.forallYonedaIsSheaf_iff_colimit S).mpr ⟨h_colim⟩ W x_ext hx_ext
refine ⟨t, ?_, ?_⟩
· | convert Presieve.isAmalgamation_restrict (Sieve.le_generate
(Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))) _ _ t_amalg | /-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim
intro x hx
let x_ext := Presieve.FamilyOfElements.sieveExtend x
have hx_ext := Presieve.FamilyOfElements.Compatible.sieveExtend hx
let S := Sieve.generate (Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))
obtain ⟨t, t_amalg, t_uniq⟩ :=
(Sieve.forallYonedaIsSheaf_iff_colimit S).mpr ⟨h_colim⟩ W x_ext hx_ext
refine ⟨t, ?_, ?_⟩
· | Mathlib.CategoryTheory.Sites.RegularExtensive.297_0.rkSRr0zuqme90Yu | /-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) | Mathlib_CategoryTheory_Sites_RegularExtensive |
case h.e.h.e'_6.h.h.h
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : Preregular C
W X w✝ Y : C
f : Y ⟶ X
hf : EffectiveEpi f
hS : ∃ f_1, ((ofArrows (fun x => Y) fun x => f) = ofArrows (fun x => w✝) fun x => f_1) ∧ EffectiveEpi f_1
this : regular (ofArrows (fun x => Y) fun x => f)
h_colim : IsColimit (cocone (Sieve.generate (ofArrows (fun x => Y) fun x => f)).arrows)
x : FamilyOfElements (yoneda.obj W) (ofArrows (fun x => Y) fun x => f)
hx : FamilyOfElements.Compatible x
x_ext : FamilyOfElements (yoneda.obj W) (Sieve.generate (ofArrows (fun x => Y) fun x => f)).arrows :=
FamilyOfElements.sieveExtend x
hx_ext : FamilyOfElements.Compatible (FamilyOfElements.sieveExtend x)
S : Sieve X :=
Sieve.generate
(ofArrows (fun x => Y) fun x =>
match x with
| PUnit.unit => f)
t : (yoneda.obj W).obj (op X)
t_amalg : FamilyOfElements.IsAmalgamation x_ext t
t_uniq : ∀ (y : (yoneda.obj W).obj (op X)), (fun t => FamilyOfElements.IsAmalgamation x_ext t) y → y = t
⊢ x =
FamilyOfElements.restrict
(_ :
(ofArrows (fun x => Y) fun x =>
match x with
| PUnit.unit => f) ≤
(Sieve.generate
(ofArrows (fun x => Y) fun x =>
match x with
| PUnit.unit => f)).arrows)
x_ext | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; cases h; infer_instance⟩ _ h
lemma isSheaf_of_projective (F : Cᵒᵖ ⥤ Type (max u v)) [Preregular C] [∀ (X : C), Projective X] :
IsSheaf (regularCoverage C).toGrothendieck F :=
(isSheaf_coverage _ _).mpr fun S ⟨_, h⟩ ↦ have : S.regular := ⟨_, h⟩
isSheafFor_regular_of_projective _ _
/-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim
intro x hx
let x_ext := Presieve.FamilyOfElements.sieveExtend x
have hx_ext := Presieve.FamilyOfElements.Compatible.sieveExtend hx
let S := Sieve.generate (Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))
obtain ⟨t, t_amalg, t_uniq⟩ :=
(Sieve.forallYonedaIsSheaf_iff_colimit S).mpr ⟨h_colim⟩ W x_ext hx_ext
refine ⟨t, ?_, ?_⟩
· convert Presieve.isAmalgamation_restrict (Sieve.le_generate
(Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))) _ _ t_amalg
| exact (Presieve.restrict_extend hx).symm | /-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim
intro x hx
let x_ext := Presieve.FamilyOfElements.sieveExtend x
have hx_ext := Presieve.FamilyOfElements.Compatible.sieveExtend hx
let S := Sieve.generate (Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))
obtain ⟨t, t_amalg, t_uniq⟩ :=
(Sieve.forallYonedaIsSheaf_iff_colimit S).mpr ⟨h_colim⟩ W x_ext hx_ext
refine ⟨t, ?_, ?_⟩
· convert Presieve.isAmalgamation_restrict (Sieve.le_generate
(Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))) _ _ t_amalg
| Mathlib.CategoryTheory.Sites.RegularExtensive.297_0.rkSRr0zuqme90Yu | /-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) | Mathlib_CategoryTheory_Sites_RegularExtensive |
case intro.intro.intro.intro.intro.refine_2
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : Preregular C
W X w✝ Y : C
f : Y ⟶ X
hf : EffectiveEpi f
hS : ∃ f_1, ((ofArrows (fun x => Y) fun x => f) = ofArrows (fun x => w✝) fun x => f_1) ∧ EffectiveEpi f_1
this : regular (ofArrows (fun x => Y) fun x => f)
h_colim : IsColimit (cocone (Sieve.generate (ofArrows (fun x => Y) fun x => f)).arrows)
x : FamilyOfElements (yoneda.obj W) (ofArrows (fun x => Y) fun x => f)
hx : FamilyOfElements.Compatible x
x_ext : FamilyOfElements (yoneda.obj W) (Sieve.generate (ofArrows (fun x => Y) fun x => f)).arrows :=
FamilyOfElements.sieveExtend x
hx_ext : FamilyOfElements.Compatible (FamilyOfElements.sieveExtend x)
S : Sieve X :=
Sieve.generate
(ofArrows (fun x => Y) fun x =>
match x with
| PUnit.unit => f)
t : (yoneda.obj W).obj (op X)
t_amalg : FamilyOfElements.IsAmalgamation x_ext t
t_uniq : ∀ (y : (yoneda.obj W).obj (op X)), (fun t => FamilyOfElements.IsAmalgamation x_ext t) y → y = t
⊢ ∀ (y : (yoneda.obj W).obj (op X)), (fun t => FamilyOfElements.IsAmalgamation x t) y → y = t | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; cases h; infer_instance⟩ _ h
lemma isSheaf_of_projective (F : Cᵒᵖ ⥤ Type (max u v)) [Preregular C] [∀ (X : C), Projective X] :
IsSheaf (regularCoverage C).toGrothendieck F :=
(isSheaf_coverage _ _).mpr fun S ⟨_, h⟩ ↦ have : S.regular := ⟨_, h⟩
isSheafFor_regular_of_projective _ _
/-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim
intro x hx
let x_ext := Presieve.FamilyOfElements.sieveExtend x
have hx_ext := Presieve.FamilyOfElements.Compatible.sieveExtend hx
let S := Sieve.generate (Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))
obtain ⟨t, t_amalg, t_uniq⟩ :=
(Sieve.forallYonedaIsSheaf_iff_colimit S).mpr ⟨h_colim⟩ W x_ext hx_ext
refine ⟨t, ?_, ?_⟩
· convert Presieve.isAmalgamation_restrict (Sieve.le_generate
(Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))) _ _ t_amalg
exact (Presieve.restrict_extend hx).symm
· | exact fun y hy ↦ t_uniq y <| Presieve.isAmalgamation_sieveExtend x y hy | /-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim
intro x hx
let x_ext := Presieve.FamilyOfElements.sieveExtend x
have hx_ext := Presieve.FamilyOfElements.Compatible.sieveExtend hx
let S := Sieve.generate (Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))
obtain ⟨t, t_amalg, t_uniq⟩ :=
(Sieve.forallYonedaIsSheaf_iff_colimit S).mpr ⟨h_colim⟩ W x_ext hx_ext
refine ⟨t, ?_, ?_⟩
· convert Presieve.isAmalgamation_restrict (Sieve.le_generate
(Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))) _ _ t_amalg
exact (Presieve.restrict_extend hx).symm
· | Mathlib.CategoryTheory.Sites.RegularExtensive.297_0.rkSRr0zuqme90Yu | /-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) | Mathlib_CategoryTheory_Sites_RegularExtensive |
C : Type u
inst✝² : Category.{v, u} C
inst✝¹ : FinitaryPreExtensive C
X : C
S : Presieve X
inst✝ : Presieve.extensive S
⊢ ∀ {Y Z : C} {f : Y ⟶ X}, S f → ∀ {g : Z ⟶ X}, S g → HasPullback f g | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; cases h; infer_instance⟩ _ h
lemma isSheaf_of_projective (F : Cᵒᵖ ⥤ Type (max u v)) [Preregular C] [∀ (X : C), Projective X] :
IsSheaf (regularCoverage C).toGrothendieck F :=
(isSheaf_coverage _ _).mpr fun S ⟨_, h⟩ ↦ have : S.regular := ⟨_, h⟩
isSheafFor_regular_of_projective _ _
/-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim
intro x hx
let x_ext := Presieve.FamilyOfElements.sieveExtend x
have hx_ext := Presieve.FamilyOfElements.Compatible.sieveExtend hx
let S := Sieve.generate (Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))
obtain ⟨t, t_amalg, t_uniq⟩ :=
(Sieve.forallYonedaIsSheaf_iff_colimit S).mpr ⟨h_colim⟩ W x_ext hx_ext
refine ⟨t, ?_, ?_⟩
· convert Presieve.isAmalgamation_restrict (Sieve.le_generate
(Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))) _ _ t_amalg
exact (Presieve.restrict_extend hx).symm
· exact fun y hy ↦ t_uniq y <| Presieve.isAmalgamation_sieveExtend x y hy
/-- The regular topology on any preregular category is subcanonical. -/
theorem subcanonical [Preregular C] : Sheaf.Subcanonical (regularCoverage C).toGrothendieck :=
Sheaf.Subcanonical.of_yoneda_isSheaf _ isSheaf_yoneda_obj
end regularCoverage
end RegularSheaves
section ExtensiveSheaves
variable [FinitaryPreExtensive C] {C}
/-- A presieve is *extensive* if it is finite and its arrows induce an isomorphism from the
coproduct to the target. -/
class Presieve.extensive {X : C} (R : Presieve X) :
Prop where
/-- `R` consists of a finite collection of arrows that together induce an isomorphism from the
coproduct of their sources. -/
arrows_nonempty_isColimit : ∃ (α : Type) (_ : Fintype α) (Z : α → C) (π : (a : α) → (Z a ⟶ X)),
R = Presieve.ofArrows Z π ∧ Nonempty (IsColimit (Cofan.mk X π))
instance {X : C} (S : Presieve X) [S.extensive] : S.hasPullbacks where
has_pullbacks := by
| obtain ⟨_, _, _, _, rfl, ⟨hc⟩⟩ := Presieve.extensive.arrows_nonempty_isColimit (R := S) | instance {X : C} (S : Presieve X) [S.extensive] : S.hasPullbacks where
has_pullbacks := by
| Mathlib.CategoryTheory.Sites.RegularExtensive.339_0.rkSRr0zuqme90Yu | instance {X : C} (S : Presieve X) [S.extensive] : S.hasPullbacks where
has_pullbacks | Mathlib_CategoryTheory_Sites_RegularExtensive |
case intro.intro.intro.intro.intro.intro
C : Type u
inst✝² : Category.{v, u} C
inst✝¹ : FinitaryPreExtensive C
X : C
w✝³ : Type
w✝² : Fintype w✝³
w✝¹ : w✝³ → C
w✝ : (a : w✝³) → w✝¹ a ⟶ X
inst✝ : Presieve.extensive (Presieve.ofArrows w✝¹ w✝)
hc : IsColimit (Cofan.mk X w✝)
⊢ ∀ {Y Z : C} {f : Y ⟶ X}, Presieve.ofArrows w✝¹ w✝ f → ∀ {g : Z ⟶ X}, Presieve.ofArrows w✝¹ w✝ g → HasPullback f g | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; cases h; infer_instance⟩ _ h
lemma isSheaf_of_projective (F : Cᵒᵖ ⥤ Type (max u v)) [Preregular C] [∀ (X : C), Projective X] :
IsSheaf (regularCoverage C).toGrothendieck F :=
(isSheaf_coverage _ _).mpr fun S ⟨_, h⟩ ↦ have : S.regular := ⟨_, h⟩
isSheafFor_regular_of_projective _ _
/-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim
intro x hx
let x_ext := Presieve.FamilyOfElements.sieveExtend x
have hx_ext := Presieve.FamilyOfElements.Compatible.sieveExtend hx
let S := Sieve.generate (Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))
obtain ⟨t, t_amalg, t_uniq⟩ :=
(Sieve.forallYonedaIsSheaf_iff_colimit S).mpr ⟨h_colim⟩ W x_ext hx_ext
refine ⟨t, ?_, ?_⟩
· convert Presieve.isAmalgamation_restrict (Sieve.le_generate
(Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))) _ _ t_amalg
exact (Presieve.restrict_extend hx).symm
· exact fun y hy ↦ t_uniq y <| Presieve.isAmalgamation_sieveExtend x y hy
/-- The regular topology on any preregular category is subcanonical. -/
theorem subcanonical [Preregular C] : Sheaf.Subcanonical (regularCoverage C).toGrothendieck :=
Sheaf.Subcanonical.of_yoneda_isSheaf _ isSheaf_yoneda_obj
end regularCoverage
end RegularSheaves
section ExtensiveSheaves
variable [FinitaryPreExtensive C] {C}
/-- A presieve is *extensive* if it is finite and its arrows induce an isomorphism from the
coproduct to the target. -/
class Presieve.extensive {X : C} (R : Presieve X) :
Prop where
/-- `R` consists of a finite collection of arrows that together induce an isomorphism from the
coproduct of their sources. -/
arrows_nonempty_isColimit : ∃ (α : Type) (_ : Fintype α) (Z : α → C) (π : (a : α) → (Z a ⟶ X)),
R = Presieve.ofArrows Z π ∧ Nonempty (IsColimit (Cofan.mk X π))
instance {X : C} (S : Presieve X) [S.extensive] : S.hasPullbacks where
has_pullbacks := by
obtain ⟨_, _, _, _, rfl, ⟨hc⟩⟩ := Presieve.extensive.arrows_nonempty_isColimit (R := S)
| intro _ _ _ _ _ hg | instance {X : C} (S : Presieve X) [S.extensive] : S.hasPullbacks where
has_pullbacks := by
obtain ⟨_, _, _, _, rfl, ⟨hc⟩⟩ := Presieve.extensive.arrows_nonempty_isColimit (R := S)
| Mathlib.CategoryTheory.Sites.RegularExtensive.339_0.rkSRr0zuqme90Yu | instance {X : C} (S : Presieve X) [S.extensive] : S.hasPullbacks where
has_pullbacks | Mathlib_CategoryTheory_Sites_RegularExtensive |
case intro.intro.intro.intro.intro.intro
C : Type u
inst✝² : Category.{v, u} C
inst✝¹ : FinitaryPreExtensive C
X : C
w✝³ : Type
w✝² : Fintype w✝³
w✝¹ : w✝³ → C
w✝ : (a : w✝³) → w✝¹ a ⟶ X
inst✝ : Presieve.extensive (Presieve.ofArrows w✝¹ w✝)
hc : IsColimit (Cofan.mk X w✝)
Y✝ Z✝ : C
f✝ : Y✝ ⟶ X
x✝ : Presieve.ofArrows w✝¹ w✝ f✝
g✝ : Z✝ ⟶ X
hg : Presieve.ofArrows w✝¹ w✝ g✝
⊢ HasPullback f✝ g✝ | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; cases h; infer_instance⟩ _ h
lemma isSheaf_of_projective (F : Cᵒᵖ ⥤ Type (max u v)) [Preregular C] [∀ (X : C), Projective X] :
IsSheaf (regularCoverage C).toGrothendieck F :=
(isSheaf_coverage _ _).mpr fun S ⟨_, h⟩ ↦ have : S.regular := ⟨_, h⟩
isSheafFor_regular_of_projective _ _
/-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim
intro x hx
let x_ext := Presieve.FamilyOfElements.sieveExtend x
have hx_ext := Presieve.FamilyOfElements.Compatible.sieveExtend hx
let S := Sieve.generate (Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))
obtain ⟨t, t_amalg, t_uniq⟩ :=
(Sieve.forallYonedaIsSheaf_iff_colimit S).mpr ⟨h_colim⟩ W x_ext hx_ext
refine ⟨t, ?_, ?_⟩
· convert Presieve.isAmalgamation_restrict (Sieve.le_generate
(Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))) _ _ t_amalg
exact (Presieve.restrict_extend hx).symm
· exact fun y hy ↦ t_uniq y <| Presieve.isAmalgamation_sieveExtend x y hy
/-- The regular topology on any preregular category is subcanonical. -/
theorem subcanonical [Preregular C] : Sheaf.Subcanonical (regularCoverage C).toGrothendieck :=
Sheaf.Subcanonical.of_yoneda_isSheaf _ isSheaf_yoneda_obj
end regularCoverage
end RegularSheaves
section ExtensiveSheaves
variable [FinitaryPreExtensive C] {C}
/-- A presieve is *extensive* if it is finite and its arrows induce an isomorphism from the
coproduct to the target. -/
class Presieve.extensive {X : C} (R : Presieve X) :
Prop where
/-- `R` consists of a finite collection of arrows that together induce an isomorphism from the
coproduct of their sources. -/
arrows_nonempty_isColimit : ∃ (α : Type) (_ : Fintype α) (Z : α → C) (π : (a : α) → (Z a ⟶ X)),
R = Presieve.ofArrows Z π ∧ Nonempty (IsColimit (Cofan.mk X π))
instance {X : C} (S : Presieve X) [S.extensive] : S.hasPullbacks where
has_pullbacks := by
obtain ⟨_, _, _, _, rfl, ⟨hc⟩⟩ := Presieve.extensive.arrows_nonempty_isColimit (R := S)
intro _ _ _ _ _ hg
| cases hg | instance {X : C} (S : Presieve X) [S.extensive] : S.hasPullbacks where
has_pullbacks := by
obtain ⟨_, _, _, _, rfl, ⟨hc⟩⟩ := Presieve.extensive.arrows_nonempty_isColimit (R := S)
intro _ _ _ _ _ hg
| Mathlib.CategoryTheory.Sites.RegularExtensive.339_0.rkSRr0zuqme90Yu | instance {X : C} (S : Presieve X) [S.extensive] : S.hasPullbacks where
has_pullbacks | Mathlib_CategoryTheory_Sites_RegularExtensive |
case intro.intro.intro.intro.intro.intro.mk
C : Type u
inst✝² : Category.{v, u} C
inst✝¹ : FinitaryPreExtensive C
X : C
w✝³ : Type
w✝² : Fintype w✝³
w✝¹ : w✝³ → C
w✝ : (a : w✝³) → w✝¹ a ⟶ X
inst✝ : Presieve.extensive (Presieve.ofArrows w✝¹ w✝)
hc : IsColimit (Cofan.mk X w✝)
Y✝ : C
f✝ : Y✝ ⟶ X
x✝ : Presieve.ofArrows w✝¹ w✝ f✝
i✝ : w✝³
⊢ HasPullback f✝ (w✝ i✝) | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; cases h; infer_instance⟩ _ h
lemma isSheaf_of_projective (F : Cᵒᵖ ⥤ Type (max u v)) [Preregular C] [∀ (X : C), Projective X] :
IsSheaf (regularCoverage C).toGrothendieck F :=
(isSheaf_coverage _ _).mpr fun S ⟨_, h⟩ ↦ have : S.regular := ⟨_, h⟩
isSheafFor_regular_of_projective _ _
/-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim
intro x hx
let x_ext := Presieve.FamilyOfElements.sieveExtend x
have hx_ext := Presieve.FamilyOfElements.Compatible.sieveExtend hx
let S := Sieve.generate (Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))
obtain ⟨t, t_amalg, t_uniq⟩ :=
(Sieve.forallYonedaIsSheaf_iff_colimit S).mpr ⟨h_colim⟩ W x_ext hx_ext
refine ⟨t, ?_, ?_⟩
· convert Presieve.isAmalgamation_restrict (Sieve.le_generate
(Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))) _ _ t_amalg
exact (Presieve.restrict_extend hx).symm
· exact fun y hy ↦ t_uniq y <| Presieve.isAmalgamation_sieveExtend x y hy
/-- The regular topology on any preregular category is subcanonical. -/
theorem subcanonical [Preregular C] : Sheaf.Subcanonical (regularCoverage C).toGrothendieck :=
Sheaf.Subcanonical.of_yoneda_isSheaf _ isSheaf_yoneda_obj
end regularCoverage
end RegularSheaves
section ExtensiveSheaves
variable [FinitaryPreExtensive C] {C}
/-- A presieve is *extensive* if it is finite and its arrows induce an isomorphism from the
coproduct to the target. -/
class Presieve.extensive {X : C} (R : Presieve X) :
Prop where
/-- `R` consists of a finite collection of arrows that together induce an isomorphism from the
coproduct of their sources. -/
arrows_nonempty_isColimit : ∃ (α : Type) (_ : Fintype α) (Z : α → C) (π : (a : α) → (Z a ⟶ X)),
R = Presieve.ofArrows Z π ∧ Nonempty (IsColimit (Cofan.mk X π))
instance {X : C} (S : Presieve X) [S.extensive] : S.hasPullbacks where
has_pullbacks := by
obtain ⟨_, _, _, _, rfl, ⟨hc⟩⟩ := Presieve.extensive.arrows_nonempty_isColimit (R := S)
intro _ _ _ _ _ hg
cases hg
| apply FinitaryPreExtensive.hasPullbacks_of_is_coproduct hc | instance {X : C} (S : Presieve X) [S.extensive] : S.hasPullbacks where
has_pullbacks := by
obtain ⟨_, _, _, _, rfl, ⟨hc⟩⟩ := Presieve.extensive.arrows_nonempty_isColimit (R := S)
intro _ _ _ _ _ hg
cases hg
| Mathlib.CategoryTheory.Sites.RegularExtensive.339_0.rkSRr0zuqme90Yu | instance {X : C} (S : Presieve X) [S.extensive] : S.hasPullbacks where
has_pullbacks | Mathlib_CategoryTheory_Sites_RegularExtensive |
C : Type u
inst✝³ : Category.{v, u} C
inst✝² : FinitaryPreExtensive C
X : C
S : Presieve X
inst✝¹ : extensive S
F : Cᵒᵖ ⥤ Type (max u v)
inst✝ : PreservesFiniteProducts F
⊢ IsSheafFor F S | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; cases h; infer_instance⟩ _ h
lemma isSheaf_of_projective (F : Cᵒᵖ ⥤ Type (max u v)) [Preregular C] [∀ (X : C), Projective X] :
IsSheaf (regularCoverage C).toGrothendieck F :=
(isSheaf_coverage _ _).mpr fun S ⟨_, h⟩ ↦ have : S.regular := ⟨_, h⟩
isSheafFor_regular_of_projective _ _
/-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim
intro x hx
let x_ext := Presieve.FamilyOfElements.sieveExtend x
have hx_ext := Presieve.FamilyOfElements.Compatible.sieveExtend hx
let S := Sieve.generate (Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))
obtain ⟨t, t_amalg, t_uniq⟩ :=
(Sieve.forallYonedaIsSheaf_iff_colimit S).mpr ⟨h_colim⟩ W x_ext hx_ext
refine ⟨t, ?_, ?_⟩
· convert Presieve.isAmalgamation_restrict (Sieve.le_generate
(Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))) _ _ t_amalg
exact (Presieve.restrict_extend hx).symm
· exact fun y hy ↦ t_uniq y <| Presieve.isAmalgamation_sieveExtend x y hy
/-- The regular topology on any preregular category is subcanonical. -/
theorem subcanonical [Preregular C] : Sheaf.Subcanonical (regularCoverage C).toGrothendieck :=
Sheaf.Subcanonical.of_yoneda_isSheaf _ isSheaf_yoneda_obj
end regularCoverage
end RegularSheaves
section ExtensiveSheaves
variable [FinitaryPreExtensive C] {C}
/-- A presieve is *extensive* if it is finite and its arrows induce an isomorphism from the
coproduct to the target. -/
class Presieve.extensive {X : C} (R : Presieve X) :
Prop where
/-- `R` consists of a finite collection of arrows that together induce an isomorphism from the
coproduct of their sources. -/
arrows_nonempty_isColimit : ∃ (α : Type) (_ : Fintype α) (Z : α → C) (π : (a : α) → (Z a ⟶ X)),
R = Presieve.ofArrows Z π ∧ Nonempty (IsColimit (Cofan.mk X π))
instance {X : C} (S : Presieve X) [S.extensive] : S.hasPullbacks where
has_pullbacks := by
obtain ⟨_, _, _, _, rfl, ⟨hc⟩⟩ := Presieve.extensive.arrows_nonempty_isColimit (R := S)
intro _ _ _ _ _ hg
cases hg
apply FinitaryPreExtensive.hasPullbacks_of_is_coproduct hc
instance {α : Type} [Fintype α] {Z : α → C} {F : C ⥤ Type w}
[PreservesFiniteProducts F] : PreservesLimit (Discrete.functor fun a => (Z a)) F :=
(PreservesFiniteProducts.preserves α).preservesLimit
open Presieve Opposite
/--
A finite product preserving presheaf is a sheaf for the extensive topology on a category which is
`FinitaryPreExtensive`.
-/
theorem isSheafFor_extensive_of_preservesFiniteProducts {X : C} (S : Presieve X) [S.extensive]
(F : Cᵒᵖ ⥤ Type max u v) [PreservesFiniteProducts F] : S.IsSheafFor F := by
| obtain ⟨_, _, Z, π, rfl, ⟨hc⟩⟩ := extensive.arrows_nonempty_isColimit (R := S) | /--
A finite product preserving presheaf is a sheaf for the extensive topology on a category which is
`FinitaryPreExtensive`.
-/
theorem isSheafFor_extensive_of_preservesFiniteProducts {X : C} (S : Presieve X) [S.extensive]
(F : Cᵒᵖ ⥤ Type max u v) [PreservesFiniteProducts F] : S.IsSheafFor F := by
| Mathlib.CategoryTheory.Sites.RegularExtensive.352_0.rkSRr0zuqme90Yu | /--
A finite product preserving presheaf is a sheaf for the extensive topology on a category which is
`FinitaryPreExtensive`.
-/
theorem isSheafFor_extensive_of_preservesFiniteProducts {X : C} (S : Presieve X) [S.extensive]
(F : Cᵒᵖ ⥤ Type max u v) [PreservesFiniteProducts F] : S.IsSheafFor F | Mathlib_CategoryTheory_Sites_RegularExtensive |
case intro.intro.intro.intro.intro.intro
C : Type u
inst✝³ : Category.{v, u} C
inst✝² : FinitaryPreExtensive C
X : C
F : Cᵒᵖ ⥤ Type (max u v)
inst✝¹ : PreservesFiniteProducts F
w✝¹ : Type
w✝ : Fintype w✝¹
Z : w✝¹ → C
π : (a : w✝¹) → Z a ⟶ X
inst✝ : extensive (ofArrows Z π)
hc : IsColimit (Cofan.mk X π)
⊢ IsSheafFor F (ofArrows Z π) | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; cases h; infer_instance⟩ _ h
lemma isSheaf_of_projective (F : Cᵒᵖ ⥤ Type (max u v)) [Preregular C] [∀ (X : C), Projective X] :
IsSheaf (regularCoverage C).toGrothendieck F :=
(isSheaf_coverage _ _).mpr fun S ⟨_, h⟩ ↦ have : S.regular := ⟨_, h⟩
isSheafFor_regular_of_projective _ _
/-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim
intro x hx
let x_ext := Presieve.FamilyOfElements.sieveExtend x
have hx_ext := Presieve.FamilyOfElements.Compatible.sieveExtend hx
let S := Sieve.generate (Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))
obtain ⟨t, t_amalg, t_uniq⟩ :=
(Sieve.forallYonedaIsSheaf_iff_colimit S).mpr ⟨h_colim⟩ W x_ext hx_ext
refine ⟨t, ?_, ?_⟩
· convert Presieve.isAmalgamation_restrict (Sieve.le_generate
(Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))) _ _ t_amalg
exact (Presieve.restrict_extend hx).symm
· exact fun y hy ↦ t_uniq y <| Presieve.isAmalgamation_sieveExtend x y hy
/-- The regular topology on any preregular category is subcanonical. -/
theorem subcanonical [Preregular C] : Sheaf.Subcanonical (regularCoverage C).toGrothendieck :=
Sheaf.Subcanonical.of_yoneda_isSheaf _ isSheaf_yoneda_obj
end regularCoverage
end RegularSheaves
section ExtensiveSheaves
variable [FinitaryPreExtensive C] {C}
/-- A presieve is *extensive* if it is finite and its arrows induce an isomorphism from the
coproduct to the target. -/
class Presieve.extensive {X : C} (R : Presieve X) :
Prop where
/-- `R` consists of a finite collection of arrows that together induce an isomorphism from the
coproduct of their sources. -/
arrows_nonempty_isColimit : ∃ (α : Type) (_ : Fintype α) (Z : α → C) (π : (a : α) → (Z a ⟶ X)),
R = Presieve.ofArrows Z π ∧ Nonempty (IsColimit (Cofan.mk X π))
instance {X : C} (S : Presieve X) [S.extensive] : S.hasPullbacks where
has_pullbacks := by
obtain ⟨_, _, _, _, rfl, ⟨hc⟩⟩ := Presieve.extensive.arrows_nonempty_isColimit (R := S)
intro _ _ _ _ _ hg
cases hg
apply FinitaryPreExtensive.hasPullbacks_of_is_coproduct hc
instance {α : Type} [Fintype α] {Z : α → C} {F : C ⥤ Type w}
[PreservesFiniteProducts F] : PreservesLimit (Discrete.functor fun a => (Z a)) F :=
(PreservesFiniteProducts.preserves α).preservesLimit
open Presieve Opposite
/--
A finite product preserving presheaf is a sheaf for the extensive topology on a category which is
`FinitaryPreExtensive`.
-/
theorem isSheafFor_extensive_of_preservesFiniteProducts {X : C} (S : Presieve X) [S.extensive]
(F : Cᵒᵖ ⥤ Type max u v) [PreservesFiniteProducts F] : S.IsSheafFor F := by
obtain ⟨_, _, Z, π, rfl, ⟨hc⟩⟩ := extensive.arrows_nonempty_isColimit (R := S)
| have : (ofArrows Z (Cofan.mk X π).inj).hasPullbacks :=
(inferInstance : (ofArrows Z π).hasPullbacks) | /--
A finite product preserving presheaf is a sheaf for the extensive topology on a category which is
`FinitaryPreExtensive`.
-/
theorem isSheafFor_extensive_of_preservesFiniteProducts {X : C} (S : Presieve X) [S.extensive]
(F : Cᵒᵖ ⥤ Type max u v) [PreservesFiniteProducts F] : S.IsSheafFor F := by
obtain ⟨_, _, Z, π, rfl, ⟨hc⟩⟩ := extensive.arrows_nonempty_isColimit (R := S)
| Mathlib.CategoryTheory.Sites.RegularExtensive.352_0.rkSRr0zuqme90Yu | /--
A finite product preserving presheaf is a sheaf for the extensive topology on a category which is
`FinitaryPreExtensive`.
-/
theorem isSheafFor_extensive_of_preservesFiniteProducts {X : C} (S : Presieve X) [S.extensive]
(F : Cᵒᵖ ⥤ Type max u v) [PreservesFiniteProducts F] : S.IsSheafFor F | Mathlib_CategoryTheory_Sites_RegularExtensive |
case intro.intro.intro.intro.intro.intro
C : Type u
inst✝³ : Category.{v, u} C
inst✝² : FinitaryPreExtensive C
X : C
F : Cᵒᵖ ⥤ Type (max u v)
inst✝¹ : PreservesFiniteProducts F
w✝¹ : Type
w✝ : Fintype w✝¹
Z : w✝¹ → C
π : (a : w✝¹) → Z a ⟶ X
inst✝ : extensive (ofArrows Z π)
hc : IsColimit (Cofan.mk X π)
this : hasPullbacks (ofArrows Z (Cofan.inj (Cofan.mk X π)))
⊢ IsSheafFor F (ofArrows Z π) | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; cases h; infer_instance⟩ _ h
lemma isSheaf_of_projective (F : Cᵒᵖ ⥤ Type (max u v)) [Preregular C] [∀ (X : C), Projective X] :
IsSheaf (regularCoverage C).toGrothendieck F :=
(isSheaf_coverage _ _).mpr fun S ⟨_, h⟩ ↦ have : S.regular := ⟨_, h⟩
isSheafFor_regular_of_projective _ _
/-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim
intro x hx
let x_ext := Presieve.FamilyOfElements.sieveExtend x
have hx_ext := Presieve.FamilyOfElements.Compatible.sieveExtend hx
let S := Sieve.generate (Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))
obtain ⟨t, t_amalg, t_uniq⟩ :=
(Sieve.forallYonedaIsSheaf_iff_colimit S).mpr ⟨h_colim⟩ W x_ext hx_ext
refine ⟨t, ?_, ?_⟩
· convert Presieve.isAmalgamation_restrict (Sieve.le_generate
(Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))) _ _ t_amalg
exact (Presieve.restrict_extend hx).symm
· exact fun y hy ↦ t_uniq y <| Presieve.isAmalgamation_sieveExtend x y hy
/-- The regular topology on any preregular category is subcanonical. -/
theorem subcanonical [Preregular C] : Sheaf.Subcanonical (regularCoverage C).toGrothendieck :=
Sheaf.Subcanonical.of_yoneda_isSheaf _ isSheaf_yoneda_obj
end regularCoverage
end RegularSheaves
section ExtensiveSheaves
variable [FinitaryPreExtensive C] {C}
/-- A presieve is *extensive* if it is finite and its arrows induce an isomorphism from the
coproduct to the target. -/
class Presieve.extensive {X : C} (R : Presieve X) :
Prop where
/-- `R` consists of a finite collection of arrows that together induce an isomorphism from the
coproduct of their sources. -/
arrows_nonempty_isColimit : ∃ (α : Type) (_ : Fintype α) (Z : α → C) (π : (a : α) → (Z a ⟶ X)),
R = Presieve.ofArrows Z π ∧ Nonempty (IsColimit (Cofan.mk X π))
instance {X : C} (S : Presieve X) [S.extensive] : S.hasPullbacks where
has_pullbacks := by
obtain ⟨_, _, _, _, rfl, ⟨hc⟩⟩ := Presieve.extensive.arrows_nonempty_isColimit (R := S)
intro _ _ _ _ _ hg
cases hg
apply FinitaryPreExtensive.hasPullbacks_of_is_coproduct hc
instance {α : Type} [Fintype α] {Z : α → C} {F : C ⥤ Type w}
[PreservesFiniteProducts F] : PreservesLimit (Discrete.functor fun a => (Z a)) F :=
(PreservesFiniteProducts.preserves α).preservesLimit
open Presieve Opposite
/--
A finite product preserving presheaf is a sheaf for the extensive topology on a category which is
`FinitaryPreExtensive`.
-/
theorem isSheafFor_extensive_of_preservesFiniteProducts {X : C} (S : Presieve X) [S.extensive]
(F : Cᵒᵖ ⥤ Type max u v) [PreservesFiniteProducts F] : S.IsSheafFor F := by
obtain ⟨_, _, Z, π, rfl, ⟨hc⟩⟩ := extensive.arrows_nonempty_isColimit (R := S)
have : (ofArrows Z (Cofan.mk X π).inj).hasPullbacks :=
(inferInstance : (ofArrows Z π).hasPullbacks)
| exact isSheafFor_of_preservesProduct _ _ hc | /--
A finite product preserving presheaf is a sheaf for the extensive topology on a category which is
`FinitaryPreExtensive`.
-/
theorem isSheafFor_extensive_of_preservesFiniteProducts {X : C} (S : Presieve X) [S.extensive]
(F : Cᵒᵖ ⥤ Type max u v) [PreservesFiniteProducts F] : S.IsSheafFor F := by
obtain ⟨_, _, Z, π, rfl, ⟨hc⟩⟩ := extensive.arrows_nonempty_isColimit (R := S)
have : (ofArrows Z (Cofan.mk X π).inj).hasPullbacks :=
(inferInstance : (ofArrows Z π).hasPullbacks)
| Mathlib.CategoryTheory.Sites.RegularExtensive.352_0.rkSRr0zuqme90Yu | /--
A finite product preserving presheaf is a sheaf for the extensive topology on a category which is
`FinitaryPreExtensive`.
-/
theorem isSheafFor_extensive_of_preservesFiniteProducts {X : C} (S : Presieve X) [S.extensive]
(F : Cᵒᵖ ⥤ Type max u v) [PreservesFiniteProducts F] : S.IsSheafFor F | Mathlib_CategoryTheory_Sites_RegularExtensive |
C : Type u
inst✝² : Category.{v, u} C
inst✝¹ : FinitaryPreExtensive C
inst✝ : FinitaryExtensive C
F : Cᵒᵖ ⥤ Type (max u v)
⊢ IsSheaf (Coverage.toGrothendieck C (extensiveCoverage C)) F ↔ Nonempty (PreservesFiniteProducts F) | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; cases h; infer_instance⟩ _ h
lemma isSheaf_of_projective (F : Cᵒᵖ ⥤ Type (max u v)) [Preregular C] [∀ (X : C), Projective X] :
IsSheaf (regularCoverage C).toGrothendieck F :=
(isSheaf_coverage _ _).mpr fun S ⟨_, h⟩ ↦ have : S.regular := ⟨_, h⟩
isSheafFor_regular_of_projective _ _
/-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim
intro x hx
let x_ext := Presieve.FamilyOfElements.sieveExtend x
have hx_ext := Presieve.FamilyOfElements.Compatible.sieveExtend hx
let S := Sieve.generate (Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))
obtain ⟨t, t_amalg, t_uniq⟩ :=
(Sieve.forallYonedaIsSheaf_iff_colimit S).mpr ⟨h_colim⟩ W x_ext hx_ext
refine ⟨t, ?_, ?_⟩
· convert Presieve.isAmalgamation_restrict (Sieve.le_generate
(Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))) _ _ t_amalg
exact (Presieve.restrict_extend hx).symm
· exact fun y hy ↦ t_uniq y <| Presieve.isAmalgamation_sieveExtend x y hy
/-- The regular topology on any preregular category is subcanonical. -/
theorem subcanonical [Preregular C] : Sheaf.Subcanonical (regularCoverage C).toGrothendieck :=
Sheaf.Subcanonical.of_yoneda_isSheaf _ isSheaf_yoneda_obj
end regularCoverage
end RegularSheaves
section ExtensiveSheaves
variable [FinitaryPreExtensive C] {C}
/-- A presieve is *extensive* if it is finite and its arrows induce an isomorphism from the
coproduct to the target. -/
class Presieve.extensive {X : C} (R : Presieve X) :
Prop where
/-- `R` consists of a finite collection of arrows that together induce an isomorphism from the
coproduct of their sources. -/
arrows_nonempty_isColimit : ∃ (α : Type) (_ : Fintype α) (Z : α → C) (π : (a : α) → (Z a ⟶ X)),
R = Presieve.ofArrows Z π ∧ Nonempty (IsColimit (Cofan.mk X π))
instance {X : C} (S : Presieve X) [S.extensive] : S.hasPullbacks where
has_pullbacks := by
obtain ⟨_, _, _, _, rfl, ⟨hc⟩⟩ := Presieve.extensive.arrows_nonempty_isColimit (R := S)
intro _ _ _ _ _ hg
cases hg
apply FinitaryPreExtensive.hasPullbacks_of_is_coproduct hc
instance {α : Type} [Fintype α] {Z : α → C} {F : C ⥤ Type w}
[PreservesFiniteProducts F] : PreservesLimit (Discrete.functor fun a => (Z a)) F :=
(PreservesFiniteProducts.preserves α).preservesLimit
open Presieve Opposite
/--
A finite product preserving presheaf is a sheaf for the extensive topology on a category which is
`FinitaryPreExtensive`.
-/
theorem isSheafFor_extensive_of_preservesFiniteProducts {X : C} (S : Presieve X) [S.extensive]
(F : Cᵒᵖ ⥤ Type max u v) [PreservesFiniteProducts F] : S.IsSheafFor F := by
obtain ⟨_, _, Z, π, rfl, ⟨hc⟩⟩ := extensive.arrows_nonempty_isColimit (R := S)
have : (ofArrows Z (Cofan.mk X π).inj).hasPullbacks :=
(inferInstance : (ofArrows Z π).hasPullbacks)
exact isSheafFor_of_preservesProduct _ _ hc
instance {α : Type} [Fintype α] (Z : α → C) : (ofArrows Z (fun i ↦ Sigma.ι Z i)).extensive :=
⟨⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ⟨coproductIsCoproduct _⟩⟩⟩
/--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) := by
| refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩ | /--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) := by
| Mathlib.CategoryTheory.Sites.RegularExtensive.366_0.rkSRr0zuqme90Yu | /--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) | Mathlib_CategoryTheory_Sites_RegularExtensive |
case refine_1
C : Type u
inst✝² : Category.{v, u} C
inst✝¹ : FinitaryPreExtensive C
inst✝ : FinitaryExtensive C
F : Cᵒᵖ ⥤ Type (max u v)
hF : IsSheaf (Coverage.toGrothendieck C (extensiveCoverage C)) F
α : Type
x✝ : Fintype α
K : Discrete α ⥤ Cᵒᵖ
⊢ PreservesLimit K F | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; cases h; infer_instance⟩ _ h
lemma isSheaf_of_projective (F : Cᵒᵖ ⥤ Type (max u v)) [Preregular C] [∀ (X : C), Projective X] :
IsSheaf (regularCoverage C).toGrothendieck F :=
(isSheaf_coverage _ _).mpr fun S ⟨_, h⟩ ↦ have : S.regular := ⟨_, h⟩
isSheafFor_regular_of_projective _ _
/-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim
intro x hx
let x_ext := Presieve.FamilyOfElements.sieveExtend x
have hx_ext := Presieve.FamilyOfElements.Compatible.sieveExtend hx
let S := Sieve.generate (Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))
obtain ⟨t, t_amalg, t_uniq⟩ :=
(Sieve.forallYonedaIsSheaf_iff_colimit S).mpr ⟨h_colim⟩ W x_ext hx_ext
refine ⟨t, ?_, ?_⟩
· convert Presieve.isAmalgamation_restrict (Sieve.le_generate
(Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))) _ _ t_amalg
exact (Presieve.restrict_extend hx).symm
· exact fun y hy ↦ t_uniq y <| Presieve.isAmalgamation_sieveExtend x y hy
/-- The regular topology on any preregular category is subcanonical. -/
theorem subcanonical [Preregular C] : Sheaf.Subcanonical (regularCoverage C).toGrothendieck :=
Sheaf.Subcanonical.of_yoneda_isSheaf _ isSheaf_yoneda_obj
end regularCoverage
end RegularSheaves
section ExtensiveSheaves
variable [FinitaryPreExtensive C] {C}
/-- A presieve is *extensive* if it is finite and its arrows induce an isomorphism from the
coproduct to the target. -/
class Presieve.extensive {X : C} (R : Presieve X) :
Prop where
/-- `R` consists of a finite collection of arrows that together induce an isomorphism from the
coproduct of their sources. -/
arrows_nonempty_isColimit : ∃ (α : Type) (_ : Fintype α) (Z : α → C) (π : (a : α) → (Z a ⟶ X)),
R = Presieve.ofArrows Z π ∧ Nonempty (IsColimit (Cofan.mk X π))
instance {X : C} (S : Presieve X) [S.extensive] : S.hasPullbacks where
has_pullbacks := by
obtain ⟨_, _, _, _, rfl, ⟨hc⟩⟩ := Presieve.extensive.arrows_nonempty_isColimit (R := S)
intro _ _ _ _ _ hg
cases hg
apply FinitaryPreExtensive.hasPullbacks_of_is_coproduct hc
instance {α : Type} [Fintype α] {Z : α → C} {F : C ⥤ Type w}
[PreservesFiniteProducts F] : PreservesLimit (Discrete.functor fun a => (Z a)) F :=
(PreservesFiniteProducts.preserves α).preservesLimit
open Presieve Opposite
/--
A finite product preserving presheaf is a sheaf for the extensive topology on a category which is
`FinitaryPreExtensive`.
-/
theorem isSheafFor_extensive_of_preservesFiniteProducts {X : C} (S : Presieve X) [S.extensive]
(F : Cᵒᵖ ⥤ Type max u v) [PreservesFiniteProducts F] : S.IsSheafFor F := by
obtain ⟨_, _, Z, π, rfl, ⟨hc⟩⟩ := extensive.arrows_nonempty_isColimit (R := S)
have : (ofArrows Z (Cofan.mk X π).inj).hasPullbacks :=
(inferInstance : (ofArrows Z π).hasPullbacks)
exact isSheafFor_of_preservesProduct _ _ hc
instance {α : Type} [Fintype α] (Z : α → C) : (ofArrows Z (fun i ↦ Sigma.ι Z i)).extensive :=
⟨⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ⟨coproductIsCoproduct _⟩⟩⟩
/--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) := by
refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩
· | rw [Presieve.isSheaf_coverage] at hF | /--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) := by
refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩
· | Mathlib.CategoryTheory.Sites.RegularExtensive.366_0.rkSRr0zuqme90Yu | /--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) | Mathlib_CategoryTheory_Sites_RegularExtensive |
case refine_1
C : Type u
inst✝² : Category.{v, u} C
inst✝¹ : FinitaryPreExtensive C
inst✝ : FinitaryExtensive C
F : Cᵒᵖ ⥤ Type (max u v)
hF : ∀ {X : C}, ∀ R ∈ Coverage.covering (extensiveCoverage C) X, IsSheafFor F R
α : Type
x✝ : Fintype α
K : Discrete α ⥤ Cᵒᵖ
⊢ PreservesLimit K F | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; cases h; infer_instance⟩ _ h
lemma isSheaf_of_projective (F : Cᵒᵖ ⥤ Type (max u v)) [Preregular C] [∀ (X : C), Projective X] :
IsSheaf (regularCoverage C).toGrothendieck F :=
(isSheaf_coverage _ _).mpr fun S ⟨_, h⟩ ↦ have : S.regular := ⟨_, h⟩
isSheafFor_regular_of_projective _ _
/-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim
intro x hx
let x_ext := Presieve.FamilyOfElements.sieveExtend x
have hx_ext := Presieve.FamilyOfElements.Compatible.sieveExtend hx
let S := Sieve.generate (Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))
obtain ⟨t, t_amalg, t_uniq⟩ :=
(Sieve.forallYonedaIsSheaf_iff_colimit S).mpr ⟨h_colim⟩ W x_ext hx_ext
refine ⟨t, ?_, ?_⟩
· convert Presieve.isAmalgamation_restrict (Sieve.le_generate
(Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))) _ _ t_amalg
exact (Presieve.restrict_extend hx).symm
· exact fun y hy ↦ t_uniq y <| Presieve.isAmalgamation_sieveExtend x y hy
/-- The regular topology on any preregular category is subcanonical. -/
theorem subcanonical [Preregular C] : Sheaf.Subcanonical (regularCoverage C).toGrothendieck :=
Sheaf.Subcanonical.of_yoneda_isSheaf _ isSheaf_yoneda_obj
end regularCoverage
end RegularSheaves
section ExtensiveSheaves
variable [FinitaryPreExtensive C] {C}
/-- A presieve is *extensive* if it is finite and its arrows induce an isomorphism from the
coproduct to the target. -/
class Presieve.extensive {X : C} (R : Presieve X) :
Prop where
/-- `R` consists of a finite collection of arrows that together induce an isomorphism from the
coproduct of their sources. -/
arrows_nonempty_isColimit : ∃ (α : Type) (_ : Fintype α) (Z : α → C) (π : (a : α) → (Z a ⟶ X)),
R = Presieve.ofArrows Z π ∧ Nonempty (IsColimit (Cofan.mk X π))
instance {X : C} (S : Presieve X) [S.extensive] : S.hasPullbacks where
has_pullbacks := by
obtain ⟨_, _, _, _, rfl, ⟨hc⟩⟩ := Presieve.extensive.arrows_nonempty_isColimit (R := S)
intro _ _ _ _ _ hg
cases hg
apply FinitaryPreExtensive.hasPullbacks_of_is_coproduct hc
instance {α : Type} [Fintype α] {Z : α → C} {F : C ⥤ Type w}
[PreservesFiniteProducts F] : PreservesLimit (Discrete.functor fun a => (Z a)) F :=
(PreservesFiniteProducts.preserves α).preservesLimit
open Presieve Opposite
/--
A finite product preserving presheaf is a sheaf for the extensive topology on a category which is
`FinitaryPreExtensive`.
-/
theorem isSheafFor_extensive_of_preservesFiniteProducts {X : C} (S : Presieve X) [S.extensive]
(F : Cᵒᵖ ⥤ Type max u v) [PreservesFiniteProducts F] : S.IsSheafFor F := by
obtain ⟨_, _, Z, π, rfl, ⟨hc⟩⟩ := extensive.arrows_nonempty_isColimit (R := S)
have : (ofArrows Z (Cofan.mk X π).inj).hasPullbacks :=
(inferInstance : (ofArrows Z π).hasPullbacks)
exact isSheafFor_of_preservesProduct _ _ hc
instance {α : Type} [Fintype α] (Z : α → C) : (ofArrows Z (fun i ↦ Sigma.ι Z i)).extensive :=
⟨⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ⟨coproductIsCoproduct _⟩⟩⟩
/--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) := by
refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩
· rw [Presieve.isSheaf_coverage] at hF
| let Z : α → C := fun i ↦ unop (K.obj ⟨i⟩) | /--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) := by
refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩
· rw [Presieve.isSheaf_coverage] at hF
| Mathlib.CategoryTheory.Sites.RegularExtensive.366_0.rkSRr0zuqme90Yu | /--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) | Mathlib_CategoryTheory_Sites_RegularExtensive |
case refine_1
C : Type u
inst✝² : Category.{v, u} C
inst✝¹ : FinitaryPreExtensive C
inst✝ : FinitaryExtensive C
F : Cᵒᵖ ⥤ Type (max u v)
hF : ∀ {X : C}, ∀ R ∈ Coverage.covering (extensiveCoverage C) X, IsSheafFor F R
α : Type
x✝ : Fintype α
K : Discrete α ⥤ Cᵒᵖ
Z : α → C := fun i => (K.obj { as := i }).unop
⊢ PreservesLimit K F | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; cases h; infer_instance⟩ _ h
lemma isSheaf_of_projective (F : Cᵒᵖ ⥤ Type (max u v)) [Preregular C] [∀ (X : C), Projective X] :
IsSheaf (regularCoverage C).toGrothendieck F :=
(isSheaf_coverage _ _).mpr fun S ⟨_, h⟩ ↦ have : S.regular := ⟨_, h⟩
isSheafFor_regular_of_projective _ _
/-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim
intro x hx
let x_ext := Presieve.FamilyOfElements.sieveExtend x
have hx_ext := Presieve.FamilyOfElements.Compatible.sieveExtend hx
let S := Sieve.generate (Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))
obtain ⟨t, t_amalg, t_uniq⟩ :=
(Sieve.forallYonedaIsSheaf_iff_colimit S).mpr ⟨h_colim⟩ W x_ext hx_ext
refine ⟨t, ?_, ?_⟩
· convert Presieve.isAmalgamation_restrict (Sieve.le_generate
(Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))) _ _ t_amalg
exact (Presieve.restrict_extend hx).symm
· exact fun y hy ↦ t_uniq y <| Presieve.isAmalgamation_sieveExtend x y hy
/-- The regular topology on any preregular category is subcanonical. -/
theorem subcanonical [Preregular C] : Sheaf.Subcanonical (regularCoverage C).toGrothendieck :=
Sheaf.Subcanonical.of_yoneda_isSheaf _ isSheaf_yoneda_obj
end regularCoverage
end RegularSheaves
section ExtensiveSheaves
variable [FinitaryPreExtensive C] {C}
/-- A presieve is *extensive* if it is finite and its arrows induce an isomorphism from the
coproduct to the target. -/
class Presieve.extensive {X : C} (R : Presieve X) :
Prop where
/-- `R` consists of a finite collection of arrows that together induce an isomorphism from the
coproduct of their sources. -/
arrows_nonempty_isColimit : ∃ (α : Type) (_ : Fintype α) (Z : α → C) (π : (a : α) → (Z a ⟶ X)),
R = Presieve.ofArrows Z π ∧ Nonempty (IsColimit (Cofan.mk X π))
instance {X : C} (S : Presieve X) [S.extensive] : S.hasPullbacks where
has_pullbacks := by
obtain ⟨_, _, _, _, rfl, ⟨hc⟩⟩ := Presieve.extensive.arrows_nonempty_isColimit (R := S)
intro _ _ _ _ _ hg
cases hg
apply FinitaryPreExtensive.hasPullbacks_of_is_coproduct hc
instance {α : Type} [Fintype α] {Z : α → C} {F : C ⥤ Type w}
[PreservesFiniteProducts F] : PreservesLimit (Discrete.functor fun a => (Z a)) F :=
(PreservesFiniteProducts.preserves α).preservesLimit
open Presieve Opposite
/--
A finite product preserving presheaf is a sheaf for the extensive topology on a category which is
`FinitaryPreExtensive`.
-/
theorem isSheafFor_extensive_of_preservesFiniteProducts {X : C} (S : Presieve X) [S.extensive]
(F : Cᵒᵖ ⥤ Type max u v) [PreservesFiniteProducts F] : S.IsSheafFor F := by
obtain ⟨_, _, Z, π, rfl, ⟨hc⟩⟩ := extensive.arrows_nonempty_isColimit (R := S)
have : (ofArrows Z (Cofan.mk X π).inj).hasPullbacks :=
(inferInstance : (ofArrows Z π).hasPullbacks)
exact isSheafFor_of_preservesProduct _ _ hc
instance {α : Type} [Fintype α] (Z : α → C) : (ofArrows Z (fun i ↦ Sigma.ι Z i)).extensive :=
⟨⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ⟨coproductIsCoproduct _⟩⟩⟩
/--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) := by
refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩
· rw [Presieve.isSheaf_coverage] at hF
let Z : α → C := fun i ↦ unop (K.obj ⟨i⟩)
| have : (Presieve.ofArrows Z (Cofan.mk (∐ Z) (Sigma.ι Z)).inj).hasPullbacks :=
(inferInstance : (Presieve.ofArrows Z (Sigma.ι Z)).hasPullbacks) | /--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) := by
refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩
· rw [Presieve.isSheaf_coverage] at hF
let Z : α → C := fun i ↦ unop (K.obj ⟨i⟩)
| Mathlib.CategoryTheory.Sites.RegularExtensive.366_0.rkSRr0zuqme90Yu | /--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) | Mathlib_CategoryTheory_Sites_RegularExtensive |
case refine_1
C : Type u
inst✝² : Category.{v, u} C
inst✝¹ : FinitaryPreExtensive C
inst✝ : FinitaryExtensive C
F : Cᵒᵖ ⥤ Type (max u v)
hF : ∀ {X : C}, ∀ R ∈ Coverage.covering (extensiveCoverage C) X, IsSheafFor F R
α : Type
x✝ : Fintype α
K : Discrete α ⥤ Cᵒᵖ
Z : α → C := fun i => (K.obj { as := i }).unop
this : hasPullbacks (ofArrows Z (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z))))
⊢ PreservesLimit K F | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; cases h; infer_instance⟩ _ h
lemma isSheaf_of_projective (F : Cᵒᵖ ⥤ Type (max u v)) [Preregular C] [∀ (X : C), Projective X] :
IsSheaf (regularCoverage C).toGrothendieck F :=
(isSheaf_coverage _ _).mpr fun S ⟨_, h⟩ ↦ have : S.regular := ⟨_, h⟩
isSheafFor_regular_of_projective _ _
/-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim
intro x hx
let x_ext := Presieve.FamilyOfElements.sieveExtend x
have hx_ext := Presieve.FamilyOfElements.Compatible.sieveExtend hx
let S := Sieve.generate (Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))
obtain ⟨t, t_amalg, t_uniq⟩ :=
(Sieve.forallYonedaIsSheaf_iff_colimit S).mpr ⟨h_colim⟩ W x_ext hx_ext
refine ⟨t, ?_, ?_⟩
· convert Presieve.isAmalgamation_restrict (Sieve.le_generate
(Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))) _ _ t_amalg
exact (Presieve.restrict_extend hx).symm
· exact fun y hy ↦ t_uniq y <| Presieve.isAmalgamation_sieveExtend x y hy
/-- The regular topology on any preregular category is subcanonical. -/
theorem subcanonical [Preregular C] : Sheaf.Subcanonical (regularCoverage C).toGrothendieck :=
Sheaf.Subcanonical.of_yoneda_isSheaf _ isSheaf_yoneda_obj
end regularCoverage
end RegularSheaves
section ExtensiveSheaves
variable [FinitaryPreExtensive C] {C}
/-- A presieve is *extensive* if it is finite and its arrows induce an isomorphism from the
coproduct to the target. -/
class Presieve.extensive {X : C} (R : Presieve X) :
Prop where
/-- `R` consists of a finite collection of arrows that together induce an isomorphism from the
coproduct of their sources. -/
arrows_nonempty_isColimit : ∃ (α : Type) (_ : Fintype α) (Z : α → C) (π : (a : α) → (Z a ⟶ X)),
R = Presieve.ofArrows Z π ∧ Nonempty (IsColimit (Cofan.mk X π))
instance {X : C} (S : Presieve X) [S.extensive] : S.hasPullbacks where
has_pullbacks := by
obtain ⟨_, _, _, _, rfl, ⟨hc⟩⟩ := Presieve.extensive.arrows_nonempty_isColimit (R := S)
intro _ _ _ _ _ hg
cases hg
apply FinitaryPreExtensive.hasPullbacks_of_is_coproduct hc
instance {α : Type} [Fintype α] {Z : α → C} {F : C ⥤ Type w}
[PreservesFiniteProducts F] : PreservesLimit (Discrete.functor fun a => (Z a)) F :=
(PreservesFiniteProducts.preserves α).preservesLimit
open Presieve Opposite
/--
A finite product preserving presheaf is a sheaf for the extensive topology on a category which is
`FinitaryPreExtensive`.
-/
theorem isSheafFor_extensive_of_preservesFiniteProducts {X : C} (S : Presieve X) [S.extensive]
(F : Cᵒᵖ ⥤ Type max u v) [PreservesFiniteProducts F] : S.IsSheafFor F := by
obtain ⟨_, _, Z, π, rfl, ⟨hc⟩⟩ := extensive.arrows_nonempty_isColimit (R := S)
have : (ofArrows Z (Cofan.mk X π).inj).hasPullbacks :=
(inferInstance : (ofArrows Z π).hasPullbacks)
exact isSheafFor_of_preservesProduct _ _ hc
instance {α : Type} [Fintype α] (Z : α → C) : (ofArrows Z (fun i ↦ Sigma.ι Z i)).extensive :=
⟨⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ⟨coproductIsCoproduct _⟩⟩⟩
/--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) := by
refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩
· rw [Presieve.isSheaf_coverage] at hF
let Z : α → C := fun i ↦ unop (K.obj ⟨i⟩)
have : (Presieve.ofArrows Z (Cofan.mk (∐ Z) (Sigma.ι Z)).inj).hasPullbacks :=
(inferInstance : (Presieve.ofArrows Z (Sigma.ι Z)).hasPullbacks)
| have : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i) :=
(inferInstance : ∀ (i : α), Mono (Sigma.ι Z i)) | /--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) := by
refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩
· rw [Presieve.isSheaf_coverage] at hF
let Z : α → C := fun i ↦ unop (K.obj ⟨i⟩)
have : (Presieve.ofArrows Z (Cofan.mk (∐ Z) (Sigma.ι Z)).inj).hasPullbacks :=
(inferInstance : (Presieve.ofArrows Z (Sigma.ι Z)).hasPullbacks)
| Mathlib.CategoryTheory.Sites.RegularExtensive.366_0.rkSRr0zuqme90Yu | /--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) | Mathlib_CategoryTheory_Sites_RegularExtensive |
case refine_1
C : Type u
inst✝² : Category.{v, u} C
inst✝¹ : FinitaryPreExtensive C
inst✝ : FinitaryExtensive C
F : Cᵒᵖ ⥤ Type (max u v)
hF : ∀ {X : C}, ∀ R ∈ Coverage.covering (extensiveCoverage C) X, IsSheafFor F R
α : Type
x✝ : Fintype α
K : Discrete α ⥤ Cᵒᵖ
Z : α → C := fun i => (K.obj { as := i }).unop
this✝ : hasPullbacks (ofArrows Z (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z))))
this : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i)
⊢ PreservesLimit K F | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; cases h; infer_instance⟩ _ h
lemma isSheaf_of_projective (F : Cᵒᵖ ⥤ Type (max u v)) [Preregular C] [∀ (X : C), Projective X] :
IsSheaf (regularCoverage C).toGrothendieck F :=
(isSheaf_coverage _ _).mpr fun S ⟨_, h⟩ ↦ have : S.regular := ⟨_, h⟩
isSheafFor_regular_of_projective _ _
/-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim
intro x hx
let x_ext := Presieve.FamilyOfElements.sieveExtend x
have hx_ext := Presieve.FamilyOfElements.Compatible.sieveExtend hx
let S := Sieve.generate (Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))
obtain ⟨t, t_amalg, t_uniq⟩ :=
(Sieve.forallYonedaIsSheaf_iff_colimit S).mpr ⟨h_colim⟩ W x_ext hx_ext
refine ⟨t, ?_, ?_⟩
· convert Presieve.isAmalgamation_restrict (Sieve.le_generate
(Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))) _ _ t_amalg
exact (Presieve.restrict_extend hx).symm
· exact fun y hy ↦ t_uniq y <| Presieve.isAmalgamation_sieveExtend x y hy
/-- The regular topology on any preregular category is subcanonical. -/
theorem subcanonical [Preregular C] : Sheaf.Subcanonical (regularCoverage C).toGrothendieck :=
Sheaf.Subcanonical.of_yoneda_isSheaf _ isSheaf_yoneda_obj
end regularCoverage
end RegularSheaves
section ExtensiveSheaves
variable [FinitaryPreExtensive C] {C}
/-- A presieve is *extensive* if it is finite and its arrows induce an isomorphism from the
coproduct to the target. -/
class Presieve.extensive {X : C} (R : Presieve X) :
Prop where
/-- `R` consists of a finite collection of arrows that together induce an isomorphism from the
coproduct of their sources. -/
arrows_nonempty_isColimit : ∃ (α : Type) (_ : Fintype α) (Z : α → C) (π : (a : α) → (Z a ⟶ X)),
R = Presieve.ofArrows Z π ∧ Nonempty (IsColimit (Cofan.mk X π))
instance {X : C} (S : Presieve X) [S.extensive] : S.hasPullbacks where
has_pullbacks := by
obtain ⟨_, _, _, _, rfl, ⟨hc⟩⟩ := Presieve.extensive.arrows_nonempty_isColimit (R := S)
intro _ _ _ _ _ hg
cases hg
apply FinitaryPreExtensive.hasPullbacks_of_is_coproduct hc
instance {α : Type} [Fintype α] {Z : α → C} {F : C ⥤ Type w}
[PreservesFiniteProducts F] : PreservesLimit (Discrete.functor fun a => (Z a)) F :=
(PreservesFiniteProducts.preserves α).preservesLimit
open Presieve Opposite
/--
A finite product preserving presheaf is a sheaf for the extensive topology on a category which is
`FinitaryPreExtensive`.
-/
theorem isSheafFor_extensive_of_preservesFiniteProducts {X : C} (S : Presieve X) [S.extensive]
(F : Cᵒᵖ ⥤ Type max u v) [PreservesFiniteProducts F] : S.IsSheafFor F := by
obtain ⟨_, _, Z, π, rfl, ⟨hc⟩⟩ := extensive.arrows_nonempty_isColimit (R := S)
have : (ofArrows Z (Cofan.mk X π).inj).hasPullbacks :=
(inferInstance : (ofArrows Z π).hasPullbacks)
exact isSheafFor_of_preservesProduct _ _ hc
instance {α : Type} [Fintype α] (Z : α → C) : (ofArrows Z (fun i ↦ Sigma.ι Z i)).extensive :=
⟨⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ⟨coproductIsCoproduct _⟩⟩⟩
/--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) := by
refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩
· rw [Presieve.isSheaf_coverage] at hF
let Z : α → C := fun i ↦ unop (K.obj ⟨i⟩)
have : (Presieve.ofArrows Z (Cofan.mk (∐ Z) (Sigma.ι Z)).inj).hasPullbacks :=
(inferInstance : (Presieve.ofArrows Z (Sigma.ι Z)).hasPullbacks)
have : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i) :=
(inferInstance : ∀ (i : α), Mono (Sigma.ι Z i))
| let i : K ≅ Discrete.functor (fun i ↦ op (Z i)) := Discrete.natIsoFunctor | /--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) := by
refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩
· rw [Presieve.isSheaf_coverage] at hF
let Z : α → C := fun i ↦ unop (K.obj ⟨i⟩)
have : (Presieve.ofArrows Z (Cofan.mk (∐ Z) (Sigma.ι Z)).inj).hasPullbacks :=
(inferInstance : (Presieve.ofArrows Z (Sigma.ι Z)).hasPullbacks)
have : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i) :=
(inferInstance : ∀ (i : α), Mono (Sigma.ι Z i))
| Mathlib.CategoryTheory.Sites.RegularExtensive.366_0.rkSRr0zuqme90Yu | /--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) | Mathlib_CategoryTheory_Sites_RegularExtensive |
case refine_1
C : Type u
inst✝² : Category.{v, u} C
inst✝¹ : FinitaryPreExtensive C
inst✝ : FinitaryExtensive C
F : Cᵒᵖ ⥤ Type (max u v)
hF : ∀ {X : C}, ∀ R ∈ Coverage.covering (extensiveCoverage C) X, IsSheafFor F R
α : Type
x✝ : Fintype α
K : Discrete α ⥤ Cᵒᵖ
Z : α → C := fun i => (K.obj { as := i }).unop
this✝ : hasPullbacks (ofArrows Z (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z))))
this : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i)
i : K ≅ Discrete.functor fun i => op (Z i) := Discrete.natIsoFunctor
⊢ PreservesLimit K F | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; cases h; infer_instance⟩ _ h
lemma isSheaf_of_projective (F : Cᵒᵖ ⥤ Type (max u v)) [Preregular C] [∀ (X : C), Projective X] :
IsSheaf (regularCoverage C).toGrothendieck F :=
(isSheaf_coverage _ _).mpr fun S ⟨_, h⟩ ↦ have : S.regular := ⟨_, h⟩
isSheafFor_regular_of_projective _ _
/-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim
intro x hx
let x_ext := Presieve.FamilyOfElements.sieveExtend x
have hx_ext := Presieve.FamilyOfElements.Compatible.sieveExtend hx
let S := Sieve.generate (Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))
obtain ⟨t, t_amalg, t_uniq⟩ :=
(Sieve.forallYonedaIsSheaf_iff_colimit S).mpr ⟨h_colim⟩ W x_ext hx_ext
refine ⟨t, ?_, ?_⟩
· convert Presieve.isAmalgamation_restrict (Sieve.le_generate
(Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))) _ _ t_amalg
exact (Presieve.restrict_extend hx).symm
· exact fun y hy ↦ t_uniq y <| Presieve.isAmalgamation_sieveExtend x y hy
/-- The regular topology on any preregular category is subcanonical. -/
theorem subcanonical [Preregular C] : Sheaf.Subcanonical (regularCoverage C).toGrothendieck :=
Sheaf.Subcanonical.of_yoneda_isSheaf _ isSheaf_yoneda_obj
end regularCoverage
end RegularSheaves
section ExtensiveSheaves
variable [FinitaryPreExtensive C] {C}
/-- A presieve is *extensive* if it is finite and its arrows induce an isomorphism from the
coproduct to the target. -/
class Presieve.extensive {X : C} (R : Presieve X) :
Prop where
/-- `R` consists of a finite collection of arrows that together induce an isomorphism from the
coproduct of their sources. -/
arrows_nonempty_isColimit : ∃ (α : Type) (_ : Fintype α) (Z : α → C) (π : (a : α) → (Z a ⟶ X)),
R = Presieve.ofArrows Z π ∧ Nonempty (IsColimit (Cofan.mk X π))
instance {X : C} (S : Presieve X) [S.extensive] : S.hasPullbacks where
has_pullbacks := by
obtain ⟨_, _, _, _, rfl, ⟨hc⟩⟩ := Presieve.extensive.arrows_nonempty_isColimit (R := S)
intro _ _ _ _ _ hg
cases hg
apply FinitaryPreExtensive.hasPullbacks_of_is_coproduct hc
instance {α : Type} [Fintype α] {Z : α → C} {F : C ⥤ Type w}
[PreservesFiniteProducts F] : PreservesLimit (Discrete.functor fun a => (Z a)) F :=
(PreservesFiniteProducts.preserves α).preservesLimit
open Presieve Opposite
/--
A finite product preserving presheaf is a sheaf for the extensive topology on a category which is
`FinitaryPreExtensive`.
-/
theorem isSheafFor_extensive_of_preservesFiniteProducts {X : C} (S : Presieve X) [S.extensive]
(F : Cᵒᵖ ⥤ Type max u v) [PreservesFiniteProducts F] : S.IsSheafFor F := by
obtain ⟨_, _, Z, π, rfl, ⟨hc⟩⟩ := extensive.arrows_nonempty_isColimit (R := S)
have : (ofArrows Z (Cofan.mk X π).inj).hasPullbacks :=
(inferInstance : (ofArrows Z π).hasPullbacks)
exact isSheafFor_of_preservesProduct _ _ hc
instance {α : Type} [Fintype α] (Z : α → C) : (ofArrows Z (fun i ↦ Sigma.ι Z i)).extensive :=
⟨⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ⟨coproductIsCoproduct _⟩⟩⟩
/--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) := by
refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩
· rw [Presieve.isSheaf_coverage] at hF
let Z : α → C := fun i ↦ unop (K.obj ⟨i⟩)
have : (Presieve.ofArrows Z (Cofan.mk (∐ Z) (Sigma.ι Z)).inj).hasPullbacks :=
(inferInstance : (Presieve.ofArrows Z (Sigma.ι Z)).hasPullbacks)
have : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i) :=
(inferInstance : ∀ (i : α), Mono (Sigma.ι Z i))
let i : K ≅ Discrete.functor (fun i ↦ op (Z i)) := Discrete.natIsoFunctor
| let _ : PreservesLimit (Discrete.functor (fun i ↦ op (Z i))) F :=
Presieve.preservesProductOfIsSheafFor F ?_ initialIsInitial _ (coproductIsCoproduct Z)
(FinitaryExtensive.isPullback_initial_to_sigma_ι Z)
(hF (Presieve.ofArrows Z (fun i ↦ Sigma.ι Z i)) ?_) | /--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) := by
refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩
· rw [Presieve.isSheaf_coverage] at hF
let Z : α → C := fun i ↦ unop (K.obj ⟨i⟩)
have : (Presieve.ofArrows Z (Cofan.mk (∐ Z) (Sigma.ι Z)).inj).hasPullbacks :=
(inferInstance : (Presieve.ofArrows Z (Sigma.ι Z)).hasPullbacks)
have : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i) :=
(inferInstance : ∀ (i : α), Mono (Sigma.ι Z i))
let i : K ≅ Discrete.functor (fun i ↦ op (Z i)) := Discrete.natIsoFunctor
| Mathlib.CategoryTheory.Sites.RegularExtensive.366_0.rkSRr0zuqme90Yu | /--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) | Mathlib_CategoryTheory_Sites_RegularExtensive |
case refine_1.refine_3
C : Type u
inst✝² : Category.{v, u} C
inst✝¹ : FinitaryPreExtensive C
inst✝ : FinitaryExtensive C
F : Cᵒᵖ ⥤ Type (max u v)
hF : ∀ {X : C}, ∀ R ∈ Coverage.covering (extensiveCoverage C) X, IsSheafFor F R
α : Type
x✝¹ : Fintype α
K : Discrete α ⥤ Cᵒᵖ
Z : α → C := fun i => (K.obj { as := i }).unop
this✝ : hasPullbacks (ofArrows Z (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z))))
this : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i)
i : K ≅ Discrete.functor fun i => op (Z i) := Discrete.natIsoFunctor
x✝ : PreservesLimit (Discrete.functor fun i => op (Z i)) F :=
preservesProductOfIsSheafFor F ?refine_1.refine_1 initialIsInitial (Cofan.mk (∐ Z) (Sigma.ι Z))
(coproductIsCoproduct Z)
(_ : ∀ (i j : α), i ≠ j → IsPullback (initial.to (Z i)) (initial.to (Z j)) (Sigma.ι Z i) (Sigma.ι Z j))
(_ : IsSheafFor F (ofArrows Z fun i => Sigma.ι Z i))
⊢ PreservesLimit K F | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; cases h; infer_instance⟩ _ h
lemma isSheaf_of_projective (F : Cᵒᵖ ⥤ Type (max u v)) [Preregular C] [∀ (X : C), Projective X] :
IsSheaf (regularCoverage C).toGrothendieck F :=
(isSheaf_coverage _ _).mpr fun S ⟨_, h⟩ ↦ have : S.regular := ⟨_, h⟩
isSheafFor_regular_of_projective _ _
/-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim
intro x hx
let x_ext := Presieve.FamilyOfElements.sieveExtend x
have hx_ext := Presieve.FamilyOfElements.Compatible.sieveExtend hx
let S := Sieve.generate (Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))
obtain ⟨t, t_amalg, t_uniq⟩ :=
(Sieve.forallYonedaIsSheaf_iff_colimit S).mpr ⟨h_colim⟩ W x_ext hx_ext
refine ⟨t, ?_, ?_⟩
· convert Presieve.isAmalgamation_restrict (Sieve.le_generate
(Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))) _ _ t_amalg
exact (Presieve.restrict_extend hx).symm
· exact fun y hy ↦ t_uniq y <| Presieve.isAmalgamation_sieveExtend x y hy
/-- The regular topology on any preregular category is subcanonical. -/
theorem subcanonical [Preregular C] : Sheaf.Subcanonical (regularCoverage C).toGrothendieck :=
Sheaf.Subcanonical.of_yoneda_isSheaf _ isSheaf_yoneda_obj
end regularCoverage
end RegularSheaves
section ExtensiveSheaves
variable [FinitaryPreExtensive C] {C}
/-- A presieve is *extensive* if it is finite and its arrows induce an isomorphism from the
coproduct to the target. -/
class Presieve.extensive {X : C} (R : Presieve X) :
Prop where
/-- `R` consists of a finite collection of arrows that together induce an isomorphism from the
coproduct of their sources. -/
arrows_nonempty_isColimit : ∃ (α : Type) (_ : Fintype α) (Z : α → C) (π : (a : α) → (Z a ⟶ X)),
R = Presieve.ofArrows Z π ∧ Nonempty (IsColimit (Cofan.mk X π))
instance {X : C} (S : Presieve X) [S.extensive] : S.hasPullbacks where
has_pullbacks := by
obtain ⟨_, _, _, _, rfl, ⟨hc⟩⟩ := Presieve.extensive.arrows_nonempty_isColimit (R := S)
intro _ _ _ _ _ hg
cases hg
apply FinitaryPreExtensive.hasPullbacks_of_is_coproduct hc
instance {α : Type} [Fintype α] {Z : α → C} {F : C ⥤ Type w}
[PreservesFiniteProducts F] : PreservesLimit (Discrete.functor fun a => (Z a)) F :=
(PreservesFiniteProducts.preserves α).preservesLimit
open Presieve Opposite
/--
A finite product preserving presheaf is a sheaf for the extensive topology on a category which is
`FinitaryPreExtensive`.
-/
theorem isSheafFor_extensive_of_preservesFiniteProducts {X : C} (S : Presieve X) [S.extensive]
(F : Cᵒᵖ ⥤ Type max u v) [PreservesFiniteProducts F] : S.IsSheafFor F := by
obtain ⟨_, _, Z, π, rfl, ⟨hc⟩⟩ := extensive.arrows_nonempty_isColimit (R := S)
have : (ofArrows Z (Cofan.mk X π).inj).hasPullbacks :=
(inferInstance : (ofArrows Z π).hasPullbacks)
exact isSheafFor_of_preservesProduct _ _ hc
instance {α : Type} [Fintype α] (Z : α → C) : (ofArrows Z (fun i ↦ Sigma.ι Z i)).extensive :=
⟨⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ⟨coproductIsCoproduct _⟩⟩⟩
/--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) := by
refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩
· rw [Presieve.isSheaf_coverage] at hF
let Z : α → C := fun i ↦ unop (K.obj ⟨i⟩)
have : (Presieve.ofArrows Z (Cofan.mk (∐ Z) (Sigma.ι Z)).inj).hasPullbacks :=
(inferInstance : (Presieve.ofArrows Z (Sigma.ι Z)).hasPullbacks)
have : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i) :=
(inferInstance : ∀ (i : α), Mono (Sigma.ι Z i))
let i : K ≅ Discrete.functor (fun i ↦ op (Z i)) := Discrete.natIsoFunctor
let _ : PreservesLimit (Discrete.functor (fun i ↦ op (Z i))) F :=
Presieve.preservesProductOfIsSheafFor F ?_ initialIsInitial _ (coproductIsCoproduct Z)
(FinitaryExtensive.isPullback_initial_to_sigma_ι Z)
(hF (Presieve.ofArrows Z (fun i ↦ Sigma.ι Z i)) ?_)
· | exact preservesLimitOfIsoDiagram F i.symm | /--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) := by
refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩
· rw [Presieve.isSheaf_coverage] at hF
let Z : α → C := fun i ↦ unop (K.obj ⟨i⟩)
have : (Presieve.ofArrows Z (Cofan.mk (∐ Z) (Sigma.ι Z)).inj).hasPullbacks :=
(inferInstance : (Presieve.ofArrows Z (Sigma.ι Z)).hasPullbacks)
have : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i) :=
(inferInstance : ∀ (i : α), Mono (Sigma.ι Z i))
let i : K ≅ Discrete.functor (fun i ↦ op (Z i)) := Discrete.natIsoFunctor
let _ : PreservesLimit (Discrete.functor (fun i ↦ op (Z i))) F :=
Presieve.preservesProductOfIsSheafFor F ?_ initialIsInitial _ (coproductIsCoproduct Z)
(FinitaryExtensive.isPullback_initial_to_sigma_ι Z)
(hF (Presieve.ofArrows Z (fun i ↦ Sigma.ι Z i)) ?_)
· | Mathlib.CategoryTheory.Sites.RegularExtensive.366_0.rkSRr0zuqme90Yu | /--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) | Mathlib_CategoryTheory_Sites_RegularExtensive |
case refine_1.refine_1
C : Type u
inst✝² : Category.{v, u} C
inst✝¹ : FinitaryPreExtensive C
inst✝ : FinitaryExtensive C
F : Cᵒᵖ ⥤ Type (max u v)
hF : ∀ {X : C}, ∀ R ∈ Coverage.covering (extensiveCoverage C) X, IsSheafFor F R
α : Type
x✝ : Fintype α
K : Discrete α ⥤ Cᵒᵖ
Z : α → C := fun i => (K.obj { as := i }).unop
this✝ : hasPullbacks (ofArrows Z (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z))))
this : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i)
i : K ≅ Discrete.functor fun i => op (Z i) := Discrete.natIsoFunctor
⊢ IsSheafFor F (ofArrows Empty.elim fun a => IsEmpty.elim instIsEmptyEmpty a) | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; cases h; infer_instance⟩ _ h
lemma isSheaf_of_projective (F : Cᵒᵖ ⥤ Type (max u v)) [Preregular C] [∀ (X : C), Projective X] :
IsSheaf (regularCoverage C).toGrothendieck F :=
(isSheaf_coverage _ _).mpr fun S ⟨_, h⟩ ↦ have : S.regular := ⟨_, h⟩
isSheafFor_regular_of_projective _ _
/-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim
intro x hx
let x_ext := Presieve.FamilyOfElements.sieveExtend x
have hx_ext := Presieve.FamilyOfElements.Compatible.sieveExtend hx
let S := Sieve.generate (Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))
obtain ⟨t, t_amalg, t_uniq⟩ :=
(Sieve.forallYonedaIsSheaf_iff_colimit S).mpr ⟨h_colim⟩ W x_ext hx_ext
refine ⟨t, ?_, ?_⟩
· convert Presieve.isAmalgamation_restrict (Sieve.le_generate
(Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))) _ _ t_amalg
exact (Presieve.restrict_extend hx).symm
· exact fun y hy ↦ t_uniq y <| Presieve.isAmalgamation_sieveExtend x y hy
/-- The regular topology on any preregular category is subcanonical. -/
theorem subcanonical [Preregular C] : Sheaf.Subcanonical (regularCoverage C).toGrothendieck :=
Sheaf.Subcanonical.of_yoneda_isSheaf _ isSheaf_yoneda_obj
end regularCoverage
end RegularSheaves
section ExtensiveSheaves
variable [FinitaryPreExtensive C] {C}
/-- A presieve is *extensive* if it is finite and its arrows induce an isomorphism from the
coproduct to the target. -/
class Presieve.extensive {X : C} (R : Presieve X) :
Prop where
/-- `R` consists of a finite collection of arrows that together induce an isomorphism from the
coproduct of their sources. -/
arrows_nonempty_isColimit : ∃ (α : Type) (_ : Fintype α) (Z : α → C) (π : (a : α) → (Z a ⟶ X)),
R = Presieve.ofArrows Z π ∧ Nonempty (IsColimit (Cofan.mk X π))
instance {X : C} (S : Presieve X) [S.extensive] : S.hasPullbacks where
has_pullbacks := by
obtain ⟨_, _, _, _, rfl, ⟨hc⟩⟩ := Presieve.extensive.arrows_nonempty_isColimit (R := S)
intro _ _ _ _ _ hg
cases hg
apply FinitaryPreExtensive.hasPullbacks_of_is_coproduct hc
instance {α : Type} [Fintype α] {Z : α → C} {F : C ⥤ Type w}
[PreservesFiniteProducts F] : PreservesLimit (Discrete.functor fun a => (Z a)) F :=
(PreservesFiniteProducts.preserves α).preservesLimit
open Presieve Opposite
/--
A finite product preserving presheaf is a sheaf for the extensive topology on a category which is
`FinitaryPreExtensive`.
-/
theorem isSheafFor_extensive_of_preservesFiniteProducts {X : C} (S : Presieve X) [S.extensive]
(F : Cᵒᵖ ⥤ Type max u v) [PreservesFiniteProducts F] : S.IsSheafFor F := by
obtain ⟨_, _, Z, π, rfl, ⟨hc⟩⟩ := extensive.arrows_nonempty_isColimit (R := S)
have : (ofArrows Z (Cofan.mk X π).inj).hasPullbacks :=
(inferInstance : (ofArrows Z π).hasPullbacks)
exact isSheafFor_of_preservesProduct _ _ hc
instance {α : Type} [Fintype α] (Z : α → C) : (ofArrows Z (fun i ↦ Sigma.ι Z i)).extensive :=
⟨⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ⟨coproductIsCoproduct _⟩⟩⟩
/--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) := by
refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩
· rw [Presieve.isSheaf_coverage] at hF
let Z : α → C := fun i ↦ unop (K.obj ⟨i⟩)
have : (Presieve.ofArrows Z (Cofan.mk (∐ Z) (Sigma.ι Z)).inj).hasPullbacks :=
(inferInstance : (Presieve.ofArrows Z (Sigma.ι Z)).hasPullbacks)
have : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i) :=
(inferInstance : ∀ (i : α), Mono (Sigma.ι Z i))
let i : K ≅ Discrete.functor (fun i ↦ op (Z i)) := Discrete.natIsoFunctor
let _ : PreservesLimit (Discrete.functor (fun i ↦ op (Z i))) F :=
Presieve.preservesProductOfIsSheafFor F ?_ initialIsInitial _ (coproductIsCoproduct Z)
(FinitaryExtensive.isPullback_initial_to_sigma_ι Z)
(hF (Presieve.ofArrows Z (fun i ↦ Sigma.ι Z i)) ?_)
· exact preservesLimitOfIsoDiagram F i.symm
· | apply hF | /--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) := by
refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩
· rw [Presieve.isSheaf_coverage] at hF
let Z : α → C := fun i ↦ unop (K.obj ⟨i⟩)
have : (Presieve.ofArrows Z (Cofan.mk (∐ Z) (Sigma.ι Z)).inj).hasPullbacks :=
(inferInstance : (Presieve.ofArrows Z (Sigma.ι Z)).hasPullbacks)
have : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i) :=
(inferInstance : ∀ (i : α), Mono (Sigma.ι Z i))
let i : K ≅ Discrete.functor (fun i ↦ op (Z i)) := Discrete.natIsoFunctor
let _ : PreservesLimit (Discrete.functor (fun i ↦ op (Z i))) F :=
Presieve.preservesProductOfIsSheafFor F ?_ initialIsInitial _ (coproductIsCoproduct Z)
(FinitaryExtensive.isPullback_initial_to_sigma_ι Z)
(hF (Presieve.ofArrows Z (fun i ↦ Sigma.ι Z i)) ?_)
· exact preservesLimitOfIsoDiagram F i.symm
· | Mathlib.CategoryTheory.Sites.RegularExtensive.366_0.rkSRr0zuqme90Yu | /--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) | Mathlib_CategoryTheory_Sites_RegularExtensive |
case refine_1.refine_1.a
C : Type u
inst✝² : Category.{v, u} C
inst✝¹ : FinitaryPreExtensive C
inst✝ : FinitaryExtensive C
F : Cᵒᵖ ⥤ Type (max u v)
hF : ∀ {X : C}, ∀ R ∈ Coverage.covering (extensiveCoverage C) X, IsSheafFor F R
α : Type
x✝ : Fintype α
K : Discrete α ⥤ Cᵒᵖ
Z : α → C := fun i => (K.obj { as := i }).unop
this✝ : hasPullbacks (ofArrows Z (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z))))
this : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i)
i : K ≅ Discrete.functor fun i => op (Z i) := Discrete.natIsoFunctor
⊢ (ofArrows Empty.elim fun a => IsEmpty.elim instIsEmptyEmpty a) ∈ Coverage.covering (extensiveCoverage C) (⊥_ C) | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; cases h; infer_instance⟩ _ h
lemma isSheaf_of_projective (F : Cᵒᵖ ⥤ Type (max u v)) [Preregular C] [∀ (X : C), Projective X] :
IsSheaf (regularCoverage C).toGrothendieck F :=
(isSheaf_coverage _ _).mpr fun S ⟨_, h⟩ ↦ have : S.regular := ⟨_, h⟩
isSheafFor_regular_of_projective _ _
/-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim
intro x hx
let x_ext := Presieve.FamilyOfElements.sieveExtend x
have hx_ext := Presieve.FamilyOfElements.Compatible.sieveExtend hx
let S := Sieve.generate (Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))
obtain ⟨t, t_amalg, t_uniq⟩ :=
(Sieve.forallYonedaIsSheaf_iff_colimit S).mpr ⟨h_colim⟩ W x_ext hx_ext
refine ⟨t, ?_, ?_⟩
· convert Presieve.isAmalgamation_restrict (Sieve.le_generate
(Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))) _ _ t_amalg
exact (Presieve.restrict_extend hx).symm
· exact fun y hy ↦ t_uniq y <| Presieve.isAmalgamation_sieveExtend x y hy
/-- The regular topology on any preregular category is subcanonical. -/
theorem subcanonical [Preregular C] : Sheaf.Subcanonical (regularCoverage C).toGrothendieck :=
Sheaf.Subcanonical.of_yoneda_isSheaf _ isSheaf_yoneda_obj
end regularCoverage
end RegularSheaves
section ExtensiveSheaves
variable [FinitaryPreExtensive C] {C}
/-- A presieve is *extensive* if it is finite and its arrows induce an isomorphism from the
coproduct to the target. -/
class Presieve.extensive {X : C} (R : Presieve X) :
Prop where
/-- `R` consists of a finite collection of arrows that together induce an isomorphism from the
coproduct of their sources. -/
arrows_nonempty_isColimit : ∃ (α : Type) (_ : Fintype α) (Z : α → C) (π : (a : α) → (Z a ⟶ X)),
R = Presieve.ofArrows Z π ∧ Nonempty (IsColimit (Cofan.mk X π))
instance {X : C} (S : Presieve X) [S.extensive] : S.hasPullbacks where
has_pullbacks := by
obtain ⟨_, _, _, _, rfl, ⟨hc⟩⟩ := Presieve.extensive.arrows_nonempty_isColimit (R := S)
intro _ _ _ _ _ hg
cases hg
apply FinitaryPreExtensive.hasPullbacks_of_is_coproduct hc
instance {α : Type} [Fintype α] {Z : α → C} {F : C ⥤ Type w}
[PreservesFiniteProducts F] : PreservesLimit (Discrete.functor fun a => (Z a)) F :=
(PreservesFiniteProducts.preserves α).preservesLimit
open Presieve Opposite
/--
A finite product preserving presheaf is a sheaf for the extensive topology on a category which is
`FinitaryPreExtensive`.
-/
theorem isSheafFor_extensive_of_preservesFiniteProducts {X : C} (S : Presieve X) [S.extensive]
(F : Cᵒᵖ ⥤ Type max u v) [PreservesFiniteProducts F] : S.IsSheafFor F := by
obtain ⟨_, _, Z, π, rfl, ⟨hc⟩⟩ := extensive.arrows_nonempty_isColimit (R := S)
have : (ofArrows Z (Cofan.mk X π).inj).hasPullbacks :=
(inferInstance : (ofArrows Z π).hasPullbacks)
exact isSheafFor_of_preservesProduct _ _ hc
instance {α : Type} [Fintype α] (Z : α → C) : (ofArrows Z (fun i ↦ Sigma.ι Z i)).extensive :=
⟨⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ⟨coproductIsCoproduct _⟩⟩⟩
/--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) := by
refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩
· rw [Presieve.isSheaf_coverage] at hF
let Z : α → C := fun i ↦ unop (K.obj ⟨i⟩)
have : (Presieve.ofArrows Z (Cofan.mk (∐ Z) (Sigma.ι Z)).inj).hasPullbacks :=
(inferInstance : (Presieve.ofArrows Z (Sigma.ι Z)).hasPullbacks)
have : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i) :=
(inferInstance : ∀ (i : α), Mono (Sigma.ι Z i))
let i : K ≅ Discrete.functor (fun i ↦ op (Z i)) := Discrete.natIsoFunctor
let _ : PreservesLimit (Discrete.functor (fun i ↦ op (Z i))) F :=
Presieve.preservesProductOfIsSheafFor F ?_ initialIsInitial _ (coproductIsCoproduct Z)
(FinitaryExtensive.isPullback_initial_to_sigma_ι Z)
(hF (Presieve.ofArrows Z (fun i ↦ Sigma.ι Z i)) ?_)
· exact preservesLimitOfIsoDiagram F i.symm
· apply hF
| refine ⟨Empty, inferInstance, Empty.elim, IsEmpty.elim inferInstance, rfl, ⟨default,?_, ?_⟩⟩ | /--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) := by
refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩
· rw [Presieve.isSheaf_coverage] at hF
let Z : α → C := fun i ↦ unop (K.obj ⟨i⟩)
have : (Presieve.ofArrows Z (Cofan.mk (∐ Z) (Sigma.ι Z)).inj).hasPullbacks :=
(inferInstance : (Presieve.ofArrows Z (Sigma.ι Z)).hasPullbacks)
have : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i) :=
(inferInstance : ∀ (i : α), Mono (Sigma.ι Z i))
let i : K ≅ Discrete.functor (fun i ↦ op (Z i)) := Discrete.natIsoFunctor
let _ : PreservesLimit (Discrete.functor (fun i ↦ op (Z i))) F :=
Presieve.preservesProductOfIsSheafFor F ?_ initialIsInitial _ (coproductIsCoproduct Z)
(FinitaryExtensive.isPullback_initial_to_sigma_ι Z)
(hF (Presieve.ofArrows Z (fun i ↦ Sigma.ι Z i)) ?_)
· exact preservesLimitOfIsoDiagram F i.symm
· apply hF
| Mathlib.CategoryTheory.Sites.RegularExtensive.366_0.rkSRr0zuqme90Yu | /--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) | Mathlib_CategoryTheory_Sites_RegularExtensive |
case refine_1.refine_1.a.refine_1
C : Type u
inst✝² : Category.{v, u} C
inst✝¹ : FinitaryPreExtensive C
inst✝ : FinitaryExtensive C
F : Cᵒᵖ ⥤ Type (max u v)
hF : ∀ {X : C}, ∀ R ∈ Coverage.covering (extensiveCoverage C) X, IsSheafFor F R
α : Type
x✝ : Fintype α
K : Discrete α ⥤ Cᵒᵖ
Z : α → C := fun i => (K.obj { as := i }).unop
this✝ : hasPullbacks (ofArrows Z (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z))))
this : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i)
i : K ≅ Discrete.functor fun i => op (Z i) := Discrete.natIsoFunctor
⊢ (Sigma.desc fun a => IsEmpty.elim (_ : IsEmpty Empty) a) ≫ default = 𝟙 (∐ fun b => Empty.elim b) | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; cases h; infer_instance⟩ _ h
lemma isSheaf_of_projective (F : Cᵒᵖ ⥤ Type (max u v)) [Preregular C] [∀ (X : C), Projective X] :
IsSheaf (regularCoverage C).toGrothendieck F :=
(isSheaf_coverage _ _).mpr fun S ⟨_, h⟩ ↦ have : S.regular := ⟨_, h⟩
isSheafFor_regular_of_projective _ _
/-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim
intro x hx
let x_ext := Presieve.FamilyOfElements.sieveExtend x
have hx_ext := Presieve.FamilyOfElements.Compatible.sieveExtend hx
let S := Sieve.generate (Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))
obtain ⟨t, t_amalg, t_uniq⟩ :=
(Sieve.forallYonedaIsSheaf_iff_colimit S).mpr ⟨h_colim⟩ W x_ext hx_ext
refine ⟨t, ?_, ?_⟩
· convert Presieve.isAmalgamation_restrict (Sieve.le_generate
(Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))) _ _ t_amalg
exact (Presieve.restrict_extend hx).symm
· exact fun y hy ↦ t_uniq y <| Presieve.isAmalgamation_sieveExtend x y hy
/-- The regular topology on any preregular category is subcanonical. -/
theorem subcanonical [Preregular C] : Sheaf.Subcanonical (regularCoverage C).toGrothendieck :=
Sheaf.Subcanonical.of_yoneda_isSheaf _ isSheaf_yoneda_obj
end regularCoverage
end RegularSheaves
section ExtensiveSheaves
variable [FinitaryPreExtensive C] {C}
/-- A presieve is *extensive* if it is finite and its arrows induce an isomorphism from the
coproduct to the target. -/
class Presieve.extensive {X : C} (R : Presieve X) :
Prop where
/-- `R` consists of a finite collection of arrows that together induce an isomorphism from the
coproduct of their sources. -/
arrows_nonempty_isColimit : ∃ (α : Type) (_ : Fintype α) (Z : α → C) (π : (a : α) → (Z a ⟶ X)),
R = Presieve.ofArrows Z π ∧ Nonempty (IsColimit (Cofan.mk X π))
instance {X : C} (S : Presieve X) [S.extensive] : S.hasPullbacks where
has_pullbacks := by
obtain ⟨_, _, _, _, rfl, ⟨hc⟩⟩ := Presieve.extensive.arrows_nonempty_isColimit (R := S)
intro _ _ _ _ _ hg
cases hg
apply FinitaryPreExtensive.hasPullbacks_of_is_coproduct hc
instance {α : Type} [Fintype α] {Z : α → C} {F : C ⥤ Type w}
[PreservesFiniteProducts F] : PreservesLimit (Discrete.functor fun a => (Z a)) F :=
(PreservesFiniteProducts.preserves α).preservesLimit
open Presieve Opposite
/--
A finite product preserving presheaf is a sheaf for the extensive topology on a category which is
`FinitaryPreExtensive`.
-/
theorem isSheafFor_extensive_of_preservesFiniteProducts {X : C} (S : Presieve X) [S.extensive]
(F : Cᵒᵖ ⥤ Type max u v) [PreservesFiniteProducts F] : S.IsSheafFor F := by
obtain ⟨_, _, Z, π, rfl, ⟨hc⟩⟩ := extensive.arrows_nonempty_isColimit (R := S)
have : (ofArrows Z (Cofan.mk X π).inj).hasPullbacks :=
(inferInstance : (ofArrows Z π).hasPullbacks)
exact isSheafFor_of_preservesProduct _ _ hc
instance {α : Type} [Fintype α] (Z : α → C) : (ofArrows Z (fun i ↦ Sigma.ι Z i)).extensive :=
⟨⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ⟨coproductIsCoproduct _⟩⟩⟩
/--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) := by
refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩
· rw [Presieve.isSheaf_coverage] at hF
let Z : α → C := fun i ↦ unop (K.obj ⟨i⟩)
have : (Presieve.ofArrows Z (Cofan.mk (∐ Z) (Sigma.ι Z)).inj).hasPullbacks :=
(inferInstance : (Presieve.ofArrows Z (Sigma.ι Z)).hasPullbacks)
have : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i) :=
(inferInstance : ∀ (i : α), Mono (Sigma.ι Z i))
let i : K ≅ Discrete.functor (fun i ↦ op (Z i)) := Discrete.natIsoFunctor
let _ : PreservesLimit (Discrete.functor (fun i ↦ op (Z i))) F :=
Presieve.preservesProductOfIsSheafFor F ?_ initialIsInitial _ (coproductIsCoproduct Z)
(FinitaryExtensive.isPullback_initial_to_sigma_ι Z)
(hF (Presieve.ofArrows Z (fun i ↦ Sigma.ι Z i)) ?_)
· exact preservesLimitOfIsoDiagram F i.symm
· apply hF
refine ⟨Empty, inferInstance, Empty.elim, IsEmpty.elim inferInstance, rfl, ⟨default,?_, ?_⟩⟩
· | ext b | /--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) := by
refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩
· rw [Presieve.isSheaf_coverage] at hF
let Z : α → C := fun i ↦ unop (K.obj ⟨i⟩)
have : (Presieve.ofArrows Z (Cofan.mk (∐ Z) (Sigma.ι Z)).inj).hasPullbacks :=
(inferInstance : (Presieve.ofArrows Z (Sigma.ι Z)).hasPullbacks)
have : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i) :=
(inferInstance : ∀ (i : α), Mono (Sigma.ι Z i))
let i : K ≅ Discrete.functor (fun i ↦ op (Z i)) := Discrete.natIsoFunctor
let _ : PreservesLimit (Discrete.functor (fun i ↦ op (Z i))) F :=
Presieve.preservesProductOfIsSheafFor F ?_ initialIsInitial _ (coproductIsCoproduct Z)
(FinitaryExtensive.isPullback_initial_to_sigma_ι Z)
(hF (Presieve.ofArrows Z (fun i ↦ Sigma.ι Z i)) ?_)
· exact preservesLimitOfIsoDiagram F i.symm
· apply hF
refine ⟨Empty, inferInstance, Empty.elim, IsEmpty.elim inferInstance, rfl, ⟨default,?_, ?_⟩⟩
· | Mathlib.CategoryTheory.Sites.RegularExtensive.366_0.rkSRr0zuqme90Yu | /--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) | Mathlib_CategoryTheory_Sites_RegularExtensive |
case refine_1.refine_1.a.refine_1.h
C : Type u
inst✝² : Category.{v, u} C
inst✝¹ : FinitaryPreExtensive C
inst✝ : FinitaryExtensive C
F : Cᵒᵖ ⥤ Type (max u v)
hF : ∀ {X : C}, ∀ R ∈ Coverage.covering (extensiveCoverage C) X, IsSheafFor F R
α : Type
x✝ : Fintype α
K : Discrete α ⥤ Cᵒᵖ
Z : α → C := fun i => (K.obj { as := i }).unop
this✝ : hasPullbacks (ofArrows Z (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z))))
this : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i)
i : K ≅ Discrete.functor fun i => op (Z i) := Discrete.natIsoFunctor
b : Empty
⊢ Sigma.ι (fun b => Empty.elim b) b ≫ (Sigma.desc fun a => IsEmpty.elim (_ : IsEmpty Empty) a) ≫ default =
Sigma.ι (fun b => Empty.elim b) b ≫ 𝟙 (∐ fun b => Empty.elim b) | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; cases h; infer_instance⟩ _ h
lemma isSheaf_of_projective (F : Cᵒᵖ ⥤ Type (max u v)) [Preregular C] [∀ (X : C), Projective X] :
IsSheaf (regularCoverage C).toGrothendieck F :=
(isSheaf_coverage _ _).mpr fun S ⟨_, h⟩ ↦ have : S.regular := ⟨_, h⟩
isSheafFor_regular_of_projective _ _
/-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim
intro x hx
let x_ext := Presieve.FamilyOfElements.sieveExtend x
have hx_ext := Presieve.FamilyOfElements.Compatible.sieveExtend hx
let S := Sieve.generate (Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))
obtain ⟨t, t_amalg, t_uniq⟩ :=
(Sieve.forallYonedaIsSheaf_iff_colimit S).mpr ⟨h_colim⟩ W x_ext hx_ext
refine ⟨t, ?_, ?_⟩
· convert Presieve.isAmalgamation_restrict (Sieve.le_generate
(Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))) _ _ t_amalg
exact (Presieve.restrict_extend hx).symm
· exact fun y hy ↦ t_uniq y <| Presieve.isAmalgamation_sieveExtend x y hy
/-- The regular topology on any preregular category is subcanonical. -/
theorem subcanonical [Preregular C] : Sheaf.Subcanonical (regularCoverage C).toGrothendieck :=
Sheaf.Subcanonical.of_yoneda_isSheaf _ isSheaf_yoneda_obj
end regularCoverage
end RegularSheaves
section ExtensiveSheaves
variable [FinitaryPreExtensive C] {C}
/-- A presieve is *extensive* if it is finite and its arrows induce an isomorphism from the
coproduct to the target. -/
class Presieve.extensive {X : C} (R : Presieve X) :
Prop where
/-- `R` consists of a finite collection of arrows that together induce an isomorphism from the
coproduct of their sources. -/
arrows_nonempty_isColimit : ∃ (α : Type) (_ : Fintype α) (Z : α → C) (π : (a : α) → (Z a ⟶ X)),
R = Presieve.ofArrows Z π ∧ Nonempty (IsColimit (Cofan.mk X π))
instance {X : C} (S : Presieve X) [S.extensive] : S.hasPullbacks where
has_pullbacks := by
obtain ⟨_, _, _, _, rfl, ⟨hc⟩⟩ := Presieve.extensive.arrows_nonempty_isColimit (R := S)
intro _ _ _ _ _ hg
cases hg
apply FinitaryPreExtensive.hasPullbacks_of_is_coproduct hc
instance {α : Type} [Fintype α] {Z : α → C} {F : C ⥤ Type w}
[PreservesFiniteProducts F] : PreservesLimit (Discrete.functor fun a => (Z a)) F :=
(PreservesFiniteProducts.preserves α).preservesLimit
open Presieve Opposite
/--
A finite product preserving presheaf is a sheaf for the extensive topology on a category which is
`FinitaryPreExtensive`.
-/
theorem isSheafFor_extensive_of_preservesFiniteProducts {X : C} (S : Presieve X) [S.extensive]
(F : Cᵒᵖ ⥤ Type max u v) [PreservesFiniteProducts F] : S.IsSheafFor F := by
obtain ⟨_, _, Z, π, rfl, ⟨hc⟩⟩ := extensive.arrows_nonempty_isColimit (R := S)
have : (ofArrows Z (Cofan.mk X π).inj).hasPullbacks :=
(inferInstance : (ofArrows Z π).hasPullbacks)
exact isSheafFor_of_preservesProduct _ _ hc
instance {α : Type} [Fintype α] (Z : α → C) : (ofArrows Z (fun i ↦ Sigma.ι Z i)).extensive :=
⟨⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ⟨coproductIsCoproduct _⟩⟩⟩
/--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) := by
refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩
· rw [Presieve.isSheaf_coverage] at hF
let Z : α → C := fun i ↦ unop (K.obj ⟨i⟩)
have : (Presieve.ofArrows Z (Cofan.mk (∐ Z) (Sigma.ι Z)).inj).hasPullbacks :=
(inferInstance : (Presieve.ofArrows Z (Sigma.ι Z)).hasPullbacks)
have : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i) :=
(inferInstance : ∀ (i : α), Mono (Sigma.ι Z i))
let i : K ≅ Discrete.functor (fun i ↦ op (Z i)) := Discrete.natIsoFunctor
let _ : PreservesLimit (Discrete.functor (fun i ↦ op (Z i))) F :=
Presieve.preservesProductOfIsSheafFor F ?_ initialIsInitial _ (coproductIsCoproduct Z)
(FinitaryExtensive.isPullback_initial_to_sigma_ι Z)
(hF (Presieve.ofArrows Z (fun i ↦ Sigma.ι Z i)) ?_)
· exact preservesLimitOfIsoDiagram F i.symm
· apply hF
refine ⟨Empty, inferInstance, Empty.elim, IsEmpty.elim inferInstance, rfl, ⟨default,?_, ?_⟩⟩
· ext b
| cases b | /--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) := by
refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩
· rw [Presieve.isSheaf_coverage] at hF
let Z : α → C := fun i ↦ unop (K.obj ⟨i⟩)
have : (Presieve.ofArrows Z (Cofan.mk (∐ Z) (Sigma.ι Z)).inj).hasPullbacks :=
(inferInstance : (Presieve.ofArrows Z (Sigma.ι Z)).hasPullbacks)
have : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i) :=
(inferInstance : ∀ (i : α), Mono (Sigma.ι Z i))
let i : K ≅ Discrete.functor (fun i ↦ op (Z i)) := Discrete.natIsoFunctor
let _ : PreservesLimit (Discrete.functor (fun i ↦ op (Z i))) F :=
Presieve.preservesProductOfIsSheafFor F ?_ initialIsInitial _ (coproductIsCoproduct Z)
(FinitaryExtensive.isPullback_initial_to_sigma_ι Z)
(hF (Presieve.ofArrows Z (fun i ↦ Sigma.ι Z i)) ?_)
· exact preservesLimitOfIsoDiagram F i.symm
· apply hF
refine ⟨Empty, inferInstance, Empty.elim, IsEmpty.elim inferInstance, rfl, ⟨default,?_, ?_⟩⟩
· ext b
| Mathlib.CategoryTheory.Sites.RegularExtensive.366_0.rkSRr0zuqme90Yu | /--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) | Mathlib_CategoryTheory_Sites_RegularExtensive |
case refine_1.refine_1.a.refine_2
C : Type u
inst✝² : Category.{v, u} C
inst✝¹ : FinitaryPreExtensive C
inst✝ : FinitaryExtensive C
F : Cᵒᵖ ⥤ Type (max u v)
hF : ∀ {X : C}, ∀ R ∈ Coverage.covering (extensiveCoverage C) X, IsSheafFor F R
α : Type
x✝ : Fintype α
K : Discrete α ⥤ Cᵒᵖ
Z : α → C := fun i => (K.obj { as := i }).unop
this✝ : hasPullbacks (ofArrows Z (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z))))
this : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i)
i : K ≅ Discrete.functor fun i => op (Z i) := Discrete.natIsoFunctor
⊢ (default ≫ Sigma.desc fun a => IsEmpty.elim (_ : IsEmpty Empty) a) = 𝟙 (⊥_ C) | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; cases h; infer_instance⟩ _ h
lemma isSheaf_of_projective (F : Cᵒᵖ ⥤ Type (max u v)) [Preregular C] [∀ (X : C), Projective X] :
IsSheaf (regularCoverage C).toGrothendieck F :=
(isSheaf_coverage _ _).mpr fun S ⟨_, h⟩ ↦ have : S.regular := ⟨_, h⟩
isSheafFor_regular_of_projective _ _
/-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim
intro x hx
let x_ext := Presieve.FamilyOfElements.sieveExtend x
have hx_ext := Presieve.FamilyOfElements.Compatible.sieveExtend hx
let S := Sieve.generate (Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))
obtain ⟨t, t_amalg, t_uniq⟩ :=
(Sieve.forallYonedaIsSheaf_iff_colimit S).mpr ⟨h_colim⟩ W x_ext hx_ext
refine ⟨t, ?_, ?_⟩
· convert Presieve.isAmalgamation_restrict (Sieve.le_generate
(Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))) _ _ t_amalg
exact (Presieve.restrict_extend hx).symm
· exact fun y hy ↦ t_uniq y <| Presieve.isAmalgamation_sieveExtend x y hy
/-- The regular topology on any preregular category is subcanonical. -/
theorem subcanonical [Preregular C] : Sheaf.Subcanonical (regularCoverage C).toGrothendieck :=
Sheaf.Subcanonical.of_yoneda_isSheaf _ isSheaf_yoneda_obj
end regularCoverage
end RegularSheaves
section ExtensiveSheaves
variable [FinitaryPreExtensive C] {C}
/-- A presieve is *extensive* if it is finite and its arrows induce an isomorphism from the
coproduct to the target. -/
class Presieve.extensive {X : C} (R : Presieve X) :
Prop where
/-- `R` consists of a finite collection of arrows that together induce an isomorphism from the
coproduct of their sources. -/
arrows_nonempty_isColimit : ∃ (α : Type) (_ : Fintype α) (Z : α → C) (π : (a : α) → (Z a ⟶ X)),
R = Presieve.ofArrows Z π ∧ Nonempty (IsColimit (Cofan.mk X π))
instance {X : C} (S : Presieve X) [S.extensive] : S.hasPullbacks where
has_pullbacks := by
obtain ⟨_, _, _, _, rfl, ⟨hc⟩⟩ := Presieve.extensive.arrows_nonempty_isColimit (R := S)
intro _ _ _ _ _ hg
cases hg
apply FinitaryPreExtensive.hasPullbacks_of_is_coproduct hc
instance {α : Type} [Fintype α] {Z : α → C} {F : C ⥤ Type w}
[PreservesFiniteProducts F] : PreservesLimit (Discrete.functor fun a => (Z a)) F :=
(PreservesFiniteProducts.preserves α).preservesLimit
open Presieve Opposite
/--
A finite product preserving presheaf is a sheaf for the extensive topology on a category which is
`FinitaryPreExtensive`.
-/
theorem isSheafFor_extensive_of_preservesFiniteProducts {X : C} (S : Presieve X) [S.extensive]
(F : Cᵒᵖ ⥤ Type max u v) [PreservesFiniteProducts F] : S.IsSheafFor F := by
obtain ⟨_, _, Z, π, rfl, ⟨hc⟩⟩ := extensive.arrows_nonempty_isColimit (R := S)
have : (ofArrows Z (Cofan.mk X π).inj).hasPullbacks :=
(inferInstance : (ofArrows Z π).hasPullbacks)
exact isSheafFor_of_preservesProduct _ _ hc
instance {α : Type} [Fintype α] (Z : α → C) : (ofArrows Z (fun i ↦ Sigma.ι Z i)).extensive :=
⟨⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ⟨coproductIsCoproduct _⟩⟩⟩
/--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) := by
refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩
· rw [Presieve.isSheaf_coverage] at hF
let Z : α → C := fun i ↦ unop (K.obj ⟨i⟩)
have : (Presieve.ofArrows Z (Cofan.mk (∐ Z) (Sigma.ι Z)).inj).hasPullbacks :=
(inferInstance : (Presieve.ofArrows Z (Sigma.ι Z)).hasPullbacks)
have : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i) :=
(inferInstance : ∀ (i : α), Mono (Sigma.ι Z i))
let i : K ≅ Discrete.functor (fun i ↦ op (Z i)) := Discrete.natIsoFunctor
let _ : PreservesLimit (Discrete.functor (fun i ↦ op (Z i))) F :=
Presieve.preservesProductOfIsSheafFor F ?_ initialIsInitial _ (coproductIsCoproduct Z)
(FinitaryExtensive.isPullback_initial_to_sigma_ι Z)
(hF (Presieve.ofArrows Z (fun i ↦ Sigma.ι Z i)) ?_)
· exact preservesLimitOfIsoDiagram F i.symm
· apply hF
refine ⟨Empty, inferInstance, Empty.elim, IsEmpty.elim inferInstance, rfl, ⟨default,?_, ?_⟩⟩
· ext b
cases b
· | simp only [eq_iff_true_of_subsingleton] | /--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) := by
refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩
· rw [Presieve.isSheaf_coverage] at hF
let Z : α → C := fun i ↦ unop (K.obj ⟨i⟩)
have : (Presieve.ofArrows Z (Cofan.mk (∐ Z) (Sigma.ι Z)).inj).hasPullbacks :=
(inferInstance : (Presieve.ofArrows Z (Sigma.ι Z)).hasPullbacks)
have : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i) :=
(inferInstance : ∀ (i : α), Mono (Sigma.ι Z i))
let i : K ≅ Discrete.functor (fun i ↦ op (Z i)) := Discrete.natIsoFunctor
let _ : PreservesLimit (Discrete.functor (fun i ↦ op (Z i))) F :=
Presieve.preservesProductOfIsSheafFor F ?_ initialIsInitial _ (coproductIsCoproduct Z)
(FinitaryExtensive.isPullback_initial_to_sigma_ι Z)
(hF (Presieve.ofArrows Z (fun i ↦ Sigma.ι Z i)) ?_)
· exact preservesLimitOfIsoDiagram F i.symm
· apply hF
refine ⟨Empty, inferInstance, Empty.elim, IsEmpty.elim inferInstance, rfl, ⟨default,?_, ?_⟩⟩
· ext b
cases b
· | Mathlib.CategoryTheory.Sites.RegularExtensive.366_0.rkSRr0zuqme90Yu | /--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) | Mathlib_CategoryTheory_Sites_RegularExtensive |
case refine_1.refine_2
C : Type u
inst✝² : Category.{v, u} C
inst✝¹ : FinitaryPreExtensive C
inst✝ : FinitaryExtensive C
F : Cᵒᵖ ⥤ Type (max u v)
hF : ∀ {X : C}, ∀ R ∈ Coverage.covering (extensiveCoverage C) X, IsSheafFor F R
α : Type
x✝ : Fintype α
K : Discrete α ⥤ Cᵒᵖ
Z : α → C := fun i => (K.obj { as := i }).unop
this✝ : hasPullbacks (ofArrows Z (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z))))
this : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i)
i : K ≅ Discrete.functor fun i => op (Z i) := Discrete.natIsoFunctor
⊢ (ofArrows Z fun i => Sigma.ι Z i) ∈ Coverage.covering (extensiveCoverage C) (∐ Z) | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; cases h; infer_instance⟩ _ h
lemma isSheaf_of_projective (F : Cᵒᵖ ⥤ Type (max u v)) [Preregular C] [∀ (X : C), Projective X] :
IsSheaf (regularCoverage C).toGrothendieck F :=
(isSheaf_coverage _ _).mpr fun S ⟨_, h⟩ ↦ have : S.regular := ⟨_, h⟩
isSheafFor_regular_of_projective _ _
/-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim
intro x hx
let x_ext := Presieve.FamilyOfElements.sieveExtend x
have hx_ext := Presieve.FamilyOfElements.Compatible.sieveExtend hx
let S := Sieve.generate (Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))
obtain ⟨t, t_amalg, t_uniq⟩ :=
(Sieve.forallYonedaIsSheaf_iff_colimit S).mpr ⟨h_colim⟩ W x_ext hx_ext
refine ⟨t, ?_, ?_⟩
· convert Presieve.isAmalgamation_restrict (Sieve.le_generate
(Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))) _ _ t_amalg
exact (Presieve.restrict_extend hx).symm
· exact fun y hy ↦ t_uniq y <| Presieve.isAmalgamation_sieveExtend x y hy
/-- The regular topology on any preregular category is subcanonical. -/
theorem subcanonical [Preregular C] : Sheaf.Subcanonical (regularCoverage C).toGrothendieck :=
Sheaf.Subcanonical.of_yoneda_isSheaf _ isSheaf_yoneda_obj
end regularCoverage
end RegularSheaves
section ExtensiveSheaves
variable [FinitaryPreExtensive C] {C}
/-- A presieve is *extensive* if it is finite and its arrows induce an isomorphism from the
coproduct to the target. -/
class Presieve.extensive {X : C} (R : Presieve X) :
Prop where
/-- `R` consists of a finite collection of arrows that together induce an isomorphism from the
coproduct of their sources. -/
arrows_nonempty_isColimit : ∃ (α : Type) (_ : Fintype α) (Z : α → C) (π : (a : α) → (Z a ⟶ X)),
R = Presieve.ofArrows Z π ∧ Nonempty (IsColimit (Cofan.mk X π))
instance {X : C} (S : Presieve X) [S.extensive] : S.hasPullbacks where
has_pullbacks := by
obtain ⟨_, _, _, _, rfl, ⟨hc⟩⟩ := Presieve.extensive.arrows_nonempty_isColimit (R := S)
intro _ _ _ _ _ hg
cases hg
apply FinitaryPreExtensive.hasPullbacks_of_is_coproduct hc
instance {α : Type} [Fintype α] {Z : α → C} {F : C ⥤ Type w}
[PreservesFiniteProducts F] : PreservesLimit (Discrete.functor fun a => (Z a)) F :=
(PreservesFiniteProducts.preserves α).preservesLimit
open Presieve Opposite
/--
A finite product preserving presheaf is a sheaf for the extensive topology on a category which is
`FinitaryPreExtensive`.
-/
theorem isSheafFor_extensive_of_preservesFiniteProducts {X : C} (S : Presieve X) [S.extensive]
(F : Cᵒᵖ ⥤ Type max u v) [PreservesFiniteProducts F] : S.IsSheafFor F := by
obtain ⟨_, _, Z, π, rfl, ⟨hc⟩⟩ := extensive.arrows_nonempty_isColimit (R := S)
have : (ofArrows Z (Cofan.mk X π).inj).hasPullbacks :=
(inferInstance : (ofArrows Z π).hasPullbacks)
exact isSheafFor_of_preservesProduct _ _ hc
instance {α : Type} [Fintype α] (Z : α → C) : (ofArrows Z (fun i ↦ Sigma.ι Z i)).extensive :=
⟨⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ⟨coproductIsCoproduct _⟩⟩⟩
/--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) := by
refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩
· rw [Presieve.isSheaf_coverage] at hF
let Z : α → C := fun i ↦ unop (K.obj ⟨i⟩)
have : (Presieve.ofArrows Z (Cofan.mk (∐ Z) (Sigma.ι Z)).inj).hasPullbacks :=
(inferInstance : (Presieve.ofArrows Z (Sigma.ι Z)).hasPullbacks)
have : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i) :=
(inferInstance : ∀ (i : α), Mono (Sigma.ι Z i))
let i : K ≅ Discrete.functor (fun i ↦ op (Z i)) := Discrete.natIsoFunctor
let _ : PreservesLimit (Discrete.functor (fun i ↦ op (Z i))) F :=
Presieve.preservesProductOfIsSheafFor F ?_ initialIsInitial _ (coproductIsCoproduct Z)
(FinitaryExtensive.isPullback_initial_to_sigma_ι Z)
(hF (Presieve.ofArrows Z (fun i ↦ Sigma.ι Z i)) ?_)
· exact preservesLimitOfIsoDiagram F i.symm
· apply hF
refine ⟨Empty, inferInstance, Empty.elim, IsEmpty.elim inferInstance, rfl, ⟨default,?_, ?_⟩⟩
· ext b
cases b
· simp only [eq_iff_true_of_subsingleton]
· | refine ⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ?_⟩ | /--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) := by
refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩
· rw [Presieve.isSheaf_coverage] at hF
let Z : α → C := fun i ↦ unop (K.obj ⟨i⟩)
have : (Presieve.ofArrows Z (Cofan.mk (∐ Z) (Sigma.ι Z)).inj).hasPullbacks :=
(inferInstance : (Presieve.ofArrows Z (Sigma.ι Z)).hasPullbacks)
have : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i) :=
(inferInstance : ∀ (i : α), Mono (Sigma.ι Z i))
let i : K ≅ Discrete.functor (fun i ↦ op (Z i)) := Discrete.natIsoFunctor
let _ : PreservesLimit (Discrete.functor (fun i ↦ op (Z i))) F :=
Presieve.preservesProductOfIsSheafFor F ?_ initialIsInitial _ (coproductIsCoproduct Z)
(FinitaryExtensive.isPullback_initial_to_sigma_ι Z)
(hF (Presieve.ofArrows Z (fun i ↦ Sigma.ι Z i)) ?_)
· exact preservesLimitOfIsoDiagram F i.symm
· apply hF
refine ⟨Empty, inferInstance, Empty.elim, IsEmpty.elim inferInstance, rfl, ⟨default,?_, ?_⟩⟩
· ext b
cases b
· simp only [eq_iff_true_of_subsingleton]
· | Mathlib.CategoryTheory.Sites.RegularExtensive.366_0.rkSRr0zuqme90Yu | /--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) | Mathlib_CategoryTheory_Sites_RegularExtensive |
case refine_1.refine_2
C : Type u
inst✝² : Category.{v, u} C
inst✝¹ : FinitaryPreExtensive C
inst✝ : FinitaryExtensive C
F : Cᵒᵖ ⥤ Type (max u v)
hF : ∀ {X : C}, ∀ R ∈ Coverage.covering (extensiveCoverage C) X, IsSheafFor F R
α : Type
x✝ : Fintype α
K : Discrete α ⥤ Cᵒᵖ
Z : α → C := fun i => (K.obj { as := i }).unop
this✝ : hasPullbacks (ofArrows Z (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z))))
this : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i)
i : K ≅ Discrete.functor fun i => op (Z i) := Discrete.natIsoFunctor
⊢ IsIso (Sigma.desc fun i => Sigma.ι Z i) | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; cases h; infer_instance⟩ _ h
lemma isSheaf_of_projective (F : Cᵒᵖ ⥤ Type (max u v)) [Preregular C] [∀ (X : C), Projective X] :
IsSheaf (regularCoverage C).toGrothendieck F :=
(isSheaf_coverage _ _).mpr fun S ⟨_, h⟩ ↦ have : S.regular := ⟨_, h⟩
isSheafFor_regular_of_projective _ _
/-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim
intro x hx
let x_ext := Presieve.FamilyOfElements.sieveExtend x
have hx_ext := Presieve.FamilyOfElements.Compatible.sieveExtend hx
let S := Sieve.generate (Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))
obtain ⟨t, t_amalg, t_uniq⟩ :=
(Sieve.forallYonedaIsSheaf_iff_colimit S).mpr ⟨h_colim⟩ W x_ext hx_ext
refine ⟨t, ?_, ?_⟩
· convert Presieve.isAmalgamation_restrict (Sieve.le_generate
(Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))) _ _ t_amalg
exact (Presieve.restrict_extend hx).symm
· exact fun y hy ↦ t_uniq y <| Presieve.isAmalgamation_sieveExtend x y hy
/-- The regular topology on any preregular category is subcanonical. -/
theorem subcanonical [Preregular C] : Sheaf.Subcanonical (regularCoverage C).toGrothendieck :=
Sheaf.Subcanonical.of_yoneda_isSheaf _ isSheaf_yoneda_obj
end regularCoverage
end RegularSheaves
section ExtensiveSheaves
variable [FinitaryPreExtensive C] {C}
/-- A presieve is *extensive* if it is finite and its arrows induce an isomorphism from the
coproduct to the target. -/
class Presieve.extensive {X : C} (R : Presieve X) :
Prop where
/-- `R` consists of a finite collection of arrows that together induce an isomorphism from the
coproduct of their sources. -/
arrows_nonempty_isColimit : ∃ (α : Type) (_ : Fintype α) (Z : α → C) (π : (a : α) → (Z a ⟶ X)),
R = Presieve.ofArrows Z π ∧ Nonempty (IsColimit (Cofan.mk X π))
instance {X : C} (S : Presieve X) [S.extensive] : S.hasPullbacks where
has_pullbacks := by
obtain ⟨_, _, _, _, rfl, ⟨hc⟩⟩ := Presieve.extensive.arrows_nonempty_isColimit (R := S)
intro _ _ _ _ _ hg
cases hg
apply FinitaryPreExtensive.hasPullbacks_of_is_coproduct hc
instance {α : Type} [Fintype α] {Z : α → C} {F : C ⥤ Type w}
[PreservesFiniteProducts F] : PreservesLimit (Discrete.functor fun a => (Z a)) F :=
(PreservesFiniteProducts.preserves α).preservesLimit
open Presieve Opposite
/--
A finite product preserving presheaf is a sheaf for the extensive topology on a category which is
`FinitaryPreExtensive`.
-/
theorem isSheafFor_extensive_of_preservesFiniteProducts {X : C} (S : Presieve X) [S.extensive]
(F : Cᵒᵖ ⥤ Type max u v) [PreservesFiniteProducts F] : S.IsSheafFor F := by
obtain ⟨_, _, Z, π, rfl, ⟨hc⟩⟩ := extensive.arrows_nonempty_isColimit (R := S)
have : (ofArrows Z (Cofan.mk X π).inj).hasPullbacks :=
(inferInstance : (ofArrows Z π).hasPullbacks)
exact isSheafFor_of_preservesProduct _ _ hc
instance {α : Type} [Fintype α] (Z : α → C) : (ofArrows Z (fun i ↦ Sigma.ι Z i)).extensive :=
⟨⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ⟨coproductIsCoproduct _⟩⟩⟩
/--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) := by
refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩
· rw [Presieve.isSheaf_coverage] at hF
let Z : α → C := fun i ↦ unop (K.obj ⟨i⟩)
have : (Presieve.ofArrows Z (Cofan.mk (∐ Z) (Sigma.ι Z)).inj).hasPullbacks :=
(inferInstance : (Presieve.ofArrows Z (Sigma.ι Z)).hasPullbacks)
have : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i) :=
(inferInstance : ∀ (i : α), Mono (Sigma.ι Z i))
let i : K ≅ Discrete.functor (fun i ↦ op (Z i)) := Discrete.natIsoFunctor
let _ : PreservesLimit (Discrete.functor (fun i ↦ op (Z i))) F :=
Presieve.preservesProductOfIsSheafFor F ?_ initialIsInitial _ (coproductIsCoproduct Z)
(FinitaryExtensive.isPullback_initial_to_sigma_ι Z)
(hF (Presieve.ofArrows Z (fun i ↦ Sigma.ι Z i)) ?_)
· exact preservesLimitOfIsoDiagram F i.symm
· apply hF
refine ⟨Empty, inferInstance, Empty.elim, IsEmpty.elim inferInstance, rfl, ⟨default,?_, ?_⟩⟩
· ext b
cases b
· simp only [eq_iff_true_of_subsingleton]
· refine ⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ?_⟩
| suffices Sigma.desc (fun i ↦ Sigma.ι Z i) = 𝟙 _ by rw [this]; infer_instance | /--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) := by
refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩
· rw [Presieve.isSheaf_coverage] at hF
let Z : α → C := fun i ↦ unop (K.obj ⟨i⟩)
have : (Presieve.ofArrows Z (Cofan.mk (∐ Z) (Sigma.ι Z)).inj).hasPullbacks :=
(inferInstance : (Presieve.ofArrows Z (Sigma.ι Z)).hasPullbacks)
have : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i) :=
(inferInstance : ∀ (i : α), Mono (Sigma.ι Z i))
let i : K ≅ Discrete.functor (fun i ↦ op (Z i)) := Discrete.natIsoFunctor
let _ : PreservesLimit (Discrete.functor (fun i ↦ op (Z i))) F :=
Presieve.preservesProductOfIsSheafFor F ?_ initialIsInitial _ (coproductIsCoproduct Z)
(FinitaryExtensive.isPullback_initial_to_sigma_ι Z)
(hF (Presieve.ofArrows Z (fun i ↦ Sigma.ι Z i)) ?_)
· exact preservesLimitOfIsoDiagram F i.symm
· apply hF
refine ⟨Empty, inferInstance, Empty.elim, IsEmpty.elim inferInstance, rfl, ⟨default,?_, ?_⟩⟩
· ext b
cases b
· simp only [eq_iff_true_of_subsingleton]
· refine ⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ?_⟩
| Mathlib.CategoryTheory.Sites.RegularExtensive.366_0.rkSRr0zuqme90Yu | /--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) | Mathlib_CategoryTheory_Sites_RegularExtensive |
C : Type u
inst✝² : Category.{v, u} C
inst✝¹ : FinitaryPreExtensive C
inst✝ : FinitaryExtensive C
F : Cᵒᵖ ⥤ Type (max u v)
hF : ∀ {X : C}, ∀ R ∈ Coverage.covering (extensiveCoverage C) X, IsSheafFor F R
α : Type
x✝ : Fintype α
K : Discrete α ⥤ Cᵒᵖ
Z : α → C := fun i => (K.obj { as := i }).unop
this✝¹ : hasPullbacks (ofArrows Z (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z))))
this✝ : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i)
i : K ≅ Discrete.functor fun i => op (Z i) := Discrete.natIsoFunctor
this : (Sigma.desc fun i => Sigma.ι Z i) = 𝟙 (∐ fun i => Z i)
⊢ IsIso (Sigma.desc fun i => Sigma.ι Z i) | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; cases h; infer_instance⟩ _ h
lemma isSheaf_of_projective (F : Cᵒᵖ ⥤ Type (max u v)) [Preregular C] [∀ (X : C), Projective X] :
IsSheaf (regularCoverage C).toGrothendieck F :=
(isSheaf_coverage _ _).mpr fun S ⟨_, h⟩ ↦ have : S.regular := ⟨_, h⟩
isSheafFor_regular_of_projective _ _
/-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim
intro x hx
let x_ext := Presieve.FamilyOfElements.sieveExtend x
have hx_ext := Presieve.FamilyOfElements.Compatible.sieveExtend hx
let S := Sieve.generate (Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))
obtain ⟨t, t_amalg, t_uniq⟩ :=
(Sieve.forallYonedaIsSheaf_iff_colimit S).mpr ⟨h_colim⟩ W x_ext hx_ext
refine ⟨t, ?_, ?_⟩
· convert Presieve.isAmalgamation_restrict (Sieve.le_generate
(Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))) _ _ t_amalg
exact (Presieve.restrict_extend hx).symm
· exact fun y hy ↦ t_uniq y <| Presieve.isAmalgamation_sieveExtend x y hy
/-- The regular topology on any preregular category is subcanonical. -/
theorem subcanonical [Preregular C] : Sheaf.Subcanonical (regularCoverage C).toGrothendieck :=
Sheaf.Subcanonical.of_yoneda_isSheaf _ isSheaf_yoneda_obj
end regularCoverage
end RegularSheaves
section ExtensiveSheaves
variable [FinitaryPreExtensive C] {C}
/-- A presieve is *extensive* if it is finite and its arrows induce an isomorphism from the
coproduct to the target. -/
class Presieve.extensive {X : C} (R : Presieve X) :
Prop where
/-- `R` consists of a finite collection of arrows that together induce an isomorphism from the
coproduct of their sources. -/
arrows_nonempty_isColimit : ∃ (α : Type) (_ : Fintype α) (Z : α → C) (π : (a : α) → (Z a ⟶ X)),
R = Presieve.ofArrows Z π ∧ Nonempty (IsColimit (Cofan.mk X π))
instance {X : C} (S : Presieve X) [S.extensive] : S.hasPullbacks where
has_pullbacks := by
obtain ⟨_, _, _, _, rfl, ⟨hc⟩⟩ := Presieve.extensive.arrows_nonempty_isColimit (R := S)
intro _ _ _ _ _ hg
cases hg
apply FinitaryPreExtensive.hasPullbacks_of_is_coproduct hc
instance {α : Type} [Fintype α] {Z : α → C} {F : C ⥤ Type w}
[PreservesFiniteProducts F] : PreservesLimit (Discrete.functor fun a => (Z a)) F :=
(PreservesFiniteProducts.preserves α).preservesLimit
open Presieve Opposite
/--
A finite product preserving presheaf is a sheaf for the extensive topology on a category which is
`FinitaryPreExtensive`.
-/
theorem isSheafFor_extensive_of_preservesFiniteProducts {X : C} (S : Presieve X) [S.extensive]
(F : Cᵒᵖ ⥤ Type max u v) [PreservesFiniteProducts F] : S.IsSheafFor F := by
obtain ⟨_, _, Z, π, rfl, ⟨hc⟩⟩ := extensive.arrows_nonempty_isColimit (R := S)
have : (ofArrows Z (Cofan.mk X π).inj).hasPullbacks :=
(inferInstance : (ofArrows Z π).hasPullbacks)
exact isSheafFor_of_preservesProduct _ _ hc
instance {α : Type} [Fintype α] (Z : α → C) : (ofArrows Z (fun i ↦ Sigma.ι Z i)).extensive :=
⟨⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ⟨coproductIsCoproduct _⟩⟩⟩
/--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) := by
refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩
· rw [Presieve.isSheaf_coverage] at hF
let Z : α → C := fun i ↦ unop (K.obj ⟨i⟩)
have : (Presieve.ofArrows Z (Cofan.mk (∐ Z) (Sigma.ι Z)).inj).hasPullbacks :=
(inferInstance : (Presieve.ofArrows Z (Sigma.ι Z)).hasPullbacks)
have : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i) :=
(inferInstance : ∀ (i : α), Mono (Sigma.ι Z i))
let i : K ≅ Discrete.functor (fun i ↦ op (Z i)) := Discrete.natIsoFunctor
let _ : PreservesLimit (Discrete.functor (fun i ↦ op (Z i))) F :=
Presieve.preservesProductOfIsSheafFor F ?_ initialIsInitial _ (coproductIsCoproduct Z)
(FinitaryExtensive.isPullback_initial_to_sigma_ι Z)
(hF (Presieve.ofArrows Z (fun i ↦ Sigma.ι Z i)) ?_)
· exact preservesLimitOfIsoDiagram F i.symm
· apply hF
refine ⟨Empty, inferInstance, Empty.elim, IsEmpty.elim inferInstance, rfl, ⟨default,?_, ?_⟩⟩
· ext b
cases b
· simp only [eq_iff_true_of_subsingleton]
· refine ⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ?_⟩
suffices Sigma.desc (fun i ↦ Sigma.ι Z i) = 𝟙 _ by | rw [this] | /--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) := by
refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩
· rw [Presieve.isSheaf_coverage] at hF
let Z : α → C := fun i ↦ unop (K.obj ⟨i⟩)
have : (Presieve.ofArrows Z (Cofan.mk (∐ Z) (Sigma.ι Z)).inj).hasPullbacks :=
(inferInstance : (Presieve.ofArrows Z (Sigma.ι Z)).hasPullbacks)
have : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i) :=
(inferInstance : ∀ (i : α), Mono (Sigma.ι Z i))
let i : K ≅ Discrete.functor (fun i ↦ op (Z i)) := Discrete.natIsoFunctor
let _ : PreservesLimit (Discrete.functor (fun i ↦ op (Z i))) F :=
Presieve.preservesProductOfIsSheafFor F ?_ initialIsInitial _ (coproductIsCoproduct Z)
(FinitaryExtensive.isPullback_initial_to_sigma_ι Z)
(hF (Presieve.ofArrows Z (fun i ↦ Sigma.ι Z i)) ?_)
· exact preservesLimitOfIsoDiagram F i.symm
· apply hF
refine ⟨Empty, inferInstance, Empty.elim, IsEmpty.elim inferInstance, rfl, ⟨default,?_, ?_⟩⟩
· ext b
cases b
· simp only [eq_iff_true_of_subsingleton]
· refine ⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ?_⟩
suffices Sigma.desc (fun i ↦ Sigma.ι Z i) = 𝟙 _ by | Mathlib.CategoryTheory.Sites.RegularExtensive.366_0.rkSRr0zuqme90Yu | /--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) | Mathlib_CategoryTheory_Sites_RegularExtensive |
C : Type u
inst✝² : Category.{v, u} C
inst✝¹ : FinitaryPreExtensive C
inst✝ : FinitaryExtensive C
F : Cᵒᵖ ⥤ Type (max u v)
hF : ∀ {X : C}, ∀ R ∈ Coverage.covering (extensiveCoverage C) X, IsSheafFor F R
α : Type
x✝ : Fintype α
K : Discrete α ⥤ Cᵒᵖ
Z : α → C := fun i => (K.obj { as := i }).unop
this✝¹ : hasPullbacks (ofArrows Z (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z))))
this✝ : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i)
i : K ≅ Discrete.functor fun i => op (Z i) := Discrete.natIsoFunctor
this : (Sigma.desc fun i => Sigma.ι Z i) = 𝟙 (∐ fun i => Z i)
⊢ IsIso (𝟙 (∐ fun i => Z i)) | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; cases h; infer_instance⟩ _ h
lemma isSheaf_of_projective (F : Cᵒᵖ ⥤ Type (max u v)) [Preregular C] [∀ (X : C), Projective X] :
IsSheaf (regularCoverage C).toGrothendieck F :=
(isSheaf_coverage _ _).mpr fun S ⟨_, h⟩ ↦ have : S.regular := ⟨_, h⟩
isSheafFor_regular_of_projective _ _
/-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim
intro x hx
let x_ext := Presieve.FamilyOfElements.sieveExtend x
have hx_ext := Presieve.FamilyOfElements.Compatible.sieveExtend hx
let S := Sieve.generate (Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))
obtain ⟨t, t_amalg, t_uniq⟩ :=
(Sieve.forallYonedaIsSheaf_iff_colimit S).mpr ⟨h_colim⟩ W x_ext hx_ext
refine ⟨t, ?_, ?_⟩
· convert Presieve.isAmalgamation_restrict (Sieve.le_generate
(Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))) _ _ t_amalg
exact (Presieve.restrict_extend hx).symm
· exact fun y hy ↦ t_uniq y <| Presieve.isAmalgamation_sieveExtend x y hy
/-- The regular topology on any preregular category is subcanonical. -/
theorem subcanonical [Preregular C] : Sheaf.Subcanonical (regularCoverage C).toGrothendieck :=
Sheaf.Subcanonical.of_yoneda_isSheaf _ isSheaf_yoneda_obj
end regularCoverage
end RegularSheaves
section ExtensiveSheaves
variable [FinitaryPreExtensive C] {C}
/-- A presieve is *extensive* if it is finite and its arrows induce an isomorphism from the
coproduct to the target. -/
class Presieve.extensive {X : C} (R : Presieve X) :
Prop where
/-- `R` consists of a finite collection of arrows that together induce an isomorphism from the
coproduct of their sources. -/
arrows_nonempty_isColimit : ∃ (α : Type) (_ : Fintype α) (Z : α → C) (π : (a : α) → (Z a ⟶ X)),
R = Presieve.ofArrows Z π ∧ Nonempty (IsColimit (Cofan.mk X π))
instance {X : C} (S : Presieve X) [S.extensive] : S.hasPullbacks where
has_pullbacks := by
obtain ⟨_, _, _, _, rfl, ⟨hc⟩⟩ := Presieve.extensive.arrows_nonempty_isColimit (R := S)
intro _ _ _ _ _ hg
cases hg
apply FinitaryPreExtensive.hasPullbacks_of_is_coproduct hc
instance {α : Type} [Fintype α] {Z : α → C} {F : C ⥤ Type w}
[PreservesFiniteProducts F] : PreservesLimit (Discrete.functor fun a => (Z a)) F :=
(PreservesFiniteProducts.preserves α).preservesLimit
open Presieve Opposite
/--
A finite product preserving presheaf is a sheaf for the extensive topology on a category which is
`FinitaryPreExtensive`.
-/
theorem isSheafFor_extensive_of_preservesFiniteProducts {X : C} (S : Presieve X) [S.extensive]
(F : Cᵒᵖ ⥤ Type max u v) [PreservesFiniteProducts F] : S.IsSheafFor F := by
obtain ⟨_, _, Z, π, rfl, ⟨hc⟩⟩ := extensive.arrows_nonempty_isColimit (R := S)
have : (ofArrows Z (Cofan.mk X π).inj).hasPullbacks :=
(inferInstance : (ofArrows Z π).hasPullbacks)
exact isSheafFor_of_preservesProduct _ _ hc
instance {α : Type} [Fintype α] (Z : α → C) : (ofArrows Z (fun i ↦ Sigma.ι Z i)).extensive :=
⟨⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ⟨coproductIsCoproduct _⟩⟩⟩
/--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) := by
refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩
· rw [Presieve.isSheaf_coverage] at hF
let Z : α → C := fun i ↦ unop (K.obj ⟨i⟩)
have : (Presieve.ofArrows Z (Cofan.mk (∐ Z) (Sigma.ι Z)).inj).hasPullbacks :=
(inferInstance : (Presieve.ofArrows Z (Sigma.ι Z)).hasPullbacks)
have : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i) :=
(inferInstance : ∀ (i : α), Mono (Sigma.ι Z i))
let i : K ≅ Discrete.functor (fun i ↦ op (Z i)) := Discrete.natIsoFunctor
let _ : PreservesLimit (Discrete.functor (fun i ↦ op (Z i))) F :=
Presieve.preservesProductOfIsSheafFor F ?_ initialIsInitial _ (coproductIsCoproduct Z)
(FinitaryExtensive.isPullback_initial_to_sigma_ι Z)
(hF (Presieve.ofArrows Z (fun i ↦ Sigma.ι Z i)) ?_)
· exact preservesLimitOfIsoDiagram F i.symm
· apply hF
refine ⟨Empty, inferInstance, Empty.elim, IsEmpty.elim inferInstance, rfl, ⟨default,?_, ?_⟩⟩
· ext b
cases b
· simp only [eq_iff_true_of_subsingleton]
· refine ⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ?_⟩
suffices Sigma.desc (fun i ↦ Sigma.ι Z i) = 𝟙 _ by rw [this]; | infer_instance | /--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) := by
refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩
· rw [Presieve.isSheaf_coverage] at hF
let Z : α → C := fun i ↦ unop (K.obj ⟨i⟩)
have : (Presieve.ofArrows Z (Cofan.mk (∐ Z) (Sigma.ι Z)).inj).hasPullbacks :=
(inferInstance : (Presieve.ofArrows Z (Sigma.ι Z)).hasPullbacks)
have : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i) :=
(inferInstance : ∀ (i : α), Mono (Sigma.ι Z i))
let i : K ≅ Discrete.functor (fun i ↦ op (Z i)) := Discrete.natIsoFunctor
let _ : PreservesLimit (Discrete.functor (fun i ↦ op (Z i))) F :=
Presieve.preservesProductOfIsSheafFor F ?_ initialIsInitial _ (coproductIsCoproduct Z)
(FinitaryExtensive.isPullback_initial_to_sigma_ι Z)
(hF (Presieve.ofArrows Z (fun i ↦ Sigma.ι Z i)) ?_)
· exact preservesLimitOfIsoDiagram F i.symm
· apply hF
refine ⟨Empty, inferInstance, Empty.elim, IsEmpty.elim inferInstance, rfl, ⟨default,?_, ?_⟩⟩
· ext b
cases b
· simp only [eq_iff_true_of_subsingleton]
· refine ⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ?_⟩
suffices Sigma.desc (fun i ↦ Sigma.ι Z i) = 𝟙 _ by rw [this]; | Mathlib.CategoryTheory.Sites.RegularExtensive.366_0.rkSRr0zuqme90Yu | /--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) | Mathlib_CategoryTheory_Sites_RegularExtensive |
case refine_1.refine_2
C : Type u
inst✝² : Category.{v, u} C
inst✝¹ : FinitaryPreExtensive C
inst✝ : FinitaryExtensive C
F : Cᵒᵖ ⥤ Type (max u v)
hF : ∀ {X : C}, ∀ R ∈ Coverage.covering (extensiveCoverage C) X, IsSheafFor F R
α : Type
x✝ : Fintype α
K : Discrete α ⥤ Cᵒᵖ
Z : α → C := fun i => (K.obj { as := i }).unop
this✝ : hasPullbacks (ofArrows Z (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z))))
this : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i)
i : K ≅ Discrete.functor fun i => op (Z i) := Discrete.natIsoFunctor
⊢ (Sigma.desc fun i => Sigma.ι Z i) = 𝟙 (∐ fun i => Z i) | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; cases h; infer_instance⟩ _ h
lemma isSheaf_of_projective (F : Cᵒᵖ ⥤ Type (max u v)) [Preregular C] [∀ (X : C), Projective X] :
IsSheaf (regularCoverage C).toGrothendieck F :=
(isSheaf_coverage _ _).mpr fun S ⟨_, h⟩ ↦ have : S.regular := ⟨_, h⟩
isSheafFor_regular_of_projective _ _
/-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim
intro x hx
let x_ext := Presieve.FamilyOfElements.sieveExtend x
have hx_ext := Presieve.FamilyOfElements.Compatible.sieveExtend hx
let S := Sieve.generate (Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))
obtain ⟨t, t_amalg, t_uniq⟩ :=
(Sieve.forallYonedaIsSheaf_iff_colimit S).mpr ⟨h_colim⟩ W x_ext hx_ext
refine ⟨t, ?_, ?_⟩
· convert Presieve.isAmalgamation_restrict (Sieve.le_generate
(Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))) _ _ t_amalg
exact (Presieve.restrict_extend hx).symm
· exact fun y hy ↦ t_uniq y <| Presieve.isAmalgamation_sieveExtend x y hy
/-- The regular topology on any preregular category is subcanonical. -/
theorem subcanonical [Preregular C] : Sheaf.Subcanonical (regularCoverage C).toGrothendieck :=
Sheaf.Subcanonical.of_yoneda_isSheaf _ isSheaf_yoneda_obj
end regularCoverage
end RegularSheaves
section ExtensiveSheaves
variable [FinitaryPreExtensive C] {C}
/-- A presieve is *extensive* if it is finite and its arrows induce an isomorphism from the
coproduct to the target. -/
class Presieve.extensive {X : C} (R : Presieve X) :
Prop where
/-- `R` consists of a finite collection of arrows that together induce an isomorphism from the
coproduct of their sources. -/
arrows_nonempty_isColimit : ∃ (α : Type) (_ : Fintype α) (Z : α → C) (π : (a : α) → (Z a ⟶ X)),
R = Presieve.ofArrows Z π ∧ Nonempty (IsColimit (Cofan.mk X π))
instance {X : C} (S : Presieve X) [S.extensive] : S.hasPullbacks where
has_pullbacks := by
obtain ⟨_, _, _, _, rfl, ⟨hc⟩⟩ := Presieve.extensive.arrows_nonempty_isColimit (R := S)
intro _ _ _ _ _ hg
cases hg
apply FinitaryPreExtensive.hasPullbacks_of_is_coproduct hc
instance {α : Type} [Fintype α] {Z : α → C} {F : C ⥤ Type w}
[PreservesFiniteProducts F] : PreservesLimit (Discrete.functor fun a => (Z a)) F :=
(PreservesFiniteProducts.preserves α).preservesLimit
open Presieve Opposite
/--
A finite product preserving presheaf is a sheaf for the extensive topology on a category which is
`FinitaryPreExtensive`.
-/
theorem isSheafFor_extensive_of_preservesFiniteProducts {X : C} (S : Presieve X) [S.extensive]
(F : Cᵒᵖ ⥤ Type max u v) [PreservesFiniteProducts F] : S.IsSheafFor F := by
obtain ⟨_, _, Z, π, rfl, ⟨hc⟩⟩ := extensive.arrows_nonempty_isColimit (R := S)
have : (ofArrows Z (Cofan.mk X π).inj).hasPullbacks :=
(inferInstance : (ofArrows Z π).hasPullbacks)
exact isSheafFor_of_preservesProduct _ _ hc
instance {α : Type} [Fintype α] (Z : α → C) : (ofArrows Z (fun i ↦ Sigma.ι Z i)).extensive :=
⟨⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ⟨coproductIsCoproduct _⟩⟩⟩
/--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) := by
refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩
· rw [Presieve.isSheaf_coverage] at hF
let Z : α → C := fun i ↦ unop (K.obj ⟨i⟩)
have : (Presieve.ofArrows Z (Cofan.mk (∐ Z) (Sigma.ι Z)).inj).hasPullbacks :=
(inferInstance : (Presieve.ofArrows Z (Sigma.ι Z)).hasPullbacks)
have : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i) :=
(inferInstance : ∀ (i : α), Mono (Sigma.ι Z i))
let i : K ≅ Discrete.functor (fun i ↦ op (Z i)) := Discrete.natIsoFunctor
let _ : PreservesLimit (Discrete.functor (fun i ↦ op (Z i))) F :=
Presieve.preservesProductOfIsSheafFor F ?_ initialIsInitial _ (coproductIsCoproduct Z)
(FinitaryExtensive.isPullback_initial_to_sigma_ι Z)
(hF (Presieve.ofArrows Z (fun i ↦ Sigma.ι Z i)) ?_)
· exact preservesLimitOfIsoDiagram F i.symm
· apply hF
refine ⟨Empty, inferInstance, Empty.elim, IsEmpty.elim inferInstance, rfl, ⟨default,?_, ?_⟩⟩
· ext b
cases b
· simp only [eq_iff_true_of_subsingleton]
· refine ⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ?_⟩
suffices Sigma.desc (fun i ↦ Sigma.ι Z i) = 𝟙 _ by rw [this]; infer_instance
| ext | /--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) := by
refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩
· rw [Presieve.isSheaf_coverage] at hF
let Z : α → C := fun i ↦ unop (K.obj ⟨i⟩)
have : (Presieve.ofArrows Z (Cofan.mk (∐ Z) (Sigma.ι Z)).inj).hasPullbacks :=
(inferInstance : (Presieve.ofArrows Z (Sigma.ι Z)).hasPullbacks)
have : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i) :=
(inferInstance : ∀ (i : α), Mono (Sigma.ι Z i))
let i : K ≅ Discrete.functor (fun i ↦ op (Z i)) := Discrete.natIsoFunctor
let _ : PreservesLimit (Discrete.functor (fun i ↦ op (Z i))) F :=
Presieve.preservesProductOfIsSheafFor F ?_ initialIsInitial _ (coproductIsCoproduct Z)
(FinitaryExtensive.isPullback_initial_to_sigma_ι Z)
(hF (Presieve.ofArrows Z (fun i ↦ Sigma.ι Z i)) ?_)
· exact preservesLimitOfIsoDiagram F i.symm
· apply hF
refine ⟨Empty, inferInstance, Empty.elim, IsEmpty.elim inferInstance, rfl, ⟨default,?_, ?_⟩⟩
· ext b
cases b
· simp only [eq_iff_true_of_subsingleton]
· refine ⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ?_⟩
suffices Sigma.desc (fun i ↦ Sigma.ι Z i) = 𝟙 _ by rw [this]; infer_instance
| Mathlib.CategoryTheory.Sites.RegularExtensive.366_0.rkSRr0zuqme90Yu | /--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) | Mathlib_CategoryTheory_Sites_RegularExtensive |
case refine_1.refine_2.h
C : Type u
inst✝² : Category.{v, u} C
inst✝¹ : FinitaryPreExtensive C
inst✝ : FinitaryExtensive C
F : Cᵒᵖ ⥤ Type (max u v)
hF : ∀ {X : C}, ∀ R ∈ Coverage.covering (extensiveCoverage C) X, IsSheafFor F R
α : Type
x✝ : Fintype α
K : Discrete α ⥤ Cᵒᵖ
Z : α → C := fun i => (K.obj { as := i }).unop
this✝ : hasPullbacks (ofArrows Z (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z))))
this : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i)
i : K ≅ Discrete.functor fun i => op (Z i) := Discrete.natIsoFunctor
b✝ : α
⊢ (Sigma.ι (fun i => Z i) b✝ ≫ Sigma.desc fun i => Sigma.ι Z i) = Sigma.ι (fun i => Z i) b✝ ≫ 𝟙 (∐ fun i => Z i) | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; cases h; infer_instance⟩ _ h
lemma isSheaf_of_projective (F : Cᵒᵖ ⥤ Type (max u v)) [Preregular C] [∀ (X : C), Projective X] :
IsSheaf (regularCoverage C).toGrothendieck F :=
(isSheaf_coverage _ _).mpr fun S ⟨_, h⟩ ↦ have : S.regular := ⟨_, h⟩
isSheafFor_regular_of_projective _ _
/-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim
intro x hx
let x_ext := Presieve.FamilyOfElements.sieveExtend x
have hx_ext := Presieve.FamilyOfElements.Compatible.sieveExtend hx
let S := Sieve.generate (Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))
obtain ⟨t, t_amalg, t_uniq⟩ :=
(Sieve.forallYonedaIsSheaf_iff_colimit S).mpr ⟨h_colim⟩ W x_ext hx_ext
refine ⟨t, ?_, ?_⟩
· convert Presieve.isAmalgamation_restrict (Sieve.le_generate
(Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))) _ _ t_amalg
exact (Presieve.restrict_extend hx).symm
· exact fun y hy ↦ t_uniq y <| Presieve.isAmalgamation_sieveExtend x y hy
/-- The regular topology on any preregular category is subcanonical. -/
theorem subcanonical [Preregular C] : Sheaf.Subcanonical (regularCoverage C).toGrothendieck :=
Sheaf.Subcanonical.of_yoneda_isSheaf _ isSheaf_yoneda_obj
end regularCoverage
end RegularSheaves
section ExtensiveSheaves
variable [FinitaryPreExtensive C] {C}
/-- A presieve is *extensive* if it is finite and its arrows induce an isomorphism from the
coproduct to the target. -/
class Presieve.extensive {X : C} (R : Presieve X) :
Prop where
/-- `R` consists of a finite collection of arrows that together induce an isomorphism from the
coproduct of their sources. -/
arrows_nonempty_isColimit : ∃ (α : Type) (_ : Fintype α) (Z : α → C) (π : (a : α) → (Z a ⟶ X)),
R = Presieve.ofArrows Z π ∧ Nonempty (IsColimit (Cofan.mk X π))
instance {X : C} (S : Presieve X) [S.extensive] : S.hasPullbacks where
has_pullbacks := by
obtain ⟨_, _, _, _, rfl, ⟨hc⟩⟩ := Presieve.extensive.arrows_nonempty_isColimit (R := S)
intro _ _ _ _ _ hg
cases hg
apply FinitaryPreExtensive.hasPullbacks_of_is_coproduct hc
instance {α : Type} [Fintype α] {Z : α → C} {F : C ⥤ Type w}
[PreservesFiniteProducts F] : PreservesLimit (Discrete.functor fun a => (Z a)) F :=
(PreservesFiniteProducts.preserves α).preservesLimit
open Presieve Opposite
/--
A finite product preserving presheaf is a sheaf for the extensive topology on a category which is
`FinitaryPreExtensive`.
-/
theorem isSheafFor_extensive_of_preservesFiniteProducts {X : C} (S : Presieve X) [S.extensive]
(F : Cᵒᵖ ⥤ Type max u v) [PreservesFiniteProducts F] : S.IsSheafFor F := by
obtain ⟨_, _, Z, π, rfl, ⟨hc⟩⟩ := extensive.arrows_nonempty_isColimit (R := S)
have : (ofArrows Z (Cofan.mk X π).inj).hasPullbacks :=
(inferInstance : (ofArrows Z π).hasPullbacks)
exact isSheafFor_of_preservesProduct _ _ hc
instance {α : Type} [Fintype α] (Z : α → C) : (ofArrows Z (fun i ↦ Sigma.ι Z i)).extensive :=
⟨⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ⟨coproductIsCoproduct _⟩⟩⟩
/--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) := by
refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩
· rw [Presieve.isSheaf_coverage] at hF
let Z : α → C := fun i ↦ unop (K.obj ⟨i⟩)
have : (Presieve.ofArrows Z (Cofan.mk (∐ Z) (Sigma.ι Z)).inj).hasPullbacks :=
(inferInstance : (Presieve.ofArrows Z (Sigma.ι Z)).hasPullbacks)
have : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i) :=
(inferInstance : ∀ (i : α), Mono (Sigma.ι Z i))
let i : K ≅ Discrete.functor (fun i ↦ op (Z i)) := Discrete.natIsoFunctor
let _ : PreservesLimit (Discrete.functor (fun i ↦ op (Z i))) F :=
Presieve.preservesProductOfIsSheafFor F ?_ initialIsInitial _ (coproductIsCoproduct Z)
(FinitaryExtensive.isPullback_initial_to_sigma_ι Z)
(hF (Presieve.ofArrows Z (fun i ↦ Sigma.ι Z i)) ?_)
· exact preservesLimitOfIsoDiagram F i.symm
· apply hF
refine ⟨Empty, inferInstance, Empty.elim, IsEmpty.elim inferInstance, rfl, ⟨default,?_, ?_⟩⟩
· ext b
cases b
· simp only [eq_iff_true_of_subsingleton]
· refine ⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ?_⟩
suffices Sigma.desc (fun i ↦ Sigma.ι Z i) = 𝟙 _ by rw [this]; infer_instance
ext
| simp | /--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) := by
refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩
· rw [Presieve.isSheaf_coverage] at hF
let Z : α → C := fun i ↦ unop (K.obj ⟨i⟩)
have : (Presieve.ofArrows Z (Cofan.mk (∐ Z) (Sigma.ι Z)).inj).hasPullbacks :=
(inferInstance : (Presieve.ofArrows Z (Sigma.ι Z)).hasPullbacks)
have : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i) :=
(inferInstance : ∀ (i : α), Mono (Sigma.ι Z i))
let i : K ≅ Discrete.functor (fun i ↦ op (Z i)) := Discrete.natIsoFunctor
let _ : PreservesLimit (Discrete.functor (fun i ↦ op (Z i))) F :=
Presieve.preservesProductOfIsSheafFor F ?_ initialIsInitial _ (coproductIsCoproduct Z)
(FinitaryExtensive.isPullback_initial_to_sigma_ι Z)
(hF (Presieve.ofArrows Z (fun i ↦ Sigma.ι Z i)) ?_)
· exact preservesLimitOfIsoDiagram F i.symm
· apply hF
refine ⟨Empty, inferInstance, Empty.elim, IsEmpty.elim inferInstance, rfl, ⟨default,?_, ?_⟩⟩
· ext b
cases b
· simp only [eq_iff_true_of_subsingleton]
· refine ⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ?_⟩
suffices Sigma.desc (fun i ↦ Sigma.ι Z i) = 𝟙 _ by rw [this]; infer_instance
ext
| Mathlib.CategoryTheory.Sites.RegularExtensive.366_0.rkSRr0zuqme90Yu | /--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) | Mathlib_CategoryTheory_Sites_RegularExtensive |
case refine_2
C : Type u
inst✝² : Category.{v, u} C
inst✝¹ : FinitaryPreExtensive C
inst✝ : FinitaryExtensive C
F : Cᵒᵖ ⥤ Type (max u v)
hF : Nonempty (PreservesFiniteProducts F)
⊢ IsSheaf (Coverage.toGrothendieck C (extensiveCoverage C)) F | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; cases h; infer_instance⟩ _ h
lemma isSheaf_of_projective (F : Cᵒᵖ ⥤ Type (max u v)) [Preregular C] [∀ (X : C), Projective X] :
IsSheaf (regularCoverage C).toGrothendieck F :=
(isSheaf_coverage _ _).mpr fun S ⟨_, h⟩ ↦ have : S.regular := ⟨_, h⟩
isSheafFor_regular_of_projective _ _
/-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim
intro x hx
let x_ext := Presieve.FamilyOfElements.sieveExtend x
have hx_ext := Presieve.FamilyOfElements.Compatible.sieveExtend hx
let S := Sieve.generate (Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))
obtain ⟨t, t_amalg, t_uniq⟩ :=
(Sieve.forallYonedaIsSheaf_iff_colimit S).mpr ⟨h_colim⟩ W x_ext hx_ext
refine ⟨t, ?_, ?_⟩
· convert Presieve.isAmalgamation_restrict (Sieve.le_generate
(Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))) _ _ t_amalg
exact (Presieve.restrict_extend hx).symm
· exact fun y hy ↦ t_uniq y <| Presieve.isAmalgamation_sieveExtend x y hy
/-- The regular topology on any preregular category is subcanonical. -/
theorem subcanonical [Preregular C] : Sheaf.Subcanonical (regularCoverage C).toGrothendieck :=
Sheaf.Subcanonical.of_yoneda_isSheaf _ isSheaf_yoneda_obj
end regularCoverage
end RegularSheaves
section ExtensiveSheaves
variable [FinitaryPreExtensive C] {C}
/-- A presieve is *extensive* if it is finite and its arrows induce an isomorphism from the
coproduct to the target. -/
class Presieve.extensive {X : C} (R : Presieve X) :
Prop where
/-- `R` consists of a finite collection of arrows that together induce an isomorphism from the
coproduct of their sources. -/
arrows_nonempty_isColimit : ∃ (α : Type) (_ : Fintype α) (Z : α → C) (π : (a : α) → (Z a ⟶ X)),
R = Presieve.ofArrows Z π ∧ Nonempty (IsColimit (Cofan.mk X π))
instance {X : C} (S : Presieve X) [S.extensive] : S.hasPullbacks where
has_pullbacks := by
obtain ⟨_, _, _, _, rfl, ⟨hc⟩⟩ := Presieve.extensive.arrows_nonempty_isColimit (R := S)
intro _ _ _ _ _ hg
cases hg
apply FinitaryPreExtensive.hasPullbacks_of_is_coproduct hc
instance {α : Type} [Fintype α] {Z : α → C} {F : C ⥤ Type w}
[PreservesFiniteProducts F] : PreservesLimit (Discrete.functor fun a => (Z a)) F :=
(PreservesFiniteProducts.preserves α).preservesLimit
open Presieve Opposite
/--
A finite product preserving presheaf is a sheaf for the extensive topology on a category which is
`FinitaryPreExtensive`.
-/
theorem isSheafFor_extensive_of_preservesFiniteProducts {X : C} (S : Presieve X) [S.extensive]
(F : Cᵒᵖ ⥤ Type max u v) [PreservesFiniteProducts F] : S.IsSheafFor F := by
obtain ⟨_, _, Z, π, rfl, ⟨hc⟩⟩ := extensive.arrows_nonempty_isColimit (R := S)
have : (ofArrows Z (Cofan.mk X π).inj).hasPullbacks :=
(inferInstance : (ofArrows Z π).hasPullbacks)
exact isSheafFor_of_preservesProduct _ _ hc
instance {α : Type} [Fintype α] (Z : α → C) : (ofArrows Z (fun i ↦ Sigma.ι Z i)).extensive :=
⟨⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ⟨coproductIsCoproduct _⟩⟩⟩
/--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) := by
refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩
· rw [Presieve.isSheaf_coverage] at hF
let Z : α → C := fun i ↦ unop (K.obj ⟨i⟩)
have : (Presieve.ofArrows Z (Cofan.mk (∐ Z) (Sigma.ι Z)).inj).hasPullbacks :=
(inferInstance : (Presieve.ofArrows Z (Sigma.ι Z)).hasPullbacks)
have : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i) :=
(inferInstance : ∀ (i : α), Mono (Sigma.ι Z i))
let i : K ≅ Discrete.functor (fun i ↦ op (Z i)) := Discrete.natIsoFunctor
let _ : PreservesLimit (Discrete.functor (fun i ↦ op (Z i))) F :=
Presieve.preservesProductOfIsSheafFor F ?_ initialIsInitial _ (coproductIsCoproduct Z)
(FinitaryExtensive.isPullback_initial_to_sigma_ι Z)
(hF (Presieve.ofArrows Z (fun i ↦ Sigma.ι Z i)) ?_)
· exact preservesLimitOfIsoDiagram F i.symm
· apply hF
refine ⟨Empty, inferInstance, Empty.elim, IsEmpty.elim inferInstance, rfl, ⟨default,?_, ?_⟩⟩
· ext b
cases b
· simp only [eq_iff_true_of_subsingleton]
· refine ⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ?_⟩
suffices Sigma.desc (fun i ↦ Sigma.ι Z i) = 𝟙 _ by rw [this]; infer_instance
ext
simp
· | let _ := hF.some | /--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) := by
refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩
· rw [Presieve.isSheaf_coverage] at hF
let Z : α → C := fun i ↦ unop (K.obj ⟨i⟩)
have : (Presieve.ofArrows Z (Cofan.mk (∐ Z) (Sigma.ι Z)).inj).hasPullbacks :=
(inferInstance : (Presieve.ofArrows Z (Sigma.ι Z)).hasPullbacks)
have : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i) :=
(inferInstance : ∀ (i : α), Mono (Sigma.ι Z i))
let i : K ≅ Discrete.functor (fun i ↦ op (Z i)) := Discrete.natIsoFunctor
let _ : PreservesLimit (Discrete.functor (fun i ↦ op (Z i))) F :=
Presieve.preservesProductOfIsSheafFor F ?_ initialIsInitial _ (coproductIsCoproduct Z)
(FinitaryExtensive.isPullback_initial_to_sigma_ι Z)
(hF (Presieve.ofArrows Z (fun i ↦ Sigma.ι Z i)) ?_)
· exact preservesLimitOfIsoDiagram F i.symm
· apply hF
refine ⟨Empty, inferInstance, Empty.elim, IsEmpty.elim inferInstance, rfl, ⟨default,?_, ?_⟩⟩
· ext b
cases b
· simp only [eq_iff_true_of_subsingleton]
· refine ⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ?_⟩
suffices Sigma.desc (fun i ↦ Sigma.ι Z i) = 𝟙 _ by rw [this]; infer_instance
ext
simp
· | Mathlib.CategoryTheory.Sites.RegularExtensive.366_0.rkSRr0zuqme90Yu | /--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) | Mathlib_CategoryTheory_Sites_RegularExtensive |
case refine_2
C : Type u
inst✝² : Category.{v, u} C
inst✝¹ : FinitaryPreExtensive C
inst✝ : FinitaryExtensive C
F : Cᵒᵖ ⥤ Type (max u v)
hF : Nonempty (PreservesFiniteProducts F)
x✝ : PreservesFiniteProducts F := Nonempty.some hF
⊢ IsSheaf (Coverage.toGrothendieck C (extensiveCoverage C)) F | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; cases h; infer_instance⟩ _ h
lemma isSheaf_of_projective (F : Cᵒᵖ ⥤ Type (max u v)) [Preregular C] [∀ (X : C), Projective X] :
IsSheaf (regularCoverage C).toGrothendieck F :=
(isSheaf_coverage _ _).mpr fun S ⟨_, h⟩ ↦ have : S.regular := ⟨_, h⟩
isSheafFor_regular_of_projective _ _
/-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim
intro x hx
let x_ext := Presieve.FamilyOfElements.sieveExtend x
have hx_ext := Presieve.FamilyOfElements.Compatible.sieveExtend hx
let S := Sieve.generate (Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))
obtain ⟨t, t_amalg, t_uniq⟩ :=
(Sieve.forallYonedaIsSheaf_iff_colimit S).mpr ⟨h_colim⟩ W x_ext hx_ext
refine ⟨t, ?_, ?_⟩
· convert Presieve.isAmalgamation_restrict (Sieve.le_generate
(Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))) _ _ t_amalg
exact (Presieve.restrict_extend hx).symm
· exact fun y hy ↦ t_uniq y <| Presieve.isAmalgamation_sieveExtend x y hy
/-- The regular topology on any preregular category is subcanonical. -/
theorem subcanonical [Preregular C] : Sheaf.Subcanonical (regularCoverage C).toGrothendieck :=
Sheaf.Subcanonical.of_yoneda_isSheaf _ isSheaf_yoneda_obj
end regularCoverage
end RegularSheaves
section ExtensiveSheaves
variable [FinitaryPreExtensive C] {C}
/-- A presieve is *extensive* if it is finite and its arrows induce an isomorphism from the
coproduct to the target. -/
class Presieve.extensive {X : C} (R : Presieve X) :
Prop where
/-- `R` consists of a finite collection of arrows that together induce an isomorphism from the
coproduct of their sources. -/
arrows_nonempty_isColimit : ∃ (α : Type) (_ : Fintype α) (Z : α → C) (π : (a : α) → (Z a ⟶ X)),
R = Presieve.ofArrows Z π ∧ Nonempty (IsColimit (Cofan.mk X π))
instance {X : C} (S : Presieve X) [S.extensive] : S.hasPullbacks where
has_pullbacks := by
obtain ⟨_, _, _, _, rfl, ⟨hc⟩⟩ := Presieve.extensive.arrows_nonempty_isColimit (R := S)
intro _ _ _ _ _ hg
cases hg
apply FinitaryPreExtensive.hasPullbacks_of_is_coproduct hc
instance {α : Type} [Fintype α] {Z : α → C} {F : C ⥤ Type w}
[PreservesFiniteProducts F] : PreservesLimit (Discrete.functor fun a => (Z a)) F :=
(PreservesFiniteProducts.preserves α).preservesLimit
open Presieve Opposite
/--
A finite product preserving presheaf is a sheaf for the extensive topology on a category which is
`FinitaryPreExtensive`.
-/
theorem isSheafFor_extensive_of_preservesFiniteProducts {X : C} (S : Presieve X) [S.extensive]
(F : Cᵒᵖ ⥤ Type max u v) [PreservesFiniteProducts F] : S.IsSheafFor F := by
obtain ⟨_, _, Z, π, rfl, ⟨hc⟩⟩ := extensive.arrows_nonempty_isColimit (R := S)
have : (ofArrows Z (Cofan.mk X π).inj).hasPullbacks :=
(inferInstance : (ofArrows Z π).hasPullbacks)
exact isSheafFor_of_preservesProduct _ _ hc
instance {α : Type} [Fintype α] (Z : α → C) : (ofArrows Z (fun i ↦ Sigma.ι Z i)).extensive :=
⟨⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ⟨coproductIsCoproduct _⟩⟩⟩
/--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) := by
refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩
· rw [Presieve.isSheaf_coverage] at hF
let Z : α → C := fun i ↦ unop (K.obj ⟨i⟩)
have : (Presieve.ofArrows Z (Cofan.mk (∐ Z) (Sigma.ι Z)).inj).hasPullbacks :=
(inferInstance : (Presieve.ofArrows Z (Sigma.ι Z)).hasPullbacks)
have : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i) :=
(inferInstance : ∀ (i : α), Mono (Sigma.ι Z i))
let i : K ≅ Discrete.functor (fun i ↦ op (Z i)) := Discrete.natIsoFunctor
let _ : PreservesLimit (Discrete.functor (fun i ↦ op (Z i))) F :=
Presieve.preservesProductOfIsSheafFor F ?_ initialIsInitial _ (coproductIsCoproduct Z)
(FinitaryExtensive.isPullback_initial_to_sigma_ι Z)
(hF (Presieve.ofArrows Z (fun i ↦ Sigma.ι Z i)) ?_)
· exact preservesLimitOfIsoDiagram F i.symm
· apply hF
refine ⟨Empty, inferInstance, Empty.elim, IsEmpty.elim inferInstance, rfl, ⟨default,?_, ?_⟩⟩
· ext b
cases b
· simp only [eq_iff_true_of_subsingleton]
· refine ⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ?_⟩
suffices Sigma.desc (fun i ↦ Sigma.ι Z i) = 𝟙 _ by rw [this]; infer_instance
ext
simp
· let _ := hF.some
| rw [Presieve.isSheaf_coverage] | /--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) := by
refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩
· rw [Presieve.isSheaf_coverage] at hF
let Z : α → C := fun i ↦ unop (K.obj ⟨i⟩)
have : (Presieve.ofArrows Z (Cofan.mk (∐ Z) (Sigma.ι Z)).inj).hasPullbacks :=
(inferInstance : (Presieve.ofArrows Z (Sigma.ι Z)).hasPullbacks)
have : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i) :=
(inferInstance : ∀ (i : α), Mono (Sigma.ι Z i))
let i : K ≅ Discrete.functor (fun i ↦ op (Z i)) := Discrete.natIsoFunctor
let _ : PreservesLimit (Discrete.functor (fun i ↦ op (Z i))) F :=
Presieve.preservesProductOfIsSheafFor F ?_ initialIsInitial _ (coproductIsCoproduct Z)
(FinitaryExtensive.isPullback_initial_to_sigma_ι Z)
(hF (Presieve.ofArrows Z (fun i ↦ Sigma.ι Z i)) ?_)
· exact preservesLimitOfIsoDiagram F i.symm
· apply hF
refine ⟨Empty, inferInstance, Empty.elim, IsEmpty.elim inferInstance, rfl, ⟨default,?_, ?_⟩⟩
· ext b
cases b
· simp only [eq_iff_true_of_subsingleton]
· refine ⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ?_⟩
suffices Sigma.desc (fun i ↦ Sigma.ι Z i) = 𝟙 _ by rw [this]; infer_instance
ext
simp
· let _ := hF.some
| Mathlib.CategoryTheory.Sites.RegularExtensive.366_0.rkSRr0zuqme90Yu | /--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) | Mathlib_CategoryTheory_Sites_RegularExtensive |
case refine_2
C : Type u
inst✝² : Category.{v, u} C
inst✝¹ : FinitaryPreExtensive C
inst✝ : FinitaryExtensive C
F : Cᵒᵖ ⥤ Type (max u v)
hF : Nonempty (PreservesFiniteProducts F)
x✝ : PreservesFiniteProducts F := Nonempty.some hF
⊢ ∀ {X : C}, ∀ R ∈ Coverage.covering (extensiveCoverage C) X, IsSheafFor F R | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; cases h; infer_instance⟩ _ h
lemma isSheaf_of_projective (F : Cᵒᵖ ⥤ Type (max u v)) [Preregular C] [∀ (X : C), Projective X] :
IsSheaf (regularCoverage C).toGrothendieck F :=
(isSheaf_coverage _ _).mpr fun S ⟨_, h⟩ ↦ have : S.regular := ⟨_, h⟩
isSheafFor_regular_of_projective _ _
/-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim
intro x hx
let x_ext := Presieve.FamilyOfElements.sieveExtend x
have hx_ext := Presieve.FamilyOfElements.Compatible.sieveExtend hx
let S := Sieve.generate (Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))
obtain ⟨t, t_amalg, t_uniq⟩ :=
(Sieve.forallYonedaIsSheaf_iff_colimit S).mpr ⟨h_colim⟩ W x_ext hx_ext
refine ⟨t, ?_, ?_⟩
· convert Presieve.isAmalgamation_restrict (Sieve.le_generate
(Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))) _ _ t_amalg
exact (Presieve.restrict_extend hx).symm
· exact fun y hy ↦ t_uniq y <| Presieve.isAmalgamation_sieveExtend x y hy
/-- The regular topology on any preregular category is subcanonical. -/
theorem subcanonical [Preregular C] : Sheaf.Subcanonical (regularCoverage C).toGrothendieck :=
Sheaf.Subcanonical.of_yoneda_isSheaf _ isSheaf_yoneda_obj
end regularCoverage
end RegularSheaves
section ExtensiveSheaves
variable [FinitaryPreExtensive C] {C}
/-- A presieve is *extensive* if it is finite and its arrows induce an isomorphism from the
coproduct to the target. -/
class Presieve.extensive {X : C} (R : Presieve X) :
Prop where
/-- `R` consists of a finite collection of arrows that together induce an isomorphism from the
coproduct of their sources. -/
arrows_nonempty_isColimit : ∃ (α : Type) (_ : Fintype α) (Z : α → C) (π : (a : α) → (Z a ⟶ X)),
R = Presieve.ofArrows Z π ∧ Nonempty (IsColimit (Cofan.mk X π))
instance {X : C} (S : Presieve X) [S.extensive] : S.hasPullbacks where
has_pullbacks := by
obtain ⟨_, _, _, _, rfl, ⟨hc⟩⟩ := Presieve.extensive.arrows_nonempty_isColimit (R := S)
intro _ _ _ _ _ hg
cases hg
apply FinitaryPreExtensive.hasPullbacks_of_is_coproduct hc
instance {α : Type} [Fintype α] {Z : α → C} {F : C ⥤ Type w}
[PreservesFiniteProducts F] : PreservesLimit (Discrete.functor fun a => (Z a)) F :=
(PreservesFiniteProducts.preserves α).preservesLimit
open Presieve Opposite
/--
A finite product preserving presheaf is a sheaf for the extensive topology on a category which is
`FinitaryPreExtensive`.
-/
theorem isSheafFor_extensive_of_preservesFiniteProducts {X : C} (S : Presieve X) [S.extensive]
(F : Cᵒᵖ ⥤ Type max u v) [PreservesFiniteProducts F] : S.IsSheafFor F := by
obtain ⟨_, _, Z, π, rfl, ⟨hc⟩⟩ := extensive.arrows_nonempty_isColimit (R := S)
have : (ofArrows Z (Cofan.mk X π).inj).hasPullbacks :=
(inferInstance : (ofArrows Z π).hasPullbacks)
exact isSheafFor_of_preservesProduct _ _ hc
instance {α : Type} [Fintype α] (Z : α → C) : (ofArrows Z (fun i ↦ Sigma.ι Z i)).extensive :=
⟨⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ⟨coproductIsCoproduct _⟩⟩⟩
/--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) := by
refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩
· rw [Presieve.isSheaf_coverage] at hF
let Z : α → C := fun i ↦ unop (K.obj ⟨i⟩)
have : (Presieve.ofArrows Z (Cofan.mk (∐ Z) (Sigma.ι Z)).inj).hasPullbacks :=
(inferInstance : (Presieve.ofArrows Z (Sigma.ι Z)).hasPullbacks)
have : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i) :=
(inferInstance : ∀ (i : α), Mono (Sigma.ι Z i))
let i : K ≅ Discrete.functor (fun i ↦ op (Z i)) := Discrete.natIsoFunctor
let _ : PreservesLimit (Discrete.functor (fun i ↦ op (Z i))) F :=
Presieve.preservesProductOfIsSheafFor F ?_ initialIsInitial _ (coproductIsCoproduct Z)
(FinitaryExtensive.isPullback_initial_to_sigma_ι Z)
(hF (Presieve.ofArrows Z (fun i ↦ Sigma.ι Z i)) ?_)
· exact preservesLimitOfIsoDiagram F i.symm
· apply hF
refine ⟨Empty, inferInstance, Empty.elim, IsEmpty.elim inferInstance, rfl, ⟨default,?_, ?_⟩⟩
· ext b
cases b
· simp only [eq_iff_true_of_subsingleton]
· refine ⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ?_⟩
suffices Sigma.desc (fun i ↦ Sigma.ι Z i) = 𝟙 _ by rw [this]; infer_instance
ext
simp
· let _ := hF.some
rw [Presieve.isSheaf_coverage]
| intro X R ⟨Y, α, Z, π, hR, hi⟩ | /--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) := by
refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩
· rw [Presieve.isSheaf_coverage] at hF
let Z : α → C := fun i ↦ unop (K.obj ⟨i⟩)
have : (Presieve.ofArrows Z (Cofan.mk (∐ Z) (Sigma.ι Z)).inj).hasPullbacks :=
(inferInstance : (Presieve.ofArrows Z (Sigma.ι Z)).hasPullbacks)
have : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i) :=
(inferInstance : ∀ (i : α), Mono (Sigma.ι Z i))
let i : K ≅ Discrete.functor (fun i ↦ op (Z i)) := Discrete.natIsoFunctor
let _ : PreservesLimit (Discrete.functor (fun i ↦ op (Z i))) F :=
Presieve.preservesProductOfIsSheafFor F ?_ initialIsInitial _ (coproductIsCoproduct Z)
(FinitaryExtensive.isPullback_initial_to_sigma_ι Z)
(hF (Presieve.ofArrows Z (fun i ↦ Sigma.ι Z i)) ?_)
· exact preservesLimitOfIsoDiagram F i.symm
· apply hF
refine ⟨Empty, inferInstance, Empty.elim, IsEmpty.elim inferInstance, rfl, ⟨default,?_, ?_⟩⟩
· ext b
cases b
· simp only [eq_iff_true_of_subsingleton]
· refine ⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ?_⟩
suffices Sigma.desc (fun i ↦ Sigma.ι Z i) = 𝟙 _ by rw [this]; infer_instance
ext
simp
· let _ := hF.some
rw [Presieve.isSheaf_coverage]
| Mathlib.CategoryTheory.Sites.RegularExtensive.366_0.rkSRr0zuqme90Yu | /--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) | Mathlib_CategoryTheory_Sites_RegularExtensive |
case refine_2
C : Type u
inst✝² : Category.{v, u} C
inst✝¹ : FinitaryPreExtensive C
inst✝ : FinitaryExtensive C
F : Cᵒᵖ ⥤ Type (max u v)
hF : Nonempty (PreservesFiniteProducts F)
x✝ : PreservesFiniteProducts F := Nonempty.some hF
X : C
R : Presieve X
Y : Type
α : Fintype Y
Z : Y → C
π : (a : Y) → Z a ⟶ X
hR : R = ofArrows Z π
hi : IsIso (Sigma.desc π)
⊢ IsSheafFor F R | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; cases h; infer_instance⟩ _ h
lemma isSheaf_of_projective (F : Cᵒᵖ ⥤ Type (max u v)) [Preregular C] [∀ (X : C), Projective X] :
IsSheaf (regularCoverage C).toGrothendieck F :=
(isSheaf_coverage _ _).mpr fun S ⟨_, h⟩ ↦ have : S.regular := ⟨_, h⟩
isSheafFor_regular_of_projective _ _
/-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim
intro x hx
let x_ext := Presieve.FamilyOfElements.sieveExtend x
have hx_ext := Presieve.FamilyOfElements.Compatible.sieveExtend hx
let S := Sieve.generate (Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))
obtain ⟨t, t_amalg, t_uniq⟩ :=
(Sieve.forallYonedaIsSheaf_iff_colimit S).mpr ⟨h_colim⟩ W x_ext hx_ext
refine ⟨t, ?_, ?_⟩
· convert Presieve.isAmalgamation_restrict (Sieve.le_generate
(Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))) _ _ t_amalg
exact (Presieve.restrict_extend hx).symm
· exact fun y hy ↦ t_uniq y <| Presieve.isAmalgamation_sieveExtend x y hy
/-- The regular topology on any preregular category is subcanonical. -/
theorem subcanonical [Preregular C] : Sheaf.Subcanonical (regularCoverage C).toGrothendieck :=
Sheaf.Subcanonical.of_yoneda_isSheaf _ isSheaf_yoneda_obj
end regularCoverage
end RegularSheaves
section ExtensiveSheaves
variable [FinitaryPreExtensive C] {C}
/-- A presieve is *extensive* if it is finite and its arrows induce an isomorphism from the
coproduct to the target. -/
class Presieve.extensive {X : C} (R : Presieve X) :
Prop where
/-- `R` consists of a finite collection of arrows that together induce an isomorphism from the
coproduct of their sources. -/
arrows_nonempty_isColimit : ∃ (α : Type) (_ : Fintype α) (Z : α → C) (π : (a : α) → (Z a ⟶ X)),
R = Presieve.ofArrows Z π ∧ Nonempty (IsColimit (Cofan.mk X π))
instance {X : C} (S : Presieve X) [S.extensive] : S.hasPullbacks where
has_pullbacks := by
obtain ⟨_, _, _, _, rfl, ⟨hc⟩⟩ := Presieve.extensive.arrows_nonempty_isColimit (R := S)
intro _ _ _ _ _ hg
cases hg
apply FinitaryPreExtensive.hasPullbacks_of_is_coproduct hc
instance {α : Type} [Fintype α] {Z : α → C} {F : C ⥤ Type w}
[PreservesFiniteProducts F] : PreservesLimit (Discrete.functor fun a => (Z a)) F :=
(PreservesFiniteProducts.preserves α).preservesLimit
open Presieve Opposite
/--
A finite product preserving presheaf is a sheaf for the extensive topology on a category which is
`FinitaryPreExtensive`.
-/
theorem isSheafFor_extensive_of_preservesFiniteProducts {X : C} (S : Presieve X) [S.extensive]
(F : Cᵒᵖ ⥤ Type max u v) [PreservesFiniteProducts F] : S.IsSheafFor F := by
obtain ⟨_, _, Z, π, rfl, ⟨hc⟩⟩ := extensive.arrows_nonempty_isColimit (R := S)
have : (ofArrows Z (Cofan.mk X π).inj).hasPullbacks :=
(inferInstance : (ofArrows Z π).hasPullbacks)
exact isSheafFor_of_preservesProduct _ _ hc
instance {α : Type} [Fintype α] (Z : α → C) : (ofArrows Z (fun i ↦ Sigma.ι Z i)).extensive :=
⟨⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ⟨coproductIsCoproduct _⟩⟩⟩
/--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) := by
refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩
· rw [Presieve.isSheaf_coverage] at hF
let Z : α → C := fun i ↦ unop (K.obj ⟨i⟩)
have : (Presieve.ofArrows Z (Cofan.mk (∐ Z) (Sigma.ι Z)).inj).hasPullbacks :=
(inferInstance : (Presieve.ofArrows Z (Sigma.ι Z)).hasPullbacks)
have : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i) :=
(inferInstance : ∀ (i : α), Mono (Sigma.ι Z i))
let i : K ≅ Discrete.functor (fun i ↦ op (Z i)) := Discrete.natIsoFunctor
let _ : PreservesLimit (Discrete.functor (fun i ↦ op (Z i))) F :=
Presieve.preservesProductOfIsSheafFor F ?_ initialIsInitial _ (coproductIsCoproduct Z)
(FinitaryExtensive.isPullback_initial_to_sigma_ι Z)
(hF (Presieve.ofArrows Z (fun i ↦ Sigma.ι Z i)) ?_)
· exact preservesLimitOfIsoDiagram F i.symm
· apply hF
refine ⟨Empty, inferInstance, Empty.elim, IsEmpty.elim inferInstance, rfl, ⟨default,?_, ?_⟩⟩
· ext b
cases b
· simp only [eq_iff_true_of_subsingleton]
· refine ⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ?_⟩
suffices Sigma.desc (fun i ↦ Sigma.ι Z i) = 𝟙 _ by rw [this]; infer_instance
ext
simp
· let _ := hF.some
rw [Presieve.isSheaf_coverage]
intro X R ⟨Y, α, Z, π, hR, hi⟩
| have : IsIso (Sigma.desc (Cofan.inj (Cofan.mk X π))) := hi | /--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) := by
refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩
· rw [Presieve.isSheaf_coverage] at hF
let Z : α → C := fun i ↦ unop (K.obj ⟨i⟩)
have : (Presieve.ofArrows Z (Cofan.mk (∐ Z) (Sigma.ι Z)).inj).hasPullbacks :=
(inferInstance : (Presieve.ofArrows Z (Sigma.ι Z)).hasPullbacks)
have : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i) :=
(inferInstance : ∀ (i : α), Mono (Sigma.ι Z i))
let i : K ≅ Discrete.functor (fun i ↦ op (Z i)) := Discrete.natIsoFunctor
let _ : PreservesLimit (Discrete.functor (fun i ↦ op (Z i))) F :=
Presieve.preservesProductOfIsSheafFor F ?_ initialIsInitial _ (coproductIsCoproduct Z)
(FinitaryExtensive.isPullback_initial_to_sigma_ι Z)
(hF (Presieve.ofArrows Z (fun i ↦ Sigma.ι Z i)) ?_)
· exact preservesLimitOfIsoDiagram F i.symm
· apply hF
refine ⟨Empty, inferInstance, Empty.elim, IsEmpty.elim inferInstance, rfl, ⟨default,?_, ?_⟩⟩
· ext b
cases b
· simp only [eq_iff_true_of_subsingleton]
· refine ⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ?_⟩
suffices Sigma.desc (fun i ↦ Sigma.ι Z i) = 𝟙 _ by rw [this]; infer_instance
ext
simp
· let _ := hF.some
rw [Presieve.isSheaf_coverage]
intro X R ⟨Y, α, Z, π, hR, hi⟩
| Mathlib.CategoryTheory.Sites.RegularExtensive.366_0.rkSRr0zuqme90Yu | /--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) | Mathlib_CategoryTheory_Sites_RegularExtensive |
case refine_2
C : Type u
inst✝² : Category.{v, u} C
inst✝¹ : FinitaryPreExtensive C
inst✝ : FinitaryExtensive C
F : Cᵒᵖ ⥤ Type (max u v)
hF : Nonempty (PreservesFiniteProducts F)
x✝ : PreservesFiniteProducts F := Nonempty.some hF
X : C
R : Presieve X
Y : Type
α : Fintype Y
Z : Y → C
π : (a : Y) → Z a ⟶ X
hR : R = ofArrows Z π
hi : IsIso (Sigma.desc π)
this : IsIso (Sigma.desc (Cofan.inj (Cofan.mk X π)))
⊢ IsSheafFor F R | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; cases h; infer_instance⟩ _ h
lemma isSheaf_of_projective (F : Cᵒᵖ ⥤ Type (max u v)) [Preregular C] [∀ (X : C), Projective X] :
IsSheaf (regularCoverage C).toGrothendieck F :=
(isSheaf_coverage _ _).mpr fun S ⟨_, h⟩ ↦ have : S.regular := ⟨_, h⟩
isSheafFor_regular_of_projective _ _
/-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim
intro x hx
let x_ext := Presieve.FamilyOfElements.sieveExtend x
have hx_ext := Presieve.FamilyOfElements.Compatible.sieveExtend hx
let S := Sieve.generate (Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))
obtain ⟨t, t_amalg, t_uniq⟩ :=
(Sieve.forallYonedaIsSheaf_iff_colimit S).mpr ⟨h_colim⟩ W x_ext hx_ext
refine ⟨t, ?_, ?_⟩
· convert Presieve.isAmalgamation_restrict (Sieve.le_generate
(Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))) _ _ t_amalg
exact (Presieve.restrict_extend hx).symm
· exact fun y hy ↦ t_uniq y <| Presieve.isAmalgamation_sieveExtend x y hy
/-- The regular topology on any preregular category is subcanonical. -/
theorem subcanonical [Preregular C] : Sheaf.Subcanonical (regularCoverage C).toGrothendieck :=
Sheaf.Subcanonical.of_yoneda_isSheaf _ isSheaf_yoneda_obj
end regularCoverage
end RegularSheaves
section ExtensiveSheaves
variable [FinitaryPreExtensive C] {C}
/-- A presieve is *extensive* if it is finite and its arrows induce an isomorphism from the
coproduct to the target. -/
class Presieve.extensive {X : C} (R : Presieve X) :
Prop where
/-- `R` consists of a finite collection of arrows that together induce an isomorphism from the
coproduct of their sources. -/
arrows_nonempty_isColimit : ∃ (α : Type) (_ : Fintype α) (Z : α → C) (π : (a : α) → (Z a ⟶ X)),
R = Presieve.ofArrows Z π ∧ Nonempty (IsColimit (Cofan.mk X π))
instance {X : C} (S : Presieve X) [S.extensive] : S.hasPullbacks where
has_pullbacks := by
obtain ⟨_, _, _, _, rfl, ⟨hc⟩⟩ := Presieve.extensive.arrows_nonempty_isColimit (R := S)
intro _ _ _ _ _ hg
cases hg
apply FinitaryPreExtensive.hasPullbacks_of_is_coproduct hc
instance {α : Type} [Fintype α] {Z : α → C} {F : C ⥤ Type w}
[PreservesFiniteProducts F] : PreservesLimit (Discrete.functor fun a => (Z a)) F :=
(PreservesFiniteProducts.preserves α).preservesLimit
open Presieve Opposite
/--
A finite product preserving presheaf is a sheaf for the extensive topology on a category which is
`FinitaryPreExtensive`.
-/
theorem isSheafFor_extensive_of_preservesFiniteProducts {X : C} (S : Presieve X) [S.extensive]
(F : Cᵒᵖ ⥤ Type max u v) [PreservesFiniteProducts F] : S.IsSheafFor F := by
obtain ⟨_, _, Z, π, rfl, ⟨hc⟩⟩ := extensive.arrows_nonempty_isColimit (R := S)
have : (ofArrows Z (Cofan.mk X π).inj).hasPullbacks :=
(inferInstance : (ofArrows Z π).hasPullbacks)
exact isSheafFor_of_preservesProduct _ _ hc
instance {α : Type} [Fintype α] (Z : α → C) : (ofArrows Z (fun i ↦ Sigma.ι Z i)).extensive :=
⟨⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ⟨coproductIsCoproduct _⟩⟩⟩
/--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) := by
refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩
· rw [Presieve.isSheaf_coverage] at hF
let Z : α → C := fun i ↦ unop (K.obj ⟨i⟩)
have : (Presieve.ofArrows Z (Cofan.mk (∐ Z) (Sigma.ι Z)).inj).hasPullbacks :=
(inferInstance : (Presieve.ofArrows Z (Sigma.ι Z)).hasPullbacks)
have : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i) :=
(inferInstance : ∀ (i : α), Mono (Sigma.ι Z i))
let i : K ≅ Discrete.functor (fun i ↦ op (Z i)) := Discrete.natIsoFunctor
let _ : PreservesLimit (Discrete.functor (fun i ↦ op (Z i))) F :=
Presieve.preservesProductOfIsSheafFor F ?_ initialIsInitial _ (coproductIsCoproduct Z)
(FinitaryExtensive.isPullback_initial_to_sigma_ι Z)
(hF (Presieve.ofArrows Z (fun i ↦ Sigma.ι Z i)) ?_)
· exact preservesLimitOfIsoDiagram F i.symm
· apply hF
refine ⟨Empty, inferInstance, Empty.elim, IsEmpty.elim inferInstance, rfl, ⟨default,?_, ?_⟩⟩
· ext b
cases b
· simp only [eq_iff_true_of_subsingleton]
· refine ⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ?_⟩
suffices Sigma.desc (fun i ↦ Sigma.ι Z i) = 𝟙 _ by rw [this]; infer_instance
ext
simp
· let _ := hF.some
rw [Presieve.isSheaf_coverage]
intro X R ⟨Y, α, Z, π, hR, hi⟩
have : IsIso (Sigma.desc (Cofan.inj (Cofan.mk X π))) := hi
| have : R.extensive := ⟨Y, α, Z, π, hR, ⟨Cofan.isColimitOfIsIsoSigmaDesc (Cofan.mk X π)⟩⟩ | /--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) := by
refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩
· rw [Presieve.isSheaf_coverage] at hF
let Z : α → C := fun i ↦ unop (K.obj ⟨i⟩)
have : (Presieve.ofArrows Z (Cofan.mk (∐ Z) (Sigma.ι Z)).inj).hasPullbacks :=
(inferInstance : (Presieve.ofArrows Z (Sigma.ι Z)).hasPullbacks)
have : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i) :=
(inferInstance : ∀ (i : α), Mono (Sigma.ι Z i))
let i : K ≅ Discrete.functor (fun i ↦ op (Z i)) := Discrete.natIsoFunctor
let _ : PreservesLimit (Discrete.functor (fun i ↦ op (Z i))) F :=
Presieve.preservesProductOfIsSheafFor F ?_ initialIsInitial _ (coproductIsCoproduct Z)
(FinitaryExtensive.isPullback_initial_to_sigma_ι Z)
(hF (Presieve.ofArrows Z (fun i ↦ Sigma.ι Z i)) ?_)
· exact preservesLimitOfIsoDiagram F i.symm
· apply hF
refine ⟨Empty, inferInstance, Empty.elim, IsEmpty.elim inferInstance, rfl, ⟨default,?_, ?_⟩⟩
· ext b
cases b
· simp only [eq_iff_true_of_subsingleton]
· refine ⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ?_⟩
suffices Sigma.desc (fun i ↦ Sigma.ι Z i) = 𝟙 _ by rw [this]; infer_instance
ext
simp
· let _ := hF.some
rw [Presieve.isSheaf_coverage]
intro X R ⟨Y, α, Z, π, hR, hi⟩
have : IsIso (Sigma.desc (Cofan.inj (Cofan.mk X π))) := hi
| Mathlib.CategoryTheory.Sites.RegularExtensive.366_0.rkSRr0zuqme90Yu | /--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) | Mathlib_CategoryTheory_Sites_RegularExtensive |
case refine_2
C : Type u
inst✝² : Category.{v, u} C
inst✝¹ : FinitaryPreExtensive C
inst✝ : FinitaryExtensive C
F : Cᵒᵖ ⥤ Type (max u v)
hF : Nonempty (PreservesFiniteProducts F)
x✝ : PreservesFiniteProducts F := Nonempty.some hF
X : C
R : Presieve X
Y : Type
α : Fintype Y
Z : Y → C
π : (a : Y) → Z a ⟶ X
hR : R = ofArrows Z π
hi : IsIso (Sigma.desc π)
this✝ : IsIso (Sigma.desc (Cofan.inj (Cofan.mk X π)))
this : extensive R
⊢ IsSheafFor F R | /-
Copyright (c) 2023 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Filippo A. E. Nuccio, Riccardo Brasca
-/
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Sites.Coherent
import Mathlib.CategoryTheory.Sites.Preserves
/-!
# The Regular and Extensive Coverages
This file defines two coverages on a category `C`.
The first one is called the *regular* coverage and for that to exist, the category `C` must satisfy
a condition called `Preregular C`. This means that effective epimorphisms can be "pulled back". The
covering sieves of this coverage are generated by presieves consisting of a single effective
epimorphism.
The second one is called the *extensive* coverage and for that to exist, the category `C` must
satisfy a condition called `FinitaryPreExtensive C`. This means `C` has finite coproducts and that
those are preserved by pullbacks. The covering sieves of this coverage are generated by presieves
consisting finitely many arrows that together induce an isomorphism from the coproduct to the
target. This condition is weaker than `FinitaryExtensive`, where in addition finite coproducts are
disjoint.
## Main results
* `instance : Precoherent C` given `Preregular C` and `FinitaryPreExtensive C`.
* `extensive_union_regular_generates_coherent`: the union of the regular and extensive coverages
generates the coherent topology on `C` if `C` is precoherent, preextensive and preregular.
* `isSheaf_iff_equalizerCondition`: In a preregular category with pullbacks, the sheaves for the
regular topology are precisely the presheaves satisfying an equaliser condition with respect to
effective epimorphisms.
* `isSheaf_of_projective`: In a preregular category in which every object is projective, every
presheaf is a sheaf for the regular topology.
* `isSheaf_iff_preservesFiniteProducts`: In a finitary extensive category, the sheaves for the
extensive topology are precisely those preserving finite products.
-/
universe v u w
namespace CategoryTheory
open Limits
variable (C : Type u) [Category.{v} C]
/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like `Stonean`).
-/
class Preregular : Prop where
/--
For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
commute.
```
W --i-→ Z
| |
h g
↓ ↓
X --f-→ Y
```
-/
exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
(∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)
instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where
exists_fac {X Y Z} f g _ := by
have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g)
simp only [exists_const] at hp
rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp
obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance
refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩
ext b
simpa using hι b
/--
The regular coverage on a regular category `C`.
-/
def regularCoverage [Preregular C] : Coverage C where
covering B := { S | ∃ (X : C) (f : X ⟶ B), S = Presieve.ofArrows (fun (_ : Unit) ↦ X)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f }
pullback := by
intro X Y f S ⟨Z, π, hπ, h_epi⟩
have := Preregular.exists_fac f π
obtain ⟨W, h, _, i, this⟩ := this
refine ⟨Presieve.singleton h, ⟨?_, ?_⟩⟩
· exact ⟨W, h, by {rw [Presieve.ofArrows_pUnit h]}, inferInstance⟩
· intro W g hg
cases hg
refine ⟨Z, i, π, ⟨?_, this⟩⟩
cases hπ
rw [Presieve.ofArrows_pUnit]
exact Presieve.singleton.mk
/--
The extensive coverage on an extensive category `C`
TODO: use general colimit API instead of `IsIso (Sigma.desc π)`
-/
def extensiveCoverage [FinitaryPreExtensive C] : Coverage C where
covering B := { S | ∃ (α : Type) (_ : Fintype α) (X : α → C) (π : (a : α) → (X a ⟶ B)),
S = Presieve.ofArrows X π ∧ IsIso (Sigma.desc π) }
pullback := by
intro X Y f S ⟨α, hα, Z, π, hS, h_iso⟩
let Z' : α → C := fun a ↦ pullback f (π a)
let π' : (a : α) → Z' a ⟶ Y := fun a ↦ pullback.fst
refine ⟨@Presieve.ofArrows C _ _ α Z' π', ⟨?_, ?_⟩⟩
· constructor
exact ⟨hα, Z', π', ⟨by simp only, FinitaryPreExtensive.sigma_desc_iso (fun x => π x) f h_iso⟩⟩
· intro W g hg
rcases hg with ⟨a⟩
refine ⟨Z a, pullback.snd, π a, ?_, by rw [CategoryTheory.Limits.pullback.condition]⟩
rw [hS]
exact Presieve.ofArrows.mk a
theorem effectiveEpi_desc_iff_effectiveEpiFamily [FinitaryPreExtensive C] {α : Type} [Fintype α]
{B : C} (X : α → C) (π : (a : α) → X a ⟶ B) :
EffectiveEpi (Sigma.desc π) ↔ EffectiveEpiFamily X π := by
exact ⟨fun h ↦ ⟨⟨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X π _ h _ _ (fun g ↦
(FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X a) g inferInstance).epi_of_iso)⟩⟩,
fun _ ↦ inferInstance⟩
instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where
pullback {B₁ B₂} f α _ X₁ π₁ h := by
refine ⟨α, inferInstance, ?_⟩
obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁)
let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a)
let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g
let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a)
have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance
refine ⟨X₂, π₂, ?_, ?_⟩
· have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp
rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this]
infer_instance
· refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩
simp only [id_eq, Category.assoc, ← hg]
rw [← Category.assoc, pullback.condition]
simp
/-- The union of the extensive and regular coverages generates the coherent topology on `C`. -/
lemma extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] :
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck =
(coherentTopology C) := by
ext B S
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· induction h with
| of Y T hT =>
apply Coverage.saturate.of
simp only [Coverage.sup_covering, Set.mem_union] at hT
exact Or.elim hT
(fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩)
(fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩)
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
· induction h with
| of Y T hT =>
obtain ⟨I, hI, X, f, ⟨h, hT⟩⟩ := hT
let φ := fun (i : I) ↦ Sigma.ι X i
let F := Sigma.desc f
let Z := Sieve.generate T
let Xs := (∐ fun (i : I) => X i)
let Zf := Sieve.generate (Presieve.ofArrows (fun (_ : Unit) ↦ Xs) (fun (_ : Unit) ↦ F))
apply Coverage.saturate.transitive Y Zf
· apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
exact Or.inr ⟨Xs, F, ⟨rfl, inferInstance⟩⟩
· intro R g hZfg
dsimp at hZfg
rw [Presieve.ofArrows_pUnit] at hZfg
obtain ⟨W, ψ, σ, ⟨hW, hW'⟩⟩ := hZfg
induction hW
rw [← hW', Sieve.pullback_comp Z]
suffices Sieve.pullback ψ ((Sieve.pullback F) Z) ∈ GrothendieckTopology.sieves
((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R by assumption
apply GrothendieckTopology.pullback_stable'
suffices Coverage.saturate ((extensiveCoverage C) ⊔ (regularCoverage C)) Xs
(Z.pullback F) by assumption
suffices : Sieve.generate (Presieve.ofArrows X φ) ≤ Z.pullback F
· apply Coverage.saturate_of_superset _ this
apply Coverage.saturate.of
simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union,
Set.mem_setOf_eq]
refine Or.inl ⟨I, hI, X, φ, ⟨rfl, ?_⟩⟩
suffices Sigma.desc φ = 𝟙 _ by rw [this]; infer_instance
ext
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app, Category.comp_id]
intro Q q hq
simp only [Sieve.pullback_apply, Sieve.generate_apply]
simp only [Sieve.generate_apply] at hq
obtain ⟨E, e, r, hq⟩ := hq
refine' ⟨E, e, r ≫ F, ⟨_, _⟩⟩
· rw [h]
induction hq.1
simp only [colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app]
exact Presieve.ofArrows.mk _
· rw [← hq.2]
simp only [Category.assoc]
| top => apply Coverage.saturate.top
| transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
section RegularSheaves
variable {C}
open Opposite Presieve
/-- A presieve is *regular* if it consists of a single effective epimorphism. -/
class Presieve.regular {X : C} (R : Presieve X) : Prop where
/-- `R` consists of a single epimorphism. -/
single_epi : ∃ (Y : C) (f : Y ⟶ X), R = Presieve.ofArrows (fun (_ : Unit) ↦ Y)
(fun (_ : Unit) ↦ f) ∧ EffectiveEpi f
namespace regularCoverage
/--
The map to the explicit equalizer used in the sheaf condition.
-/
def MapToEqualizer (P : Cᵒᵖ ⥤ Type (max u v)) {W X B : C} (f : X ⟶ B)
(g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) :
P.obj (op B) → { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := fun t ↦
⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← FunctorToTypes.map_comp_apply, ← op_comp, w]⟩
/--
The sheaf condition with respect to regular presieves, given the existence of the relavant pullback.
-/
def EqualizerCondition (P : Cᵒᵖ ⥤ Type (max u v)) : Prop :=
∀ (X B : C) (π : X ⟶ B) [EffectiveEpi π] [HasPullback π π], Function.Bijective
(MapToEqualizer P π (pullback.fst (f := π) (g := π)) (pullback.snd (f := π) (g := π))
pullback.condition)
lemma EqualizerCondition.isSheafFor {B : C} {S : Presieve B} [S.regular] [S.hasPullbacks]
{F : Cᵒᵖ ⥤ Type (max u v)}
(hF : EqualizerCondition F) : S.IsSheafFor F := by
obtain ⟨X, π, hS, πsurj⟩ := Presieve.regular.single_epi (R := S)
subst hS
rw [isSheafFor_arrows_iff_pullbacks]
intro y h
have : (Presieve.singleton π).hasPullbacks := by rw [← ofArrows_pUnit]; infer_instance
have : HasPullback π π := hasPullbacks.has_pullbacks Presieve.singleton.mk Presieve.singleton.mk
specialize hF X B π
rw [Function.bijective_iff_existsUnique] at hF
obtain ⟨t, ht, ht'⟩ := hF ⟨y (), h () ()⟩
refine ⟨t, fun _ ↦ ?_, fun x h ↦ ht' x ?_⟩
· simpa [MapToEqualizer] using ht
· simpa [MapToEqualizer] using h ()
lemma equalizerCondition_of_regular {F : Cᵒᵖ ⥤ Type (max u v)}
(hSF : ∀ {B : C} (S : Presieve B) [S.regular] [S.hasPullbacks], S.IsSheafFor F) :
EqualizerCondition F := by
intro X B π _ _
have : (ofArrows (fun _ ↦ X) (fun _ ↦ π)).regular := ⟨X, π, rfl, inferInstance⟩
have : (ofArrows (fun () ↦ X) (fun _ ↦ π)).hasPullbacks := ⟨
fun hf _ hg ↦ (by cases hf; cases hg; infer_instance)⟩
specialize hSF (ofArrows (fun () ↦ X) (fun _ ↦ π))
rw [isSheafFor_arrows_iff_pullbacks] at hSF
rw [Function.bijective_iff_existsUnique]
intro ⟨x, hx⟩
obtain ⟨t, ht, ht'⟩ := hSF (fun _ ↦ x) (fun _ _ ↦ hx)
refine ⟨t, ?_, fun y h ↦ ht' y ?_⟩
· simpa [MapToEqualizer] using ht ()
· simpa [MapToEqualizer] using h
lemma isSheafFor_regular_of_projective {X : C} (S : Presieve X) [S.regular] [Projective X]
(F : Cᵒᵖ ⥤ Type (max u v)) : S.IsSheafFor F := by
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
rw [isSheafFor_arrows_iff]
refine fun x hx ↦ ⟨F.map (Projective.factorThru (𝟙 _) f).op <| x (), fun _ ↦ ?_, fun y h ↦ ?_⟩
· simpa using (hx () () Y (𝟙 Y) (f ≫ (Projective.factorThru (𝟙 _) f)) (by simp)).symm
· simp only [← h (), ← FunctorToTypes.map_comp_apply, ← op_comp, Projective.factorThru_comp,
op_id, FunctorToTypes.map_id_apply]
lemma EqualizerCondition.isSheaf_iff (F : Cᵒᵖ ⥤ Type (max u v))
[∀ ⦃X Y : C⦄ (π : X ⟶ Y) [EffectiveEpi π], HasPullback π π] [Preregular C] :
Presieve.IsSheaf (regularCoverage C).toGrothendieck F ↔ EqualizerCondition F := by
rw [Presieve.isSheaf_coverage]
refine ⟨fun h ↦ equalizerCondition_of_regular fun S ⟨Y, f, hh⟩ _ ↦ h S ⟨Y, f, hh⟩, ?_⟩
rintro h X S ⟨Y, f, rfl, hf⟩
exact @isSheafFor _ _ _ _ ⟨Y, f, rfl, hf⟩ ⟨fun g _ h ↦ by cases g; cases h; infer_instance⟩ _ h
lemma isSheaf_of_projective (F : Cᵒᵖ ⥤ Type (max u v)) [Preregular C] [∀ (X : C), Projective X] :
IsSheaf (regularCoverage C).toGrothendieck F :=
(isSheaf_coverage _ _).mpr fun S ⟨_, h⟩ ↦ have : S.regular := ⟨_, h⟩
isSheafFor_regular_of_projective _ _
/-- Every Yoneda-presheaf is a sheaf for the regular topology. -/
theorem isSheaf_yoneda_obj [Preregular C] (W : C) :
Presieve.IsSheaf (regularCoverage C).toGrothendieck (yoneda.obj W) := by
rw [isSheaf_coverage]
intro X S ⟨_, hS⟩
have : S.regular := ⟨_, hS⟩
obtain ⟨Y, f, rfl, hf⟩ := Presieve.regular.single_epi (R := S)
have h_colim := isColimitOfEffectiveEpiStruct f hf.effectiveEpi.some
rw [← Sieve.generateSingleton_eq, ← Presieve.ofArrows_pUnit] at h_colim
intro x hx
let x_ext := Presieve.FamilyOfElements.sieveExtend x
have hx_ext := Presieve.FamilyOfElements.Compatible.sieveExtend hx
let S := Sieve.generate (Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))
obtain ⟨t, t_amalg, t_uniq⟩ :=
(Sieve.forallYonedaIsSheaf_iff_colimit S).mpr ⟨h_colim⟩ W x_ext hx_ext
refine ⟨t, ?_, ?_⟩
· convert Presieve.isAmalgamation_restrict (Sieve.le_generate
(Presieve.ofArrows (fun () ↦ Y) (fun () ↦ f))) _ _ t_amalg
exact (Presieve.restrict_extend hx).symm
· exact fun y hy ↦ t_uniq y <| Presieve.isAmalgamation_sieveExtend x y hy
/-- The regular topology on any preregular category is subcanonical. -/
theorem subcanonical [Preregular C] : Sheaf.Subcanonical (regularCoverage C).toGrothendieck :=
Sheaf.Subcanonical.of_yoneda_isSheaf _ isSheaf_yoneda_obj
end regularCoverage
end RegularSheaves
section ExtensiveSheaves
variable [FinitaryPreExtensive C] {C}
/-- A presieve is *extensive* if it is finite and its arrows induce an isomorphism from the
coproduct to the target. -/
class Presieve.extensive {X : C} (R : Presieve X) :
Prop where
/-- `R` consists of a finite collection of arrows that together induce an isomorphism from the
coproduct of their sources. -/
arrows_nonempty_isColimit : ∃ (α : Type) (_ : Fintype α) (Z : α → C) (π : (a : α) → (Z a ⟶ X)),
R = Presieve.ofArrows Z π ∧ Nonempty (IsColimit (Cofan.mk X π))
instance {X : C} (S : Presieve X) [S.extensive] : S.hasPullbacks where
has_pullbacks := by
obtain ⟨_, _, _, _, rfl, ⟨hc⟩⟩ := Presieve.extensive.arrows_nonempty_isColimit (R := S)
intro _ _ _ _ _ hg
cases hg
apply FinitaryPreExtensive.hasPullbacks_of_is_coproduct hc
instance {α : Type} [Fintype α] {Z : α → C} {F : C ⥤ Type w}
[PreservesFiniteProducts F] : PreservesLimit (Discrete.functor fun a => (Z a)) F :=
(PreservesFiniteProducts.preserves α).preservesLimit
open Presieve Opposite
/--
A finite product preserving presheaf is a sheaf for the extensive topology on a category which is
`FinitaryPreExtensive`.
-/
theorem isSheafFor_extensive_of_preservesFiniteProducts {X : C} (S : Presieve X) [S.extensive]
(F : Cᵒᵖ ⥤ Type max u v) [PreservesFiniteProducts F] : S.IsSheafFor F := by
obtain ⟨_, _, Z, π, rfl, ⟨hc⟩⟩ := extensive.arrows_nonempty_isColimit (R := S)
have : (ofArrows Z (Cofan.mk X π).inj).hasPullbacks :=
(inferInstance : (ofArrows Z π).hasPullbacks)
exact isSheafFor_of_preservesProduct _ _ hc
instance {α : Type} [Fintype α] (Z : α → C) : (ofArrows Z (fun i ↦ Sigma.ι Z i)).extensive :=
⟨⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ⟨coproductIsCoproduct _⟩⟩⟩
/--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) := by
refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩
· rw [Presieve.isSheaf_coverage] at hF
let Z : α → C := fun i ↦ unop (K.obj ⟨i⟩)
have : (Presieve.ofArrows Z (Cofan.mk (∐ Z) (Sigma.ι Z)).inj).hasPullbacks :=
(inferInstance : (Presieve.ofArrows Z (Sigma.ι Z)).hasPullbacks)
have : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i) :=
(inferInstance : ∀ (i : α), Mono (Sigma.ι Z i))
let i : K ≅ Discrete.functor (fun i ↦ op (Z i)) := Discrete.natIsoFunctor
let _ : PreservesLimit (Discrete.functor (fun i ↦ op (Z i))) F :=
Presieve.preservesProductOfIsSheafFor F ?_ initialIsInitial _ (coproductIsCoproduct Z)
(FinitaryExtensive.isPullback_initial_to_sigma_ι Z)
(hF (Presieve.ofArrows Z (fun i ↦ Sigma.ι Z i)) ?_)
· exact preservesLimitOfIsoDiagram F i.symm
· apply hF
refine ⟨Empty, inferInstance, Empty.elim, IsEmpty.elim inferInstance, rfl, ⟨default,?_, ?_⟩⟩
· ext b
cases b
· simp only [eq_iff_true_of_subsingleton]
· refine ⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ?_⟩
suffices Sigma.desc (fun i ↦ Sigma.ι Z i) = 𝟙 _ by rw [this]; infer_instance
ext
simp
· let _ := hF.some
rw [Presieve.isSheaf_coverage]
intro X R ⟨Y, α, Z, π, hR, hi⟩
have : IsIso (Sigma.desc (Cofan.inj (Cofan.mk X π))) := hi
have : R.extensive := ⟨Y, α, Z, π, hR, ⟨Cofan.isColimitOfIsIsoSigmaDesc (Cofan.mk X π)⟩⟩
| exact isSheafFor_extensive_of_preservesFiniteProducts R F | /--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) := by
refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩
· rw [Presieve.isSheaf_coverage] at hF
let Z : α → C := fun i ↦ unop (K.obj ⟨i⟩)
have : (Presieve.ofArrows Z (Cofan.mk (∐ Z) (Sigma.ι Z)).inj).hasPullbacks :=
(inferInstance : (Presieve.ofArrows Z (Sigma.ι Z)).hasPullbacks)
have : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i) :=
(inferInstance : ∀ (i : α), Mono (Sigma.ι Z i))
let i : K ≅ Discrete.functor (fun i ↦ op (Z i)) := Discrete.natIsoFunctor
let _ : PreservesLimit (Discrete.functor (fun i ↦ op (Z i))) F :=
Presieve.preservesProductOfIsSheafFor F ?_ initialIsInitial _ (coproductIsCoproduct Z)
(FinitaryExtensive.isPullback_initial_to_sigma_ι Z)
(hF (Presieve.ofArrows Z (fun i ↦ Sigma.ι Z i)) ?_)
· exact preservesLimitOfIsoDiagram F i.symm
· apply hF
refine ⟨Empty, inferInstance, Empty.elim, IsEmpty.elim inferInstance, rfl, ⟨default,?_, ?_⟩⟩
· ext b
cases b
· simp only [eq_iff_true_of_subsingleton]
· refine ⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ?_⟩
suffices Sigma.desc (fun i ↦ Sigma.ι Z i) = 𝟙 _ by rw [this]; infer_instance
ext
simp
· let _ := hF.some
rw [Presieve.isSheaf_coverage]
intro X R ⟨Y, α, Z, π, hR, hi⟩
have : IsIso (Sigma.desc (Cofan.inj (Cofan.mk X π))) := hi
have : R.extensive := ⟨Y, α, Z, π, hR, ⟨Cofan.isColimitOfIsIsoSigmaDesc (Cofan.mk X π)⟩⟩
| Mathlib.CategoryTheory.Sites.RegularExtensive.366_0.rkSRr0zuqme90Yu | /--
A presheaf on a category which is `FinitaryExtensive` is a sheaf iff it preserves finite products.
-/
theorem isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type max u v) :
Presieve.IsSheaf (extensiveCoverage C).toGrothendieck F ↔
Nonempty (PreservesFiniteProducts F) | Mathlib_CategoryTheory_Sites_RegularExtensive |
R : Type u_1
inst✝² : CommRing R
S : Submonoid R
P : Type u_2
inst✝¹ : CommRing P
inst✝ : Algebra R P
loc : IsLocalization S P
p : FractionalIdeal S P
s : Set P
hs : s = ↑p
⊢ IsFractional S (Submodule.copy (↑p) s hs) | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R → FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `R⁰ = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal R⁰ K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal R⁰ K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I ⊆ R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (⊔)` and `⊥ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `↑I + ↑J = ↑(I + J)` and `↑⊥ = ↑0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `R⁰`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I ⊆ R` for some `a ≠ 0`. -/
def IsFractional (I : Submodule R P) :=
∃ a ∈ S, ∀ b ∈ I, IsInteger R (a • b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a ∈ R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I ⊆ P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I ⊆ R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `∃ a, a I ⊆ R`.
This implements the coercion `FractionalIdeal S P → Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `∃ a, a I ⊆ R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R → Submodule R P`
(which we use to define `coe : Ideal R → FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
⟨coeToSubmodule⟩
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := ↑(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x ∈ (I : Submodule R P) ↔ x ∈ I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (∀ x, x ∈ I ↔ x ∈ J) → I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = ↑p) : FractionalIdeal S P :=
⟨Submodule.copy p s hs, by
| convert p.isFractional | /-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = ↑p) : FractionalIdeal S P :=
⟨Submodule.copy p s hs, by
| Mathlib.RingTheory.FractionalIdeal.153_0.90B1BH8AtSmfl9S | /-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = ↑p) : FractionalIdeal S P | Mathlib_RingTheory_FractionalIdeal |
case h.e'_7
R : Type u_1
inst✝² : CommRing R
S : Submonoid R
P : Type u_2
inst✝¹ : CommRing P
inst✝ : Algebra R P
loc : IsLocalization S P
p : FractionalIdeal S P
s : Set P
hs : s = ↑p
⊢ Submodule.copy (↑p) s hs = ↑p | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R → FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `R⁰ = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal R⁰ K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal R⁰ K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I ⊆ R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (⊔)` and `⊥ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `↑I + ↑J = ↑(I + J)` and `↑⊥ = ↑0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `R⁰`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I ⊆ R` for some `a ≠ 0`. -/
def IsFractional (I : Submodule R P) :=
∃ a ∈ S, ∀ b ∈ I, IsInteger R (a • b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a ∈ R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I ⊆ P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I ⊆ R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `∃ a, a I ⊆ R`.
This implements the coercion `FractionalIdeal S P → Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `∃ a, a I ⊆ R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R → Submodule R P`
(which we use to define `coe : Ideal R → FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
⟨coeToSubmodule⟩
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := ↑(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x ∈ (I : Submodule R P) ↔ x ∈ I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (∀ x, x ∈ I ↔ x ∈ J) → I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = ↑p) : FractionalIdeal S P :=
⟨Submodule.copy p s hs, by
convert p.isFractional
| ext | /-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = ↑p) : FractionalIdeal S P :=
⟨Submodule.copy p s hs, by
convert p.isFractional
| Mathlib.RingTheory.FractionalIdeal.153_0.90B1BH8AtSmfl9S | /-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = ↑p) : FractionalIdeal S P | Mathlib_RingTheory_FractionalIdeal |
case h.e'_7.h
R : Type u_1
inst✝² : CommRing R
S : Submonoid R
P : Type u_2
inst✝¹ : CommRing P
inst✝ : Algebra R P
loc : IsLocalization S P
p : FractionalIdeal S P
s : Set P
hs : s = ↑p
x✝ : P
⊢ x✝ ∈ Submodule.copy (↑p) s hs ↔ x✝ ∈ ↑p | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R → FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `R⁰ = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal R⁰ K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal R⁰ K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I ⊆ R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (⊔)` and `⊥ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `↑I + ↑J = ↑(I + J)` and `↑⊥ = ↑0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `R⁰`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I ⊆ R` for some `a ≠ 0`. -/
def IsFractional (I : Submodule R P) :=
∃ a ∈ S, ∀ b ∈ I, IsInteger R (a • b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a ∈ R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I ⊆ P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I ⊆ R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `∃ a, a I ⊆ R`.
This implements the coercion `FractionalIdeal S P → Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `∃ a, a I ⊆ R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R → Submodule R P`
(which we use to define `coe : Ideal R → FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
⟨coeToSubmodule⟩
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := ↑(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x ∈ (I : Submodule R P) ↔ x ∈ I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (∀ x, x ∈ I ↔ x ∈ J) → I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = ↑p) : FractionalIdeal S P :=
⟨Submodule.copy p s hs, by
convert p.isFractional
ext
| simp only [hs] | /-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = ↑p) : FractionalIdeal S P :=
⟨Submodule.copy p s hs, by
convert p.isFractional
ext
| Mathlib.RingTheory.FractionalIdeal.153_0.90B1BH8AtSmfl9S | /-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = ↑p) : FractionalIdeal S P | Mathlib_RingTheory_FractionalIdeal |
case h.e'_7.h
R : Type u_1
inst✝² : CommRing R
S : Submonoid R
P : Type u_2
inst✝¹ : CommRing P
inst✝ : Algebra R P
loc : IsLocalization S P
p : FractionalIdeal S P
s : Set P
hs : s = ↑p
x✝ : P
⊢ x✝ ∈ Submodule.copy ↑p ↑p (_ : ↑p = ↑↑p) ↔ x✝ ∈ ↑p | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R → FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `R⁰ = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal R⁰ K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal R⁰ K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I ⊆ R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (⊔)` and `⊥ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `↑I + ↑J = ↑(I + J)` and `↑⊥ = ↑0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `R⁰`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I ⊆ R` for some `a ≠ 0`. -/
def IsFractional (I : Submodule R P) :=
∃ a ∈ S, ∀ b ∈ I, IsInteger R (a • b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a ∈ R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I ⊆ P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I ⊆ R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `∃ a, a I ⊆ R`.
This implements the coercion `FractionalIdeal S P → Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `∃ a, a I ⊆ R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R → Submodule R P`
(which we use to define `coe : Ideal R → FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
⟨coeToSubmodule⟩
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := ↑(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x ∈ (I : Submodule R P) ↔ x ∈ I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (∀ x, x ∈ I ↔ x ∈ J) → I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = ↑p) : FractionalIdeal S P :=
⟨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
| rfl | /-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = ↑p) : FractionalIdeal S P :=
⟨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
| Mathlib.RingTheory.FractionalIdeal.153_0.90B1BH8AtSmfl9S | /-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = ↑p) : FractionalIdeal S P | Mathlib_RingTheory_FractionalIdeal |
R : Type u_1
inst✝² : CommRing R
S : Submonoid R
P : Type u_2
inst✝¹ : CommRing P
inst✝ : Algebra R P
loc : IsLocalization S P
I : Submodule R P
h : I ≤ 1
⊢ IsFractional S I | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R → FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `R⁰ = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal R⁰ K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal R⁰ K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I ⊆ R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (⊔)` and `⊥ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `↑I + ↑J = ↑(I + J)` and `↑⊥ = ↑0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `R⁰`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I ⊆ R` for some `a ≠ 0`. -/
def IsFractional (I : Submodule R P) :=
∃ a ∈ S, ∀ b ∈ I, IsInteger R (a • b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a ∈ R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I ⊆ P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I ⊆ R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `∃ a, a I ⊆ R`.
This implements the coercion `FractionalIdeal S P → Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `∃ a, a I ⊆ R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R → Submodule R P`
(which we use to define `coe : Ideal R → FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
⟨coeToSubmodule⟩
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := ↑(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x ∈ (I : Submodule R P) ↔ x ∈ I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (∀ x, x ∈ I ↔ x ∈ J) → I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = ↑p) : FractionalIdeal S P :=
⟨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rfl⟩
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = ↑p) : ↑(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = ↑p) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule ⟨I, hI⟩ = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) ↦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J ↔ I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I ≤ 1) : IsFractional S I := by
| use 1, S.one_mem | theorem isFractional_of_le_one (I : Submodule R P) (h : I ≤ 1) : IsFractional S I := by
| Mathlib.RingTheory.FractionalIdeal.206_0.90B1BH8AtSmfl9S | theorem isFractional_of_le_one (I : Submodule R P) (h : I ≤ 1) : IsFractional S I | Mathlib_RingTheory_FractionalIdeal |
case right
R : Type u_1
inst✝² : CommRing R
S : Submonoid R
P : Type u_2
inst✝¹ : CommRing P
inst✝ : Algebra R P
loc : IsLocalization S P
I : Submodule R P
h : I ≤ 1
⊢ ∀ b ∈ I, IsInteger R (1 • b) | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R → FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `R⁰ = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal R⁰ K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal R⁰ K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I ⊆ R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (⊔)` and `⊥ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `↑I + ↑J = ↑(I + J)` and `↑⊥ = ↑0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `R⁰`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I ⊆ R` for some `a ≠ 0`. -/
def IsFractional (I : Submodule R P) :=
∃ a ∈ S, ∀ b ∈ I, IsInteger R (a • b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a ∈ R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I ⊆ P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I ⊆ R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `∃ a, a I ⊆ R`.
This implements the coercion `FractionalIdeal S P → Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `∃ a, a I ⊆ R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R → Submodule R P`
(which we use to define `coe : Ideal R → FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
⟨coeToSubmodule⟩
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := ↑(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x ∈ (I : Submodule R P) ↔ x ∈ I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (∀ x, x ∈ I ↔ x ∈ J) → I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = ↑p) : FractionalIdeal S P :=
⟨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rfl⟩
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = ↑p) : ↑(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = ↑p) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule ⟨I, hI⟩ = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) ↦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J ↔ I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I ≤ 1) : IsFractional S I := by
use 1, S.one_mem
| intro b hb | theorem isFractional_of_le_one (I : Submodule R P) (h : I ≤ 1) : IsFractional S I := by
use 1, S.one_mem
| Mathlib.RingTheory.FractionalIdeal.206_0.90B1BH8AtSmfl9S | theorem isFractional_of_le_one (I : Submodule R P) (h : I ≤ 1) : IsFractional S I | Mathlib_RingTheory_FractionalIdeal |
case right
R : Type u_1
inst✝² : CommRing R
S : Submonoid R
P : Type u_2
inst✝¹ : CommRing P
inst✝ : Algebra R P
loc : IsLocalization S P
I : Submodule R P
h : I ≤ 1
b : P
hb : b ∈ I
⊢ IsInteger R (1 • b) | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R → FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `R⁰ = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal R⁰ K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal R⁰ K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I ⊆ R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (⊔)` and `⊥ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `↑I + ↑J = ↑(I + J)` and `↑⊥ = ↑0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `R⁰`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I ⊆ R` for some `a ≠ 0`. -/
def IsFractional (I : Submodule R P) :=
∃ a ∈ S, ∀ b ∈ I, IsInteger R (a • b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a ∈ R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I ⊆ P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I ⊆ R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `∃ a, a I ⊆ R`.
This implements the coercion `FractionalIdeal S P → Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `∃ a, a I ⊆ R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R → Submodule R P`
(which we use to define `coe : Ideal R → FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
⟨coeToSubmodule⟩
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := ↑(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x ∈ (I : Submodule R P) ↔ x ∈ I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (∀ x, x ∈ I ↔ x ∈ J) → I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = ↑p) : FractionalIdeal S P :=
⟨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rfl⟩
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = ↑p) : ↑(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = ↑p) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule ⟨I, hI⟩ = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) ↦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J ↔ I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I ≤ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
| rw [one_smul] | theorem isFractional_of_le_one (I : Submodule R P) (h : I ≤ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
| Mathlib.RingTheory.FractionalIdeal.206_0.90B1BH8AtSmfl9S | theorem isFractional_of_le_one (I : Submodule R P) (h : I ≤ 1) : IsFractional S I | Mathlib_RingTheory_FractionalIdeal |
case right
R : Type u_1
inst✝² : CommRing R
S : Submonoid R
P : Type u_2
inst✝¹ : CommRing P
inst✝ : Algebra R P
loc : IsLocalization S P
I : Submodule R P
h : I ≤ 1
b : P
hb : b ∈ I
⊢ IsInteger R b | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R → FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `R⁰ = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal R⁰ K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal R⁰ K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I ⊆ R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (⊔)` and `⊥ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `↑I + ↑J = ↑(I + J)` and `↑⊥ = ↑0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `R⁰`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I ⊆ R` for some `a ≠ 0`. -/
def IsFractional (I : Submodule R P) :=
∃ a ∈ S, ∀ b ∈ I, IsInteger R (a • b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a ∈ R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I ⊆ P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I ⊆ R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `∃ a, a I ⊆ R`.
This implements the coercion `FractionalIdeal S P → Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `∃ a, a I ⊆ R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R → Submodule R P`
(which we use to define `coe : Ideal R → FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
⟨coeToSubmodule⟩
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := ↑(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x ∈ (I : Submodule R P) ↔ x ∈ I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (∀ x, x ∈ I ↔ x ∈ J) → I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = ↑p) : FractionalIdeal S P :=
⟨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rfl⟩
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = ↑p) : ↑(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = ↑p) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule ⟨I, hI⟩ = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) ↦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J ↔ I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I ≤ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
| obtain ⟨b', b'_mem, rfl⟩ := h hb | theorem isFractional_of_le_one (I : Submodule R P) (h : I ≤ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
| Mathlib.RingTheory.FractionalIdeal.206_0.90B1BH8AtSmfl9S | theorem isFractional_of_le_one (I : Submodule R P) (h : I ≤ 1) : IsFractional S I | Mathlib_RingTheory_FractionalIdeal |
case right.intro.refl
R : Type u_1
inst✝² : CommRing R
S : Submonoid R
P : Type u_2
inst✝¹ : CommRing P
inst✝ : Algebra R P
loc : IsLocalization S P
I : Submodule R P
h : I ≤ 1
b' : R
hb : (Algebra.linearMap R P) b' ∈ I
⊢ IsInteger R ((Algebra.linearMap R P) b') | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R → FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `R⁰ = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal R⁰ K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal R⁰ K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I ⊆ R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (⊔)` and `⊥ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `↑I + ↑J = ↑(I + J)` and `↑⊥ = ↑0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `R⁰`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I ⊆ R` for some `a ≠ 0`. -/
def IsFractional (I : Submodule R P) :=
∃ a ∈ S, ∀ b ∈ I, IsInteger R (a • b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a ∈ R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I ⊆ P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I ⊆ R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `∃ a, a I ⊆ R`.
This implements the coercion `FractionalIdeal S P → Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `∃ a, a I ⊆ R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R → Submodule R P`
(which we use to define `coe : Ideal R → FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
⟨coeToSubmodule⟩
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := ↑(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x ∈ (I : Submodule R P) ↔ x ∈ I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (∀ x, x ∈ I ↔ x ∈ J) → I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = ↑p) : FractionalIdeal S P :=
⟨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rfl⟩
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = ↑p) : ↑(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = ↑p) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule ⟨I, hI⟩ = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) ↦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J ↔ I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I ≤ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain ⟨b', b'_mem, rfl⟩ := h hb
| exact Set.mem_range_self b' | theorem isFractional_of_le_one (I : Submodule R P) (h : I ≤ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain ⟨b', b'_mem, rfl⟩ := h hb
| Mathlib.RingTheory.FractionalIdeal.206_0.90B1BH8AtSmfl9S | theorem isFractional_of_le_one (I : Submodule R P) (h : I ≤ 1) : IsFractional S I | Mathlib_RingTheory_FractionalIdeal |
R : Type u_1
inst✝² : CommRing R
S : Submonoid R
P : Type u_2
inst✝¹ : CommRing P
inst✝ : Algebra R P
loc : IsLocalization S P
I : Submodule R P
J : FractionalIdeal S P
hIJ : I ≤ ↑J
⊢ IsFractional S I | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R → FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `R⁰ = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal R⁰ K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal R⁰ K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I ⊆ R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (⊔)` and `⊥ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `↑I + ↑J = ↑(I + J)` and `↑⊥ = ↑0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `R⁰`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I ⊆ R` for some `a ≠ 0`. -/
def IsFractional (I : Submodule R P) :=
∃ a ∈ S, ∀ b ∈ I, IsInteger R (a • b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a ∈ R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I ⊆ P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I ⊆ R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `∃ a, a I ⊆ R`.
This implements the coercion `FractionalIdeal S P → Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `∃ a, a I ⊆ R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R → Submodule R P`
(which we use to define `coe : Ideal R → FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
⟨coeToSubmodule⟩
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := ↑(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x ∈ (I : Submodule R P) ↔ x ∈ I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (∀ x, x ∈ I ↔ x ∈ J) → I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = ↑p) : FractionalIdeal S P :=
⟨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rfl⟩
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = ↑p) : ↑(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = ↑p) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule ⟨I, hI⟩ = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) ↦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J ↔ I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I ≤ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain ⟨b', b'_mem, rfl⟩ := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I ≤ J) :
IsFractional S I := by
| obtain ⟨a, a_mem, ha⟩ := J.isFractional | theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I ≤ J) :
IsFractional S I := by
| Mathlib.RingTheory.FractionalIdeal.214_0.90B1BH8AtSmfl9S | theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I ≤ J) :
IsFractional S I | Mathlib_RingTheory_FractionalIdeal |
case intro.intro
R : Type u_1
inst✝² : CommRing R
S : Submonoid R
P : Type u_2
inst✝¹ : CommRing P
inst✝ : Algebra R P
loc : IsLocalization S P
I : Submodule R P
J : FractionalIdeal S P
hIJ : I ≤ ↑J
a : R
a_mem : a ∈ S
ha : ∀ b ∈ ↑J, IsInteger R (a • b)
⊢ IsFractional S I | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R → FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `R⁰ = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal R⁰ K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal R⁰ K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I ⊆ R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (⊔)` and `⊥ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `↑I + ↑J = ↑(I + J)` and `↑⊥ = ↑0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `R⁰`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I ⊆ R` for some `a ≠ 0`. -/
def IsFractional (I : Submodule R P) :=
∃ a ∈ S, ∀ b ∈ I, IsInteger R (a • b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a ∈ R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I ⊆ P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I ⊆ R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `∃ a, a I ⊆ R`.
This implements the coercion `FractionalIdeal S P → Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `∃ a, a I ⊆ R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R → Submodule R P`
(which we use to define `coe : Ideal R → FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
⟨coeToSubmodule⟩
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := ↑(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x ∈ (I : Submodule R P) ↔ x ∈ I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (∀ x, x ∈ I ↔ x ∈ J) → I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = ↑p) : FractionalIdeal S P :=
⟨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rfl⟩
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = ↑p) : ↑(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = ↑p) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule ⟨I, hI⟩ = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) ↦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J ↔ I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I ≤ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain ⟨b', b'_mem, rfl⟩ := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I ≤ J) :
IsFractional S I := by
obtain ⟨a, a_mem, ha⟩ := J.isFractional
| use a, a_mem | theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I ≤ J) :
IsFractional S I := by
obtain ⟨a, a_mem, ha⟩ := J.isFractional
| Mathlib.RingTheory.FractionalIdeal.214_0.90B1BH8AtSmfl9S | theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I ≤ J) :
IsFractional S I | Mathlib_RingTheory_FractionalIdeal |
case right
R : Type u_1
inst✝² : CommRing R
S : Submonoid R
P : Type u_2
inst✝¹ : CommRing P
inst✝ : Algebra R P
loc : IsLocalization S P
I : Submodule R P
J : FractionalIdeal S P
hIJ : I ≤ ↑J
a : R
a_mem : a ∈ S
ha : ∀ b ∈ ↑J, IsInteger R (a • b)
⊢ ∀ b ∈ I, IsInteger R (a • b) | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R → FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `R⁰ = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal R⁰ K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal R⁰ K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I ⊆ R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (⊔)` and `⊥ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `↑I + ↑J = ↑(I + J)` and `↑⊥ = ↑0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `R⁰`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I ⊆ R` for some `a ≠ 0`. -/
def IsFractional (I : Submodule R P) :=
∃ a ∈ S, ∀ b ∈ I, IsInteger R (a • b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a ∈ R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I ⊆ P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I ⊆ R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `∃ a, a I ⊆ R`.
This implements the coercion `FractionalIdeal S P → Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `∃ a, a I ⊆ R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R → Submodule R P`
(which we use to define `coe : Ideal R → FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
⟨coeToSubmodule⟩
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := ↑(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x ∈ (I : Submodule R P) ↔ x ∈ I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (∀ x, x ∈ I ↔ x ∈ J) → I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = ↑p) : FractionalIdeal S P :=
⟨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rfl⟩
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = ↑p) : ↑(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = ↑p) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule ⟨I, hI⟩ = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) ↦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J ↔ I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I ≤ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain ⟨b', b'_mem, rfl⟩ := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I ≤ J) :
IsFractional S I := by
obtain ⟨a, a_mem, ha⟩ := J.isFractional
use a, a_mem
| intro b b_mem | theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I ≤ J) :
IsFractional S I := by
obtain ⟨a, a_mem, ha⟩ := J.isFractional
use a, a_mem
| Mathlib.RingTheory.FractionalIdeal.214_0.90B1BH8AtSmfl9S | theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I ≤ J) :
IsFractional S I | Mathlib_RingTheory_FractionalIdeal |
case right
R : Type u_1
inst✝² : CommRing R
S : Submonoid R
P : Type u_2
inst✝¹ : CommRing P
inst✝ : Algebra R P
loc : IsLocalization S P
I : Submodule R P
J : FractionalIdeal S P
hIJ : I ≤ ↑J
a : R
a_mem : a ∈ S
ha : ∀ b ∈ ↑J, IsInteger R (a • b)
b : P
b_mem : b ∈ I
⊢ IsInteger R (a • b) | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R → FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `R⁰ = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal R⁰ K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal R⁰ K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I ⊆ R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (⊔)` and `⊥ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `↑I + ↑J = ↑(I + J)` and `↑⊥ = ↑0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `R⁰`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I ⊆ R` for some `a ≠ 0`. -/
def IsFractional (I : Submodule R P) :=
∃ a ∈ S, ∀ b ∈ I, IsInteger R (a • b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a ∈ R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I ⊆ P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I ⊆ R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `∃ a, a I ⊆ R`.
This implements the coercion `FractionalIdeal S P → Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `∃ a, a I ⊆ R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R → Submodule R P`
(which we use to define `coe : Ideal R → FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
⟨coeToSubmodule⟩
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := ↑(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x ∈ (I : Submodule R P) ↔ x ∈ I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (∀ x, x ∈ I ↔ x ∈ J) → I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = ↑p) : FractionalIdeal S P :=
⟨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rfl⟩
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = ↑p) : ↑(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = ↑p) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule ⟨I, hI⟩ = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) ↦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J ↔ I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I ≤ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain ⟨b', b'_mem, rfl⟩ := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I ≤ J) :
IsFractional S I := by
obtain ⟨a, a_mem, ha⟩ := J.isFractional
use a, a_mem
intro b b_mem
| exact ha b (hIJ b_mem) | theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I ≤ J) :
IsFractional S I := by
obtain ⟨a, a_mem, ha⟩ := J.isFractional
use a, a_mem
intro b b_mem
| Mathlib.RingTheory.FractionalIdeal.214_0.90B1BH8AtSmfl9S | theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I ≤ J) :
IsFractional S I | Mathlib_RingTheory_FractionalIdeal |
R : Type u_1
inst✝² : CommRing R
S : Submonoid R
P : Type u_2
inst✝¹ : CommRing P
inst✝ : Algebra R P
loc : IsLocalization S P
I : Ideal R
⊢ coeSubmodule P I ≤ 1 | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R → FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `R⁰ = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal R⁰ K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal R⁰ K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I ⊆ R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (⊔)` and `⊥ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `↑I + ↑J = ↑(I + J)` and `↑⊥ = ↑0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `R⁰`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I ⊆ R` for some `a ≠ 0`. -/
def IsFractional (I : Submodule R P) :=
∃ a ∈ S, ∀ b ∈ I, IsInteger R (a • b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a ∈ R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I ⊆ P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I ⊆ R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `∃ a, a I ⊆ R`.
This implements the coercion `FractionalIdeal S P → Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `∃ a, a I ⊆ R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R → Submodule R P`
(which we use to define `coe : Ideal R → FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
⟨coeToSubmodule⟩
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := ↑(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x ∈ (I : Submodule R P) ↔ x ∈ I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (∀ x, x ∈ I ↔ x ∈ J) → I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = ↑p) : FractionalIdeal S P :=
⟨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rfl⟩
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = ↑p) : ↑(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = ↑p) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule ⟨I, hI⟩ = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) ↦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J ↔ I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I ≤ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain ⟨b', b'_mem, rfl⟩ := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I ≤ J) :
IsFractional S I := by
obtain ⟨a, a_mem, ha⟩ := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R → FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
⟨coeSubmodule P I,
isFractional_of_le_one _ <| by | simpa using coeSubmodule_mono P (le_top : I ≤ ⊤) | /-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R → FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
⟨coeSubmodule P I,
isFractional_of_le_one _ <| by | Mathlib.RingTheory.FractionalIdeal.222_0.90B1BH8AtSmfl9S | /-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R → FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P | Mathlib_RingTheory_FractionalIdeal |
R : Type u_1
inst✝² : CommRing R
S : Submonoid R
P : Type u_2
inst✝¹ : CommRing P
inst✝ : Algebra R P
loc : IsLocalization S P
x : P
x✝ : x ∈ 0
x' : R
x'_mem_zero : x' ∈ ↑0
x'_eq_x : (Algebra.linearMap R P) x' = x
⊢ x = 0 | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R → FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `R⁰ = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal R⁰ K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal R⁰ K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I ⊆ R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (⊔)` and `⊥ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `↑I + ↑J = ↑(I + J)` and `↑⊥ = ↑0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `R⁰`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I ⊆ R` for some `a ≠ 0`. -/
def IsFractional (I : Submodule R P) :=
∃ a ∈ S, ∀ b ∈ I, IsInteger R (a • b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a ∈ R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I ⊆ P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I ⊆ R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `∃ a, a I ⊆ R`.
This implements the coercion `FractionalIdeal S P → Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `∃ a, a I ⊆ R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R → Submodule R P`
(which we use to define `coe : Ideal R → FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
⟨coeToSubmodule⟩
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := ↑(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x ∈ (I : Submodule R P) ↔ x ∈ I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (∀ x, x ∈ I ↔ x ∈ J) → I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = ↑p) : FractionalIdeal S P :=
⟨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rfl⟩
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = ↑p) : ↑(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = ↑p) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule ⟨I, hI⟩ = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) ↦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J ↔ I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I ≤ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain ⟨b', b'_mem, rfl⟩ := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I ≤ J) :
IsFractional S I := by
obtain ⟨a, a_mem, ha⟩ := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R → FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
⟨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I ≤ ⊤)⟩
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R → Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P → Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
⟨fun I => coeIdeal I⟩
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x ∈ (I : FractionalIdeal S P) ↔ ∃ x', x' ∈ I ∧ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x ∈ I) :
algebraMap R P x ∈ (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr ⟨x, hx, rfl⟩
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S ≤ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) ≤ J ↔ I ≤ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal R⁰ K) ≤ J ↔ I ≤ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
⟨(0 : Ideal R)⟩
@[simp]
theorem mem_zero_iff {x : P} : x ∈ (0 : FractionalIdeal S P) ↔ x = 0 :=
⟨fun ⟨x', x'_mem_zero, x'_eq_x⟩ => by
| have x'_eq_zero : x' = 0 := x'_mem_zero | @[simp]
theorem mem_zero_iff {x : P} : x ∈ (0 : FractionalIdeal S P) ↔ x = 0 :=
⟨fun ⟨x', x'_mem_zero, x'_eq_x⟩ => by
| Mathlib.RingTheory.FractionalIdeal.275_0.90B1BH8AtSmfl9S | @[simp]
theorem mem_zero_iff {x : P} : x ∈ (0 : FractionalIdeal S P) ↔ x = 0 | Mathlib_RingTheory_FractionalIdeal |
R : Type u_1
inst✝² : CommRing R
S : Submonoid R
P : Type u_2
inst✝¹ : CommRing P
inst✝ : Algebra R P
loc : IsLocalization S P
x : P
x✝ : x ∈ 0
x' : R
x'_mem_zero : x' ∈ ↑0
x'_eq_x : (Algebra.linearMap R P) x' = x
x'_eq_zero : x' = 0
⊢ x = 0 | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R → FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `R⁰ = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal R⁰ K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal R⁰ K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I ⊆ R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (⊔)` and `⊥ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `↑I + ↑J = ↑(I + J)` and `↑⊥ = ↑0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `R⁰`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I ⊆ R` for some `a ≠ 0`. -/
def IsFractional (I : Submodule R P) :=
∃ a ∈ S, ∀ b ∈ I, IsInteger R (a • b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a ∈ R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I ⊆ P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I ⊆ R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `∃ a, a I ⊆ R`.
This implements the coercion `FractionalIdeal S P → Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `∃ a, a I ⊆ R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R → Submodule R P`
(which we use to define `coe : Ideal R → FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
⟨coeToSubmodule⟩
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := ↑(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x ∈ (I : Submodule R P) ↔ x ∈ I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (∀ x, x ∈ I ↔ x ∈ J) → I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = ↑p) : FractionalIdeal S P :=
⟨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rfl⟩
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = ↑p) : ↑(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = ↑p) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule ⟨I, hI⟩ = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) ↦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J ↔ I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I ≤ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain ⟨b', b'_mem, rfl⟩ := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I ≤ J) :
IsFractional S I := by
obtain ⟨a, a_mem, ha⟩ := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R → FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
⟨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I ≤ ⊤)⟩
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R → Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P → Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
⟨fun I => coeIdeal I⟩
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x ∈ (I : FractionalIdeal S P) ↔ ∃ x', x' ∈ I ∧ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x ∈ I) :
algebraMap R P x ∈ (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr ⟨x, hx, rfl⟩
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S ≤ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) ≤ J ↔ I ≤ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal R⁰ K) ≤ J ↔ I ≤ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
⟨(0 : Ideal R)⟩
@[simp]
theorem mem_zero_iff {x : P} : x ∈ (0 : FractionalIdeal S P) ↔ x = 0 :=
⟨fun ⟨x', x'_mem_zero, x'_eq_x⟩ => by
have x'_eq_zero : x' = 0 := x'_mem_zero
| simp [x'_eq_x.symm, x'_eq_zero] | @[simp]
theorem mem_zero_iff {x : P} : x ∈ (0 : FractionalIdeal S P) ↔ x = 0 :=
⟨fun ⟨x', x'_mem_zero, x'_eq_x⟩ => by
have x'_eq_zero : x' = 0 := x'_mem_zero
| Mathlib.RingTheory.FractionalIdeal.275_0.90B1BH8AtSmfl9S | @[simp]
theorem mem_zero_iff {x : P} : x ∈ (0 : FractionalIdeal S P) ↔ x = 0 | Mathlib_RingTheory_FractionalIdeal |
Subsets and Splits