Skip to content

Commit cce210e

Browse files
committed
chore(CategoryTheory/Sites): rename Sheaf.isSheafFor_trans to Presieve.isSheafFor_trans and move to earlier file (leanprover-community#34924)
We move the lemmas `Sheaf.isSheafFor_trans` and `Sheaf.isSheafFor_bind` from `Mathlib/CategoryTheory/Sites/Canonical.lean` to `Mathlib/CategoryTheory/Sites/IsSheafFor.lean`, because they are more generally useful. We also change the names to match their content: - `Sheaf.isSheafFor_trans` -> `Presieve.isSheafFor_trans` - `Sheaf.isSheafFor_bind` -> `Presieve.isSheafFor_bind` Finally, we generalize the universe of the codomain of the presheaf in both lemmas.
1 parent de6d0d0 commit cce210e

2 files changed

Lines changed: 97 additions & 92 deletions

File tree

Mathlib/CategoryTheory/Sites/Canonical.lean

Lines changed: 5 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -45,100 +45,13 @@ open CategoryTheory Category Limits Sieve
4545

4646
variable {C : Type u} [Category.{v} C]
4747

48-
namespace Sheaf
49-
5048
variable {P : Cᵒᵖ ⥤ Type v} {X : C} (J : GrothendieckTopology C)
5149

52-
/--
53-
To show `P` is a sheaf for the binding of `U` with `B`, it suffices to show that `P` is a sheaf for
54-
`U`, that `P` is a sheaf for each sieve in `B`, and that it is separated for any pullback of any
55-
sieve in `B`.
50+
namespace Sheaf
5651

57-
This is mostly an auxiliary lemma to show `isSheafFor_trans`.
58-
Adapted from [Elephant], Lemma C2.1.7(i) with suggestions as mentioned in
59-
https://math.stackexchange.com/a/358709/
60-
-/
61-
theorem isSheafFor_bind (P : Cᵒᵖ ⥤ Type v) (U : Sieve X) (B : ∀ ⦃Y⦄ ⦃f : Y ⟶ X⦄, U f → Sieve Y)
62-
(hU : Presieve.IsSheafFor P (U : Presieve X))
63-
(hB : ∀ ⦃Y⦄ ⦃f : Y ⟶ X⦄ (hf : U f), Presieve.IsSheafFor P (B hf : Presieve Y))
64-
(hB' : ∀ ⦃Y⦄ ⦃f : Y ⟶ X⦄ (h : U f) ⦃Z⦄ (g : Z ⟶ Y),
65-
Presieve.IsSeparatedFor P (((B h).pullback g) : Presieve Z)) :
66-
Presieve.IsSheafFor P (Sieve.bind (U : Presieve X) B : Presieve X) := by
67-
intro s hs
68-
let y : ∀ ⦃Y⦄ ⦃f : Y ⟶ X⦄ (hf : U f), Presieve.FamilyOfElements P (B hf : Presieve Y) :=
69-
fun Y f hf Z g hg => s _ (Presieve.bind_comp _ _ hg)
70-
have hy : ∀ ⦃Y⦄ ⦃f : Y ⟶ X⦄ (hf : U f), (y hf).Compatible := by
71-
intro Y f H Y₁ Y₂ Z g₁ g₂ f₁ f₂ hf₁ hf₂ comm
72-
apply hs
73-
apply reassoc_of% comm
74-
let t : Presieve.FamilyOfElements P (U : Presieve X) :=
75-
fun Y f hf => (hB hf).amalgamate (y hf) (hy hf)
76-
have ht : ∀ ⦃Y⦄ ⦃f : Y ⟶ X⦄ (hf : U f), (y hf).IsAmalgamation (t f hf) := fun Y f hf =>
77-
(hB hf).isAmalgamation _
78-
have hT : t.Compatible := by
79-
rw [Presieve.compatible_iff_sieveCompatible]
80-
intro Z W f h hf
81-
apply (hB (U.downward_closed hf h)).isSeparatedFor.ext
82-
intro Y l hl
83-
apply (hB' hf (l ≫ h)).ext
84-
intro M m hm
85-
have : bind U B (m ≫ l ≫ h ≫ f) := by simpa using (Presieve.bind_comp f hf hm : bind U B _)
86-
trans s (m ≫ l ≫ h ≫ f) this
87-
· have := ht (U.downward_closed hf h) _ ((B _).downward_closed hl m)
88-
rw [op_comp, FunctorToTypes.map_comp_apply] at this
89-
grind
90-
· have h : s _ _ = _ := (ht hf _ hm).symm
91-
-- Porting note: this was done by `simp only [assoc] at`
92-
conv_lhs at h => congr; rw [assoc, assoc]
93-
rw [h]
94-
simp only [op_comp, assoc, FunctorToTypes.map_comp_apply]
95-
refine ⟨hU.amalgamate t hT, ?_, ?_⟩
96-
· rintro Z _ ⟨Y, f, g, hg, hf, rfl⟩
97-
rw [op_comp, FunctorToTypes.map_comp_apply, Presieve.IsSheafFor.valid_glue _ _ _ hg]
98-
apply ht hg _ hf
99-
· intro y hy
100-
apply hU.isSeparatedFor.ext
101-
intro Y f hf
102-
apply (hB hf).isSeparatedFor.ext
103-
intro Z g hg
104-
rw [← FunctorToTypes.map_comp_apply, ← op_comp, hy _ (Presieve.bind_comp _ _ hg),
105-
hU.valid_glue _ _ hf, ht hf _ hg]
106-
107-
/-- Given two sieves `R` and `S`, to show that `P` is a sheaf for `S`, we can show:
108-
* `P` is a sheaf for `R`
109-
* `P` is a sheaf for the pullback of `S` along any arrow in `R`
110-
* `P` is separated for the pullback of `R` along any arrow in `S`.
111-
112-
This is mostly an auxiliary lemma to construct `finestTopology`.
113-
Adapted from [Elephant], Lemma C2.1.7(ii) with suggestions as mentioned in
114-
https://math.stackexchange.com/a/358709
115-
-/
116-
theorem isSheafFor_trans (P : Cᵒᵖ ⥤ Type v) (R S : Sieve X)
117-
(hR : Presieve.IsSheafFor P (R : Presieve X))
118-
(hR' : ∀ ⦃Y⦄ ⦃f : Y ⟶ X⦄ (_ : S f), Presieve.IsSeparatedFor P (R.pullback f : Presieve Y))
119-
(hS : ∀ ⦃Y⦄ ⦃f : Y ⟶ X⦄ (_ : R f), Presieve.IsSheafFor P (S.pullback f : Presieve Y)) :
120-
Presieve.IsSheafFor P (S : Presieve X) := by
121-
have : (bind R fun Y f _ => S.pullback f : Presieve X) ≤ S := by
122-
rintro Z f ⟨W, f, g, hg, hf : S _, rfl⟩
123-
apply hf
124-
apply Presieve.isSheafFor_subsieve_aux P this
125-
· apply isSheafFor_bind _ _ _ hR hS
126-
intro Y f hf Z g
127-
rw [← pullback_comp]
128-
apply (hS (R.downward_closed hf _)).isSeparatedFor
129-
· intro Y f hf
130-
have : Sieve.pullback f (bind R fun T (k : T ⟶ X) (_ : R k) => pullback k S) =
131-
R.pullback f := by
132-
ext Z g
133-
constructor
134-
· rintro ⟨W, k, l, hl, _, comm⟩
135-
rw [pullback_apply, ← comm]
136-
simp [hl]
137-
· intro a
138-
refine ⟨Z, 𝟙 Z, _, a, ?_⟩
139-
simp [hf]
140-
rw [this]
141-
apply hR' hf
52+
@[deprecated (since := "2026-02-06")] alias isSheafFor_bind := Presieve.isSheafFor_bind
53+
54+
@[deprecated (since := "2026-02-06")] alias isSheafFor_trans := Presieve.isSheafFor_trans
14255

14356
/-- Construct the finest (largest) Grothendieck topology for which the given presheaf is a sheaf. -/
14457
@[stacks 00Z9 "This is a special case of the Stacks entry, but following a different
@@ -154,7 +67,7 @@ def finestTopologySingle (P : Cᵒᵖ ⥤ Type v) : GrothendieckTopology C where
15467
transitive' X S hS R hR Z g := by
15568
-- This is the hard part of the construction, showing that the given set of sieves satisfies
15669
-- the transitivity axiom.
157-
refine isSheafFor_trans P (pullback g S) _ (hS Z g) ?_ ?_
70+
refine Presieve.isSheafFor_trans P (pullback g S) _ (hS Z g) ?_ ?_
15871
· intro Y f _
15972
rw [← pullback_comp]
16073
apply (hS _ _).isSeparatedFor

Mathlib/CategoryTheory/Sites/IsSheafFor.lean

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -938,6 +938,98 @@ lemma isSheafFor_singleton {X Y : C} {f : X ⟶ Y} :
938938
simp_rw [FamilyOfElements.compatible_singleton_iff,
939939
FamilyOfElements.isAmalgamation_singleton_iff, FamilyOfElements.singletonEquiv_symm_apply_self]
940940

941+
/--
942+
To show `P` is a sheaf for the binding of `U` with `B`, it suffices to show that `P` is a sheaf for
943+
`U`, that `P` is a sheaf for each sieve in `B`, and that it is separated for any pullback of any
944+
sieve in `B`.
945+
946+
This is mostly an auxiliary lemma to show `Presieve.isSheafFor_trans`.
947+
Adapted from [Elephant], Lemma C2.1.7(i) with suggestions as mentioned in
948+
https://math.stackexchange.com/a/358709/
949+
-/
950+
theorem isSheafFor_bind (P : Cᵒᵖ ⥤ Type*) (U : Sieve X)
951+
(B : ∀ ⦃Y⦄ ⦃f : Y ⟶ X⦄, U f → Sieve Y)
952+
(hU : Presieve.IsSheafFor P (U : Presieve X))
953+
(hB : ∀ ⦃Y⦄ ⦃f : Y ⟶ X⦄ (hf : U f), Presieve.IsSheafFor P (B hf : Presieve Y))
954+
(hB' : ∀ ⦃Y⦄ ⦃f : Y ⟶ X⦄ (h : U f) ⦃Z⦄ (g : Z ⟶ Y),
955+
Presieve.IsSeparatedFor P (((B h).pullback g) : Presieve Z)) :
956+
Presieve.IsSheafFor P (Sieve.bind (U : Presieve X) B : Presieve X) := by
957+
intro s hs
958+
let y : ∀ ⦃Y⦄ ⦃f : Y ⟶ X⦄ (hf : U f), Presieve.FamilyOfElements P (B hf : Presieve Y) :=
959+
fun Y f hf Z g hg => s _ (Presieve.bind_comp _ _ hg)
960+
have hy : ∀ ⦃Y⦄ ⦃f : Y ⟶ X⦄ (hf : U f), (y hf).Compatible := by
961+
intro Y f H Y₁ Y₂ Z g₁ g₂ f₁ f₂ hf₁ hf₂ comm
962+
apply hs
963+
apply reassoc_of% comm
964+
let t : Presieve.FamilyOfElements P (U : Presieve X) :=
965+
fun Y f hf => (hB hf).amalgamate (y hf) (hy hf)
966+
have ht : ∀ ⦃Y⦄ ⦃f : Y ⟶ X⦄ (hf : U f), (y hf).IsAmalgamation (t f hf) := fun Y f hf =>
967+
(hB hf).isAmalgamation _
968+
have hT : t.Compatible := by
969+
rw [Presieve.compatible_iff_sieveCompatible]
970+
intro Z W f h hf
971+
apply (hB (U.downward_closed hf h)).isSeparatedFor.ext
972+
intro Y l hl
973+
apply (hB' hf (l ≫ h)).ext
974+
intro M m hm
975+
have : Sieve.bind U B (m ≫ l ≫ h ≫ f) := by simpa using (bind_comp f hf hm : Sieve.bind U B _)
976+
trans s (m ≫ l ≫ h ≫ f) this
977+
· have := ht (U.downward_closed hf h) _ ((B _).downward_closed hl m)
978+
rw [op_comp, FunctorToTypes.map_comp_apply] at this
979+
grind
980+
· have h : s _ _ = _ := (ht hf _ hm).symm
981+
-- Porting note: this was done by `simp only [assoc] at`
982+
conv_lhs at h => congr; rw [assoc, assoc]
983+
rw [h]
984+
simp only [op_comp, assoc, FunctorToTypes.map_comp_apply]
985+
refine ⟨hU.amalgamate t hT, ?_, ?_⟩
986+
· rintro Z _ ⟨Y, f, g, hg, hf, rfl⟩
987+
rw [op_comp, FunctorToTypes.map_comp_apply, Presieve.IsSheafFor.valid_glue _ _ _ hg]
988+
apply ht hg _ hf
989+
· intro y hy
990+
apply hU.isSeparatedFor.ext
991+
intro Y f hf
992+
apply (hB hf).isSeparatedFor.ext
993+
intro Z g hg
994+
rw [← FunctorToTypes.map_comp_apply, ← op_comp, hy _ (Presieve.bind_comp _ _ hg),
995+
hU.valid_glue _ _ hf, ht hf _ hg]
996+
997+
/-- Given two sieves `R` and `S`, to show that `P` is a sheaf for `S`, we can show:
998+
* `P` is a sheaf for `R`
999+
* `P` is a sheaf for the pullback of `S` along any arrow in `R`
1000+
* `P` is separated for the pullback of `R` along any arrow in `S`.
1001+
1002+
This is mostly an auxiliary lemma to construct `Sheaf.finestTopology`.
1003+
Adapted from [Elephant], Lemma C2.1.7(ii) with suggestions as mentioned in
1004+
https://math.stackexchange.com/a/358709
1005+
-/
1006+
theorem isSheafFor_trans (P : Cᵒᵖ ⥤ Type*) (R S : Sieve X)
1007+
(hR : Presieve.IsSheafFor P (R : Presieve X))
1008+
(hR' : ∀ ⦃Y⦄ ⦃f : Y ⟶ X⦄ (_ : S f), Presieve.IsSeparatedFor P (R.pullback f : Presieve Y))
1009+
(hS : ∀ ⦃Y⦄ ⦃f : Y ⟶ X⦄ (_ : R f), Presieve.IsSheafFor P (S.pullback f : Presieve Y)) :
1010+
Presieve.IsSheafFor P (S : Presieve X) := by
1011+
have : (Sieve.bind R fun Y f _ => S.pullback f : Presieve X) ≤ S := by
1012+
rintro Z f ⟨W, f, g, hg, hf : S _, rfl⟩
1013+
apply hf
1014+
apply Presieve.isSheafFor_subsieve_aux P this
1015+
· apply isSheafFor_bind _ _ _ hR hS
1016+
intro Y f hf Z g
1017+
rw [← pullback_comp]
1018+
apply (hS (R.downward_closed hf _)).isSeparatedFor
1019+
· intro Y f hf
1020+
have : Sieve.pullback f (Sieve.bind R fun T (k : T ⟶ X) (_ : R k) => pullback k S) =
1021+
R.pullback f := by
1022+
ext Z g
1023+
constructor
1024+
· rintro ⟨W, k, l, hl, _, comm⟩
1025+
rw [pullback_apply, ← comm]
1026+
simp [hl]
1027+
· intro a
1028+
refine ⟨Z, 𝟙 Z, _, a, ?_⟩
1029+
simp [hf]
1030+
rw [this]
1031+
apply hR' hf
1032+
9411033
end Presieve
9421034

9431035
end CategoryTheory

0 commit comments

Comments
 (0)