Skip to content

Commit 01f4692

Browse files
committed
feat: port Topology.Sheaves.PresheafOfFunctions (#4092)
1 parent 20979e9 commit 01f4692

File tree

2 files changed

+195
-0
lines changed

2 files changed

+195
-0
lines changed

Mathlib.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2226,6 +2226,7 @@ import Mathlib.Topology.Sets.Order
22262226
import Mathlib.Topology.Sheaves.Abelian
22272227
import Mathlib.Topology.Sheaves.Init
22282228
import Mathlib.Topology.Sheaves.Presheaf
2229+
import Mathlib.Topology.Sheaves.PresheafOfFunctions
22292230
import Mathlib.Topology.Sheaves.Sheaf
22302231
import Mathlib.Topology.ShrinkingLemma
22312232
import Mathlib.Topology.Sober
Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
/-
2+
Copyright (c) 2019 Scott Morrison. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Scott Morrison
5+
6+
! This file was ported from Lean 3 source module topology.sheaves.presheaf_of_functions
7+
! leanprover-community/mathlib commit 6c31dd6563a3745bf8e0b80bdd077167583ebb8f
8+
! Please do not edit these lines, except to modify the commit id
9+
! if you have ported upstream changes.
10+
-/
11+
import Mathlib.CategoryTheory.Yoneda
12+
import Mathlib.Topology.Sheaves.Presheaf
13+
import Mathlib.Topology.Category.TopCommRingCat
14+
import Mathlib.Topology.ContinuousFunction.Algebra
15+
16+
/-!
17+
# Presheaves of functions
18+
19+
We construct some simple examples of presheaves of functions on a topological space.
20+
* `presheafToTypes X T`, where `T : X → Type`,
21+
is the presheaf of dependently-typed (not-necessarily continuous) functions
22+
* `presheafToType X T`, where `T : Type`,
23+
is the presheaf of (not-necessarily-continuous) functions to a fixed target type `T`
24+
* `presheafToTop X T`, where `T : Top`,
25+
is the presheaf of continuous functions into a topological space `T`
26+
* `presheafToTopCommRing X R`, where `R : TopCommRingCat`
27+
is the presheaf valued in `CommRing` of functions functions into a topological ring `R`
28+
* as an example of the previous construction,
29+
`presheafToTopCommRing X (TopCommRingCat.of ℂ)`
30+
is the presheaf of rings of continuous complex-valued functions on `X`.
31+
-/
32+
33+
34+
universe v u
35+
36+
open CategoryTheory
37+
38+
open TopologicalSpace
39+
40+
open Opposite
41+
42+
namespace TopCat
43+
44+
variable (X : TopCat.{v})
45+
46+
/-- The presheaf of dependently typed functions on `X`, with fibres given by a type family `T`.
47+
There is no requirement that the functions are continuous, here.
48+
-/
49+
def presheafToTypes (T : X → Type v) : X.Presheaf (Type v) where
50+
obj U := ∀ x : U.unop, T x
51+
map {U V} i g := fun x : V.unop => g (i.unop x)
52+
map_id U := by
53+
ext g ⟨x, hx⟩
54+
rfl
55+
map_comp {U V W} i j := rfl
56+
set_option linter.uppercaseLean3 false in
57+
#align Top.presheaf_to_Types TopCat.presheafToTypes
58+
59+
@[simp]
60+
theorem presheafToTypes_obj {T : X → Type v} {U : (Opens X)ᵒᵖ} :
61+
(presheafToTypes X T).obj U = ∀ x : U.unop, T x :=
62+
rfl
63+
set_option linter.uppercaseLean3 false in
64+
#align Top.presheaf_to_Types_obj TopCat.presheafToTypes_obj
65+
66+
@[simp]
67+
theorem presheafToTypes_map {T : X → Type v} {U V : (Opens X)ᵒᵖ} {i : U ⟶ V} {f} :
68+
(presheafToTypes X T).map i f = fun x => f (i.unop x) :=
69+
rfl
70+
set_option linter.uppercaseLean3 false in
71+
#align Top.presheaf_to_Types_map TopCat.presheafToTypes_map
72+
73+
-- We don't just define this in terms of `presheaf_to_Types`,
74+
-- as it's helpful later to see (at a syntactic level) that `(presheaf_to_Type X T).obj U`
75+
-- is a non-dependent function.
76+
-- We don't use `@[simps]` to generate the projection lemmas here,
77+
-- as it turns out to be useful to have `presheaf_to_Type_map`
78+
-- written as an equality of functions (rather than being applied to some argument).
79+
/-- The presheaf of functions on `X` with values in a type `T`.
80+
There is no requirement that the functions are continuous, here.
81+
-/
82+
def presheafToType (T : Type v) : X.Presheaf (Type v) where
83+
obj U := U.unop → T
84+
map {U V} i g := g ∘ i.unop
85+
map_id U := by
86+
ext (g⟨x, hx⟩)
87+
rfl
88+
map_comp {U V W} i j := rfl
89+
set_option linter.uppercaseLean3 false in
90+
#align Top.presheaf_to_Type TopCat.presheafToType
91+
92+
@[simp]
93+
theorem presheafToType_obj {T : Type v} {U : (Opens X)ᵒᵖ} :
94+
(presheafToType X T).obj U = (U.unop → T) :=
95+
rfl
96+
set_option linter.uppercaseLean3 false in
97+
#align Top.presheaf_to_Type_obj TopCat.presheafToType_obj
98+
99+
@[simp]
100+
theorem presheafToType_map {T : Type v} {U V : (Opens X)ᵒᵖ} {i : U ⟶ V} {f} :
101+
(presheafToType X T).map i f = f ∘ i.unop :=
102+
rfl
103+
set_option linter.uppercaseLean3 false in
104+
#align Top.presheaf_to_Type_map TopCat.presheafToType_map
105+
106+
/-- The presheaf of continuous functions on `X` with values in fixed target topological space
107+
`T`. -/
108+
def presheafToTop (T : TopCat.{v}) : X.Presheaf (Type v) :=
109+
(Opens.toTopCat X).op ⋙ yoneda.obj T
110+
set_option linter.uppercaseLean3 false in
111+
#align Top.presheaf_to_Top TopCat.presheafToTop
112+
113+
@[simp]
114+
theorem presheafToTop_obj (T : TopCat.{v}) (U : (Opens X)ᵒᵖ) :
115+
(presheafToTop X T).obj U = ((Opens.toTopCat X).obj (unop U) ⟶ T) :=
116+
rfl
117+
set_option linter.uppercaseLean3 false in
118+
#align Top.presheaf_to_Top_obj TopCat.presheafToTop_obj
119+
120+
-- TODO upgrade the result to TopCommRing?
121+
/-- The (bundled) commutative ring of continuous functions from a topological space
122+
to a topological commutative ring, with pointwise multiplication. -/
123+
def continuousFunctions (X : TopCat.{v}ᵒᵖ) (R : TopCommRingCat.{v}) : CommRingCat.{v} :=
124+
-- Porting note : Lean did not see through that `X.unop ⟶ R` is just continuous functions
125+
-- hence forms a ring
126+
@CommRingCat.of (X.unop ⟶ (forget₂ TopCommRingCat TopCat).obj R) <|
127+
show CommRing (ContinuousMap _ _) by infer_instance
128+
set_option linter.uppercaseLean3 false in
129+
#align Top.continuous_functions TopCat.continuousFunctions
130+
131+
namespace continuousFunctions
132+
133+
/-- Pulling back functions into a topological ring along a continuous map is a ring homomorphism. -/
134+
def pullback {X Y : TopCatᵒᵖ} (f : X ⟶ Y) (R : TopCommRingCat) :
135+
continuousFunctions X R ⟶ continuousFunctions Y R where
136+
toFun g := f.unop ≫ g
137+
map_one' := rfl
138+
map_zero' := rfl
139+
map_add' := by aesop_cat
140+
map_mul' := by aesop_cat
141+
set_option linter.uppercaseLean3 false in
142+
#align Top.continuous_functions.pullback TopCat.continuousFunctions.pullback
143+
144+
/-- A homomorphism of topological rings can be postcomposed with functions from a source space `X`;
145+
this is a ring homomorphism (with respect to the pointwise ring operations on functions). -/
146+
def map (X : TopCat.{u}ᵒᵖ) {R S : TopCommRingCat.{u}} (φ : R ⟶ S) :
147+
continuousFunctions X R ⟶ continuousFunctions X S where
148+
toFun g := g ≫ (forget₂ TopCommRingCat TopCat).map φ
149+
-- Porting note : `ext` tactic does not work, since Lean can't see through `R ⟶ S` is just
150+
-- continuous ring homomorphism
151+
map_one' := ContinuousMap.ext fun _ => φ.1.map_one
152+
map_zero' := ContinuousMap.ext fun _ => φ.1.map_zero
153+
map_add' := fun _ _ => ContinuousMap.ext fun _ => φ.1.map_add _ _
154+
map_mul' := fun _ _ => ContinuousMap.ext fun _ => φ.1.map_mul _ _
155+
set_option linter.uppercaseLean3 false in
156+
#align Top.continuous_functions.map TopCat.continuousFunctions.map
157+
158+
end continuousFunctions
159+
160+
/-- An upgraded version of the Yoneda embedding, observing that the continuous maps
161+
from `X : Top` to `R : TopCommRing` form a commutative ring, functorial in both `X` and `R`. -/
162+
def commRingYoneda : TopCommRingCat.{u} ⥤ TopCat.{u}ᵒᵖ ⥤ CommRingCat.{u} where
163+
obj R :=
164+
{ obj := fun X => continuousFunctions X R
165+
map := fun {X Y} f => continuousFunctions.pullback f R
166+
map_id := fun X => by
167+
ext
168+
rfl
169+
map_comp := fun {X Y Z} f g => rfl }
170+
map {R S} φ :=
171+
{ app := fun X => continuousFunctions.map X φ
172+
naturality := fun X Y f => rfl }
173+
map_id X := by
174+
ext
175+
rfl
176+
map_comp {X Y Z} f g := rfl
177+
set_option linter.uppercaseLean3 false in
178+
#align Top.CommRing_yoneda TopCat.commRingYoneda
179+
180+
/-- The presheaf (of commutative rings), consisting of functions on an open set `U ⊆ X` with
181+
values in some topological commutative ring `T`.
182+
183+
For example, we could construct the presheaf of continuous complex valued functions of `X` as
184+
```
185+
presheaf_to_TopCommRing X (TopCommRing.of ℂ)
186+
```
187+
(this requires `import topology.instances.complex`).
188+
-/
189+
def presheafToTopCommRing (T : TopCommRingCat.{v}) : X.Presheaf CommRingCat.{v} :=
190+
(Opens.toTopCat X).op ⋙ commRingYoneda.obj T
191+
set_option linter.uppercaseLean3 false in
192+
#align Top.presheaf_to_TopCommRing TopCat.presheafToTopCommRing
193+
194+
end TopCat

0 commit comments

Comments
 (0)