Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 293ba83

Browse files
rwbartondigama0
authored andcommitted
feat(category_theory/examples/topological_spaces): limits and colimits (#518)
1 parent 3d4297b commit 293ba83

File tree

4 files changed

+79
-4
lines changed

4 files changed

+79
-4
lines changed

category_theory/category.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ abbreviation small_category (C : Type u) : Type (u+1) := category.{u u} C
7373

7474
structure bundled (c : Type u → Type v) :=
7575
(α : Type u)
76-
[str : c α]
76+
(str : c α)
7777

7878
instance (c : Type u → Type v) : has_coe_to_sort (bundled c) :=
7979
{ S := Type u, coe := bundled.α }
80-
80+
8181
def mk_ob {c : Type u → Type v} (α : Type u) [str : c α] : bundled c :=
8282
@bundled.mk c α str
8383

category_theory/examples/topological_spaces.lean

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
import category_theory.full_subcategory
66
import category_theory.functor_category
7+
import category_theory.limits.preserves
8+
import category_theory.limits.types
79
import category_theory.natural_isomorphism
810
import category_theory.eq_to_hom
911
import analysis.topology.topological_space
@@ -28,6 +30,49 @@ instance : concrete_category @continuous := ⟨@continuous_id, @continuous.comp
2830

2931
-- local attribute [class] continuous
3032
-- instance {R S : Top} (f : R ⟶ S) : continuous (f : R → S) := f.2
33+
34+
section
35+
open category_theory.limits
36+
37+
variables {J : Type u} [small_category J]
38+
39+
def limit (F : J ⥤ Top.{u}) : cone F :=
40+
{ X := ⟨limit (F ⋙ forget), ⨆ j, (F.obj j).str.induced (limit.π (F ⋙ forget) j)⟩,
41+
π :=
42+
{ app := λ j, ⟨limit.π (F ⋙ forget) j, continuous_iff_induced_le.mpr (lattice.le_supr _ j)⟩,
43+
naturality' := λ j j' f, subtype.eq ((limit.cone (F ⋙ forget)).π.naturality f) } }
44+
45+
def limit_is_limit (F : J ⥤ Top.{u}) : is_limit (limit F) :=
46+
by refine is_limit.of_faithful forget (limit.is_limit _) (λ s, ⟨_, _⟩) (λ s, rfl);
47+
exact continuous_iff_le_coinduced.mpr (lattice.supr_le $ λ j,
48+
induced_le_iff_le_coinduced.mpr $ continuous_iff_le_coinduced.mp (s.π.app j).property)
49+
50+
instance : has_limits.{u+1 u} Top.{u} :=
51+
λ J 𝒥 F, by exactI { cone := limit F, is_limit := limit_is_limit F }
52+
53+
instance : preserves_limits (forget : Top.{u} ⥤ Type u) :=
54+
λ J 𝒥 F, by exactI preserves_limit_of_preserves_limit_cone
55+
(limit.is_limit F) (limit.is_limit (F ⋙ forget))
56+
57+
def colimit (F : J ⥤ Top.{u}) : cocone F :=
58+
{ X := ⟨colimit (F ⋙ forget), ⨅ j, (F.obj j).str.coinduced (colimit.ι (F ⋙ forget) j)⟩,
59+
ι :=
60+
{ app := λ j, ⟨colimit.ι (F ⋙ forget) j, continuous_iff_le_coinduced.mpr (lattice.infi_le _ j)⟩,
61+
naturality' := λ j j' f, subtype.eq ((colimit.cocone (F ⋙ forget)).ι.naturality f) } }
62+
63+
def colimit_is_colimit (F : J ⥤ Top.{u}) : is_colimit (colimit F) :=
64+
by refine is_colimit.of_faithful forget (colimit.is_colimit _) (λ s, ⟨_, _⟩) (λ s, rfl);
65+
exact continuous_iff_induced_le.mpr (lattice.le_infi $ λ j,
66+
induced_le_iff_le_coinduced.mpr $ continuous_iff_le_coinduced.mp (s.ι.app j).property)
67+
68+
instance : has_colimits.{u+1 u} Top.{u} :=
69+
λ J 𝒥 F, by exactI { cocone := colimit F, is_colimit := colimit_is_colimit F }
70+
71+
instance : preserves_colimits (forget : Top.{u} ⥤ Type u) :=
72+
λ J 𝒥 F, by exactI preserves_colimit_of_preserves_colimit_cocone
73+
(colimit.is_colimit F) (colimit.is_colimit (F ⋙ forget))
74+
75+
end
3176
end Top
3277

3378
variables {X : Top.{u}}

category_theory/limits/limits.lean

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,21 @@ h.hom_iso W ≪≫
102102
{ app := λ j, p.1 j,
103103
naturality' := λ j j' f, begin dsimp, erw [id_comp], exact (p.2 f).symm end } }
104104

105+
/-- If G : C → D is a faithful functor which sends t to a limit cone,
106+
then it suffices to check that the induced maps for the image of t
107+
can be lifted to maps of C. -/
108+
def of_faithful {t : cone F} {D : Type u'} [category.{u' v} D] (G : C ⥤ D) [faithful G]
109+
(ht : is_limit (G.map_cone t)) (lift : Π (s : cone F), s.X ⟶ t.X)
110+
(h : ∀ s, G.map (lift s) = ht.lift (G.map_cone s)) : is_limit t :=
111+
{ lift := lift,
112+
fac' := λ s j, by apply G.injectivity; rw [G.map_comp, h]; apply ht.fac,
113+
uniq' := λ s m w, begin
114+
apply G.injectivity, rw h,
115+
refine ht.uniq (G.map_cone s) _ (λ j, _),
116+
convert ←congr_arg (λ f, G.map f) (w j),
117+
apply G.map_comp
118+
end }
119+
105120
end is_limit
106121

107122
/-- A cocone `t` on `F` is a colimit cocone if each cocone on `F` admits a unique
@@ -189,6 +204,21 @@ h.hom_iso W ≪≫
189204
{ app := λ j, p.1 j,
190205
naturality' := λ j j' f, begin dsimp, erw [comp_id], exact (p.2 f) end } }
191206

207+
/-- If G : C → D is a faithful functor which sends t to a colimit cocone,
208+
then it suffices to check that the induced maps for the image of t
209+
can be lifted to maps of C. -/
210+
def of_faithful {t : cocone F} {D : Type u'} [category.{u' v} D] (G : C ⥤ D) [faithful G]
211+
(ht : is_colimit (G.map_cocone t)) (desc : Π (s : cocone F), t.X ⟶ s.X)
212+
(h : ∀ s, G.map (desc s) = ht.desc (G.map_cocone s)) : is_colimit t :=
213+
{ desc := desc,
214+
fac' := λ s j, by apply G.injectivity; rw [G.map_comp, h]; apply ht.fac,
215+
uniq' := λ s m w, begin
216+
apply G.injectivity, rw h,
217+
refine ht.uniq (G.map_cocone s) _ (λ j, _),
218+
convert ←congr_arg (λ f, G.map f) (w j),
219+
apply G.map_comp
220+
end }
221+
192222
end is_colimit
193223

194224
section limit

category_theory/types.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ instance ulift_functor_faithful : fully_faithful ulift_functor :=
5555
congr_arg ulift.down ((congr_fun p (ulift.up x)) : ((ulift.up (f x)) = (ulift.up (g x)))) }
5656

5757
section forget
58-
variables (C : Type u → Type v) {hom : ∀α β, C α → C β → (α → β) → Prop} [i : concrete_category hom]
58+
variables {C : Type u → Type v} {hom : ∀α β, C α → C β → (α → β) → Prop} [i : concrete_category hom]
5959
include i
6060

6161
/-- The forgetful functor from a bundled category to `Type`. -/
6262
def forget : bundled C ⥤ Type u := { obj := bundled.α, map := λa b h, h.1 }
6363

64-
instance forget.faithful : faithful (forget C) := {}
64+
instance forget.faithful : faithful (forget : bundled C ⥤ Type u) := {}
6565

6666
end forget
6767

0 commit comments

Comments
 (0)