Skip to content
This repository was archived by the owner on Nov 6, 2026. It is now read-only.

Commit 1539ee1

Browse files
refactor(topology/sheaves/*): Make sheaf condition a Prop (#9607)
Make `sheaf_condition` into a `Prop` and redefine the type of sheaves on a topological space `X` as a subtype of `(opens X)ᵒᵖ ⥤ C`.
1 parent 4a191ad commit 1539ee1

13 files changed

Lines changed: 228 additions & 298 deletions

‎src/algebraic_geometry/Spec.lean‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ The spectrum, as a contravariant functor from commutative rings to topological s
8181
The spectrum of a commutative ring, as a `SheafedSpace`.
8282
-/
8383
@[simps] def Spec.SheafedSpace_obj (R : CommRing) : SheafedSpace CommRing :=
84-
{ carrier := Spec.Top_obj R, ..structure_sheaf R }
84+
{ carrier := Spec.Top_obj R,
85+
presheaf := (structure_sheaf R).1,
86+
is_sheaf := (structure_sheaf R).2 }
8587

8688
/--
8789
The induced map of a ring homomorphism on the ring spectra, as a morphism of sheafed spaces.
@@ -111,7 +113,7 @@ PresheafedSpace.ext _ _ (Spec.Top_map_comp f g) $ nat_trans.ext _ _ $ funext $
111113
begin
112114
dsimp,
113115
erw [Top.presheaf.pushforward.comp_inv_app, ← category.assoc, category.comp_id,
114-
(structure_sheaf T).presheaf.map_id, category.comp_id, comap_comp],
116+
(structure_sheaf T).1.map_id, category.comp_id, comap_comp],
115117
refl,
116118
end
117119

‎src/algebraic_geometry/locally_ringed_space.lean‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ instance : reflects_isomorphisms forget_to_SheafedSpace :=
167167
The restriction of a locally ringed space along an open embedding.
168168
-/
169169
@[simps]
170-
noncomputable def restrict {U : Top} (X : LocallyRingedSpace) (f : U ⟶ X.to_Top)
170+
def restrict {U : Top} (X : LocallyRingedSpace) (f : U ⟶ X.to_Top)
171171
(h : open_embedding f) : LocallyRingedSpace :=
172172
{ local_ring :=
173173
begin
@@ -182,7 +182,7 @@ noncomputable def restrict {U : Top} (X : LocallyRingedSpace) (f : U ⟶ X.to_To
182182
/--
183183
The restriction of a locally ringed space `X` to the top subspace is isomorphic to `X` itself.
184184
-/
185-
noncomputable def restrict_top_iso (X : LocallyRingedSpace) :
185+
def restrict_top_iso (X : LocallyRingedSpace) :
186186
X.restrict (opens.inclusion ⊤) (opens.open_embedding ⊤) ≅ X :=
187187
@iso_of_SheafedSpace_iso (X.restrict (opens.inclusion ⊤) (opens.open_embedding ⊤)) X
188188
X.to_SheafedSpace.restrict_top_iso

‎src/algebraic_geometry/sheafed_space.lean‎

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ namespace algebraic_geometry
3333

3434
/-- A `SheafedSpace C` is a topological space equipped with a sheaf of `C`s. -/
3535
structure SheafedSpace extends PresheafedSpace C :=
36-
(sheaf_condition : presheaf.sheaf_condition)
36+
(is_sheaf : presheaf.is_sheaf)
3737

3838
variables {C}
3939

@@ -43,23 +43,21 @@ instance coe_carrier : has_coe (SheafedSpace C) Top :=
4343
{ coe := λ X, X.carrier }
4444

4545
/-- Extract the `sheaf C (X : Top)` from a `SheafedSpace C`. -/
46-
def sheaf (X : SheafedSpace C) : sheaf C (X : Top.{v}) := ⟨X.presheaf, X.sheaf_condition⟩
46+
def sheaf (X : SheafedSpace C) : sheaf C (X : Top.{v}) := ⟨X.presheaf, X.is_sheaf⟩
4747

4848
@[simp] lemma as_coe (X : SheafedSpace C) : X.carrier = (X : Top.{v}) := rfl
4949
@[simp] lemma mk_coe (carrier) (presheaf) (h) :
50-
(({ carrier := carrier, presheaf := presheaf, sheaf_condition := h } : SheafedSpace.{v} C) :
50+
(({ carrier := carrier, presheaf := presheaf, is_sheaf := h } : SheafedSpace.{v} C) :
5151
Top.{v}) = carrier :=
5252
rfl
5353

5454
instance (X : SheafedSpace.{v} C) : topological_space X := X.carrier.str
5555

5656
/-- The trivial `punit` valued sheaf on any topological space. -/
57-
noncomputable
5857
def punit (X : Top) : SheafedSpace (discrete punit) :=
59-
{ sheaf_condition := presheaf.sheaf_condition_punit _,
58+
{ is_sheaf := presheaf.is_sheaf_punit _,
6059
..@PresheafedSpace.const (discrete punit) _ X punit.star }
6160

62-
noncomputable
6361
instance : inhabited (SheafedSpace (discrete _root_.punit)) := ⟨punit (Top.of pempty)⟩
6462

6563
instance : category (SheafedSpace C) :=
@@ -109,18 +107,16 @@ open Top.presheaf
109107
/--
110108
The restriction of a sheafed space along an open embedding into the space.
111109
-/
112-
noncomputable
113110
def restrict {U : Top} (X : SheafedSpace C)
114111
(f : U ⟶ (X : Top.{v})) (h : open_embedding f) : SheafedSpace C :=
115-
{ sheaf_condition := λ ι 𝒰, is_limit.of_iso_limit
116-
((is_limit.postcompose_inv_equiv _ _).inv_fun (X.sheaf_condition _))
117-
(sheaf_condition_equalizer_products.fork.iso_of_open_embedding h 𝒰).symm,
112+
{ is_sheaf := λ ι 𝒰, ⟨is_limit.of_iso_limit
113+
((is_limit.postcompose_inv_equiv _ _).inv_fun (X.is_sheaf _).some)
114+
(sheaf_condition_equalizer_products.fork.iso_of_open_embedding h 𝒰).symm⟩,
118115
..X.to_PresheafedSpace.restrict f h }
119116

120117
/--
121118
The restriction of a sheafed space `X` to the top subspace is isomorphic to `X` itself.
122119
-/
123-
noncomputable
124120
def restrict_top_iso (X : SheafedSpace C) :
125121
X.restrict (opens.inclusion ⊤) (opens.open_embedding ⊤) ≅ X :=
126122
@preimage_iso _ _ _ _ forget_to_PresheafedSpace _ _

‎src/algebraic_geometry/structure_sheaf.lean‎

Lines changed: 54 additions & 55 deletions
Large diffs are not rendered by default.

‎src/topology/sheaves/forget.lean‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,13 @@ Another useful example is the forgetful functor `TopCommRing ⥤ Top`.
127127
See https://stacks.math.columbia.edu/tag/0073.
128128
In fact we prove a stronger version with arbitrary complete target category.
129129
-/
130-
def sheaf_condition_equiv_sheaf_condition_comp :
131-
sheaf_condition F ≃ sheaf_condition (F ⋙ G) :=
130+
lemma is_sheaf_iff_is_sheaf_comp :
131+
presheaf.is_sheaf F ↔ presheaf.is_sheaf (F ⋙ G) :=
132132
begin
133-
apply equiv_of_subsingleton_of_subsingleton,
133+
split,
134134
{ intros S ι U,
135135
-- We have that the sheaf condition fork for `F` is a limit fork,
136-
have t₁ := S U,
136+
obtain ⟨t₁⟩ := S U,
137137
-- and since `G` preserves limits, the image under `G` of this fork is a limit fork too.
138138
have t₂ := @preserves_limit.preserves _ _ _ _ _ _ _ G _ _ t₁,
139139
-- As we established above, that image is just the sheaf condition fork
@@ -142,8 +142,9 @@ begin
142142
-- and as postcomposing by a natural isomorphism preserves limit cones,
143143
have t₄ := is_limit.postcompose_inv_equiv _ _ t₃,
144144
-- we have our desired conclusion.
145-
exact t₄, },
145+
exact ⟨t₄⟩, },
146146
{ intros S ι U,
147+
refine ⟨_⟩,
147148
-- Let `f` be the universal morphism from `F.obj U` to the equalizer
148149
-- of the sheaf condition fork, whatever it is.
149150
-- Our goal is to show that this is an isomorphism.
@@ -164,7 +165,7 @@ begin
164165
-- from the sheaf condition cone for `F ⋙ G` to the
165166
-- image under `G` of the equalizer cone for the sheaf condition diagram.
166167
let c := fork (F ⋙ G) U,
167-
have hc : is_limit c := S U,
168+
obtain ⟨hc⟩ := S U,
168169
let d := G.map_cone (equalizer.fork (left_res F U) (right_res F U)),
169170
have hd : is_limit d := preserves_limit.preserves (limit.is_limit _),
170171
-- Since both of these are limit cones

‎src/topology/sheaves/local_predicate.lean‎

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,9 @@ open Top.presheaf
166166
/--
167167
The functions satisfying a local predicate satisfy the sheaf condition.
168168
-/
169-
def sheaf_condition
170-
(P : local_predicate T) :
171-
sheaf_condition (subpresheaf_to_Types P.to_prelocal_predicate) :=
172-
sheaf_condition_of_exists_unique_gluing _ $ λ ι U sf sf_comp, begin
169+
lemma is_sheaf (P : local_predicate T) :
170+
(subpresheaf_to_Types P.to_prelocal_predicate).is_sheaf :=
171+
presheaf.is_sheaf_of_is_sheaf_unique_gluing_types _ $ λ ι U sf sf_comp, begin
173172
-- We show the sheaf condition in terms of unique gluing.
174173
-- First we obtain a family of sections for the underlying sheaf of functions,
175174
-- by forgetting that the prediacte holds
@@ -209,14 +208,13 @@ The subsheaf of the sheaf of all dependently typed functions satisfying the loca
209208
-/
210209
@[simps]
211210
def subsheaf_to_Types (P : local_predicate T) : sheaf (Type v) X :=
212-
{ presheaf := subpresheaf_to_Types P.to_prelocal_predicate,
213-
sheaf_condition := subpresheaf_to_Types.sheaf_condition P }.
211+
⟨subpresheaf_to_Types P.to_prelocal_predicate, subpresheaf_to_Types.is_sheaf P⟩
214212

215213
/--
216214
There is a canonical map from the stalk to the original fiber, given by evaluating sections.
217215
-/
218216
def stalk_to_fiber (P : local_predicate T) (x : X) :
219-
(subsheaf_to_Types P).presheaf.stalk x ⟶ T x :=
217+
(subsheaf_to_Types P).1.stalk x ⟶ T x :=
220218
begin
221219
refine colimit.desc _
222220
{ X := T x, ι := { app := λ U f, _, naturality' := _ } },
@@ -225,7 +223,7 @@ begin
225223
end
226224

227225
@[simp] lemma stalk_to_fiber_germ (P : local_predicate T) (U : opens X) (x : U) (f) :
228-
stalk_to_fiber P x ((subsheaf_to_Types P).presheaf.germ x f) = f.1 x :=
226+
stalk_to_fiber P x ((subsheaf_to_Types P).1.germ x f) = f.1 x :=
229227
begin
230228
dsimp [presheaf.germ, stalk_to_fiber],
231229
cases x,
@@ -244,7 +242,7 @@ lemma stalk_to_fiber_surjective (P : local_predicate T) (x : X)
244242
begin
245243
rcases w t with ⟨U, f, h, rfl⟩,
246244
fsplit,
247-
{ exact (subsheaf_to_Types P).presheaf.germ ⟨x, U.2⟩ ⟨f, h⟩, },
245+
{ exact (subsheaf_to_Types P).1.germ ⟨x, U.2⟩ ⟨f, h⟩, },
248246
{ exact stalk_to_fiber_germ _ U.1 ⟨x, U.2⟩ ⟨f, h⟩, }
249247
end
250248

@@ -262,8 +260,8 @@ begin
262260
-- We promise to provide all the ingredients of the proof later:
263261
let Q :
264262
∃ (W : (open_nhds x)ᵒᵖ) (s : Π w : (unop W).1, T w) (hW : P.pred s),
265-
tU = (subsheaf_to_Types P).presheaf.germ ⟨x, (unop W).2⟩ ⟨s, hW⟩ ∧
266-
tV = (subsheaf_to_Types P).presheaf.germ ⟨x, (unop W).2⟩ ⟨s, hW⟩ := _,
263+
tU = (subsheaf_to_Types P).1.germ ⟨x, (unop W).2⟩ ⟨s, hW⟩ ∧
264+
tV = (subsheaf_to_Types P).1.germ ⟨x, (unop W).2⟩ ⟨s, hW⟩ := _,
267265
{ choose W s hW e using Q,
268266
exact e.1.trans e.2.symm, },
269267
-- Then use induction to pick particular representatives of `tU tV : stalk x`
@@ -300,9 +298,8 @@ nat_iso.of_components
300298
The sheaf of continuous functions on `X` with values in a space `T`.
301299
-/
302300
def sheaf_to_Top (T : Top.{v}) : sheaf (Type v) X :=
303-
{ presheaf := presheaf_to_Top X T,
304-
sheaf_condition :=
305-
presheaf.sheaf_condition_equiv_of_iso (subpresheaf_continuous_prelocal_iso_presheaf_to_Top T)
306-
(subpresheaf_to_Types.sheaf_condition (continuous_local X T)), }
301+
⟨presheaf_to_Top X T,
302+
presheaf.is_sheaf_of_iso (subpresheaf_continuous_prelocal_iso_presheaf_to_Top T)
303+
(subpresheaf_to_Types.is_sheaf (continuous_local X T))⟩
307304

308305
end Top

‎src/topology/sheaves/sheaf.lean‎

Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -61,36 +61,25 @@ The sheaf condition for a `F : presheaf C X` requires that the morphism
6161
is the equalizer of the two morphisms
6262
`∏ F.obj (U i) ⟶ ∏ F.obj (U i) ⊓ (U j)`.
6363
-/
64-
-- One might prefer to work with sets of opens, rather than indexed families,
65-
-- which would reduce the universe level here to `max u v`.
66-
-- However as it's a subsingleton the universe level doesn't matter much.
67-
@[derive subsingleton]
68-
def sheaf_condition (F : presheaf C X) : Type (max u (v+1)) :=
69-
Π ⦃ι : Type v⦄ (U : ι → opens X), is_limit (sheaf_condition_equalizer_products.fork F U)
64+
def is_sheaf (F : presheaf C X) : Prop :=
65+
∀ ⦃ι : Type v⦄ (U : ι → opens X), nonempty (is_limit (sheaf_condition_equalizer_products.fork F U))
7066

7167
/--
7268
The presheaf valued in `punit` over any topological space is a sheaf.
7369
-/
74-
def sheaf_condition_punit (F : presheaf (category_theory.discrete punit) X) :
75-
sheaf_condition F :=
76-
λ ι U, punit_cone_is_limit
77-
78-
-- Let's construct a trivial example, to keep the inhabited linter happy.
79-
instance sheaf_condition_inhabited (F : presheaf (category_theory.discrete punit) X) :
80-
inhabited (sheaf_condition F) := ⟨sheaf_condition_punit F⟩
70+
lemma is_sheaf_punit (F : presheaf (category_theory.discrete punit) X) : F.is_sheaf :=
71+
λ ι U, ⟨punit_cone_is_limit⟩
8172

8273
/--
8374
Transfer the sheaf condition across an isomorphism of presheaves.
8475
-/
85-
def sheaf_condition_equiv_of_iso {F G : presheaf C X} (α : F ≅ G) :
86-
sheaf_condition F ≃ sheaf_condition G :=
87-
equiv_of_subsingleton_of_subsingleton
88-
(λ c ι U, is_limit.of_iso_limit
89-
((is_limit.postcompose_inv_equiv _ _).symm (c U))
90-
(sheaf_condition_equalizer_products.fork.iso_of_iso U α.symm).symm)
91-
(λ c ι U, is_limit.of_iso_limit
92-
((is_limit.postcompose_inv_equiv _ _).symm (c U))
93-
(sheaf_condition_equalizer_products.fork.iso_of_iso U α).symm)
76+
lemma is_sheaf_of_iso {F G : presheaf C X} (α : F ≅ G) (h : F.is_sheaf) : G.is_sheaf :=
77+
λ ι U, ⟨is_limit.of_iso_limit
78+
((is_limit.postcompose_inv_equiv _ _).symm (h U).some)
79+
(sheaf_condition_equalizer_products.fork.iso_of_iso U α.symm).symm⟩
80+
81+
lemma is_sheaf_iso_iff {F G : presheaf C X} (α : F ≅ G) : F.is_sheaf ↔ G.is_sheaf :=
82+
⟨(λ h, is_sheaf_of_iso α h), (λ h, is_sheaf_of_iso α.symm h)⟩
9483

9584
end presheaf
9685

@@ -100,23 +89,21 @@ variables (C X)
10089
A `sheaf C X` is a presheaf of objects from `C` over a (bundled) topological space `X`,
10190
satisfying the sheaf condition.
10291
-/
103-
structure sheaf :=
104-
(presheaf : presheaf C X)
105-
(sheaf_condition : presheaf.sheaf_condition)
106-
107-
instance : category (sheaf C X) := induced_category.category sheaf.presheaf
92+
@[derive category]
93+
def sheaf : Type (max u v) := { F : presheaf C X // F.is_sheaf }
10894

10995
-- Let's construct a trivial example, to keep the inhabited linter happy.
11096
instance sheaf_inhabited : inhabited (sheaf (category_theory.discrete punit) X) :=
111-
⟨{ presheaf := functor.star _, sheaf_condition := default _ }⟩
97+
⟨⟨functor.star _, presheaf.is_sheaf_punit _⟩⟩
11298

11399
namespace sheaf
114100

115101
/--
116102
The forgetful functor from sheaves to presheaves.
117103
-/
118104
@[derive [full, faithful]]
119-
def forget : Top.sheaf C X ⥤ Top.presheaf C X := induced_functor sheaf.presheaf
105+
def forget : Top.sheaf C X ⥤ Top.presheaf C X :=
106+
full_subcategory_inclusion presheaf.is_sheaf
120107

121108
end sheaf
122109

‎src/topology/sheaves/sheaf_condition/opens_le_cover.lean‎

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,8 @@ A presheaf is a sheaf if `F` sends the cone `(opens_le_cover_cocone U).op` to a
9393
(Recall `opens_le_cover_cocone U`, has cone point `supr U`,
9494
mapping down to any `V` which is contained in some `U i`.)
9595
-/
96-
@[derive subsingleton, nolint has_inhabited_instance]
97-
def sheaf_condition_opens_le_cover : Type (max u (v+1)) :=
98-
Π ⦃ι : Type v⦄ (U : ι → opens X), is_limit (F.map_cone (opens_le_cover_cocone U).op)
96+
def is_sheaf_opens_le_cover : Prop :=
97+
∀ ⦃ι : Type v⦄ (U : ι → opens X), nonempty (is_limit (F.map_cone (opens_le_cover_cocone U).op))
9998

10099
namespace sheaf_condition
101100

@@ -217,10 +216,10 @@ in terms of a limit diagram over all `{ V : opens X // ∃ i, V ≤ U i }`
217216
is equivalent to the reformulation
218217
in terms of a limit diagram over `U i` and `U i ⊓ U j`.
219218
-/
220-
def sheaf_condition_opens_le_cover_equiv_sheaf_condition_pairwise_intersections (F : presheaf C X) :
221-
F.sheaf_condition_opens_le_cover ≃ F.sheaf_condition_pairwise_intersections :=
222-
equiv.Pi_congr_right $ λ ι, equiv.Pi_congr_right $ λ U,
223-
calc is_limit (F.map_cone (opens_le_cover_cocone U).op)
219+
lemma is_sheaf_opens_le_cover_iff_is_sheaf_pairwise_intersections (F : presheaf C X) :
220+
F.is_sheaf_opens_le_cover ↔ F.is_sheaf_pairwise_intersections :=
221+
forall_congr (λ ι, forall_congr (λ U, equiv.nonempty_congr $
222+
calc is_limit (F.map_cone (opens_le_cover_cocone U).op)
224223
≃ is_limit ((F.map_cone (opens_le_cover_cocone U).op).whisker (pairwise_to_opens_le_cover U).op)
225224
: (functor.initial.is_limit_whisker_equiv (pairwise_to_opens_le_cover U).op _).symm
226225
... ≃ is_limit (F.map_cone ((opens_le_cover_cocone U).op.whisker (pairwise_to_opens_le_cover U).op))
@@ -233,19 +232,19 @@ calc is_limit (F.map_cone (opens_le_cover_cocone U).op)
233232
: is_limit.equiv_iso_limit (functor.map_cone_postcompose_equivalence_functor _).symm
234233
... ≃ is_limit (F.map_cone (pairwise.cocone U).op)
235234
: is_limit.equiv_iso_limit
236-
((cones.functoriality _ _).map_iso (pairwise_cocone_iso U : _).symm)
235+
((cones.functoriality _ _).map_iso (pairwise_cocone_iso U : _).symm)))
237236

238237
variables [has_products C]
239238

240239
/--
241240
The sheaf condition in terms of an equalizer diagram is equivalent
242241
to the reformulation in terms of a limit diagram over all `{ V : opens X // ∃ i, V ≤ U i }`.
243242
-/
244-
def sheaf_condition_equiv_sheaf_condition_opens_le_cover (F : presheaf C X) :
245-
F.sheaf_condition ≃ F.sheaf_condition_opens_le_cover :=
246-
equiv.trans
247-
(sheaf_condition_equiv_sheaf_condition_pairwise_intersections F)
248-
(sheaf_condition_opens_le_cover_equiv_sheaf_condition_pairwise_intersections F).symm
243+
lemma is_sheaf_iff_is_sheaf_opens_le_cover (F : presheaf C X) :
244+
F.is_sheaf ↔ F.is_sheaf_opens_le_cover :=
245+
iff.trans
246+
(is_sheaf_iff_is_sheaf_pairwise_intersections F)
247+
(is_sheaf_opens_le_cover_iff_is_sheaf_pairwise_intersections F).symm
249248

250249
end presheaf
251250

0 commit comments

Comments
 (0)