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

Commit afe51c7

Browse files
kim-emmergify[bot]
authored andcommitted
feat(category_theory/limits): special shapes (#1339)
* providing minimal API for limits of special shapes * apis for special shapes * fintype instances * associators, unitors, braidings for binary product * map * instances * assoc lemma * coprod * fix import * names * adding some docs * updating tutorial on limits * minor * uniqueness of morphisms to terminal object * better treatment of has_terminal * various * not there yet * deleting a dumb file * remove constructions for a later PR * use @[reassoc] * Update src/category_theory/limits/shapes/finite_products.lean Co-Authored-By: Johan Commelin <johan@commelin.net> * improving the colimits tutorial * minor * notation for `prod_obj` and `sigma_obj`. * reverting to `condition` * implicit arguments * more implicit arguments * minor * notational for initial and terminal objects * various * fix notation priorities * remove unused case bash tactic * fix whitespace * comment * notations
1 parent 1278efd commit afe51c7

14 files changed

+565
-55
lines changed

docs/tutorial/category_theory/calculating_colimits_in_Top.lean

Lines changed: 45 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -17,40 +17,51 @@ section MappingCylinder
1717
-- Let's construct the mapping cylinder.
1818
def to_pt (X : Top) : X ⟶ pt :=
1919
{ val := λ _, unit.star, property := continuous_const }
20-
def I_0 : pt ⟶ I :=
20+
def I₀ : pt ⟶ I :=
2121
{ val := λ _, ⟨(0 : ℝ), begin rw [set.left_mem_Icc], norm_num, end⟩,
2222
property := continuous_const }
23-
def I_1 : pt ⟶ I :=
23+
def I₁ : pt ⟶ I :=
2424
{ val := λ _, ⟨(1 : ℝ), begin rw [set.right_mem_Icc], norm_num, end⟩,
2525
property := continuous_const }
2626

27-
def cylinder (X : Top) : Top := limit (pair X I)
27+
def cylinder (X : Top) : Top := prod X I
2828
-- To define a map to the cylinder, we give a map to each factor.
29-
-- `binary_fan.mk` is a helper method for constructing a `cone` over `pair X Y`.
30-
def cylinder_0 (X : Top) : X ⟶ cylinder X :=
31-
limit.lift (pair X I) (binary_fan.mk (𝟙 X) (to_pt X ≫ I_0))
32-
def cylinder_1 (X : Top) : X ⟶ cylinder X :=
33-
limit.lift (pair X I) (binary_fan.mk (𝟙 X) (to_pt X ≫ I_1))
29+
-- `prod.lift` is a helper method, providing a wrapper around `limit.lift` for binary products.
30+
def cylinder₀ (X : Top) : X ⟶ cylinder X :=
31+
prod.lift (𝟙 X) (to_pt X ≫ I₀)
32+
def cylinder₁ (X : Top) : X ⟶ cylinder X :=
33+
prod.lift (𝟙 X) (to_pt X ≫ I₁)
3434

35-
-- The mapping cylinder is the colimit of the diagram
35+
-- The mapping cylinder is the pushout of the diagram
3636
-- X
3737
-- ↙ ↘
3838
-- Y (X x I)
39-
def mapping_cylinder {X Y : Top} (f : X ⟶ Y) : Top := colimit (span f (cylinder_1 X))
40-
41-
-- The mapping cone is the colimit of the diagram
39+
-- (`pushout` is implemented just as a wrapper around `colimit`) is
40+
def mapping_cylinder {X Y : Top} (f : X ⟶ Y) : Top := pushout f (cylinder₁ X)
41+
42+
/-- We construct the map from `X` into the "bottom" of the mapping cylinder
43+
for `f : X ⟶ Y`, as the composition of the inclusion of `X` into the bottom of the
44+
cylinder `prod X I`, followed by the map `pushout.inr` of `prod X I` into `mapping_cylinder f`. -/
45+
def mapping_cylinder₀ {X Y : Top} (f : X ⟶ Y) : X ⟶ mapping_cylinder f :=
46+
cylinder₀ X ≫ pushout.inr
47+
48+
/--
49+
The mapping cone is defined as the pushout of
50+
```
51+
X
52+
↙ ↘
53+
(Cyl f) pt
54+
```
55+
(where the left arrow is `mapping_cylinder₀`).
56+
57+
This makes it an iterated colimit; one could also define it in one step as the colimit of
58+
```
4259
-- X X
4360
-- ↙ ↘ ↙ ↘
4461
-- Y (X x I) pt
45-
-- Here we'll calculate it as an iterated colimit, as the colimit of
46-
-- X
47-
-- ↙ ↘
48-
-- (Cyl f) pt
49-
50-
def mapping_cylinder_0 {X Y : Top} (f : X ⟶ Y) : X ⟶ mapping_cylinder f :=
51-
cylinder_0 X ≫ colimit.ι (span f (cylinder_1 X)) walking_span.right
52-
53-
def mapping_cone {X Y : Top} (f : X ⟶ Y) : Top := colimit (span (mapping_cylinder_0 f) (to_pt X))
62+
```
63+
-/
64+
def mapping_cone {X Y : Top} (f : X ⟶ Y) : Top := pushout (mapping_cylinder₀ f) (to_pt X)
5465

5566
-- TODO Hopefully someone will write a nice tactic for generating diagrams quickly,
5667
-- and we'll be able to verify that this iterated construction is the same as the colimit
@@ -61,29 +72,33 @@ section Gluing
6172

6273
-- Here's two copies of the real line glued together at a point.
6374
def f : pt ⟶ R := { val := λ _, (0 : ℝ), property := continuous_const }
64-
def X : Top := colimit (span f f)
75+
76+
/-- Two copies of the real line glued together at 0. -/
77+
def X : Top := pushout f f
6578

6679
-- To define a map out of it, we define maps out of each copy of the line,
6780
-- and check the maps agree at 0.
68-
-- `pushout_cocone.mk` is a helper method for constructing cocones over a span.
6981
def g : X ⟶ R :=
70-
colimit.desc (span f f) (pushout_cocone.mk (𝟙 _) (𝟙 _) rfl).
82+
pushout.desc (𝟙 _) (𝟙 _) rfl
7183

7284
end Gluing
7385

7486
universes v u w
7587

7688
section Products
7789

78-
def d : discrete ℕ ⥤ Top := functor.of_function (λ n : ℕ, R)
79-
80-
def Y : Top := limit d
81-
82-
def w : cone d := fan.mk (λ (n : ℕ), ⟨λ (_ : pt), (n : ℝ), continuous_const⟩)
90+
/-- The countably infinite product of copies of `ℝ`. -/
91+
def Y : Top := ∏ (λ n : ℕ, R)
8392

93+
/-- We define a point of this infinite product by specifying its coordinates. -/
8494
def q : pt ⟶ Y :=
85-
limit.lift d w
95+
pi.lift (λ (n : ℕ), ⟨λ (_ : pt), (n : ℝ), continuous_const⟩)
96+
97+
-- "Looking under the hood", we see that `q` is a `subtype`, whose `val` is a function `unit → Y.α`.
98+
-- #check q.val -- q.val : pt.α → Y.α
99+
-- `q.property` is the fact this function is continous (i.e. no content)
86100

101+
-- We can check that this function is definitionally just the function we specified.
87102
example : (q.val ()).val (57 : ℕ) = ((57 : ℕ) : ℝ) := rfl
88103

89104
end Products

src/category_theory/discrete_category.lean

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Stephen Morgan, Scott Morrison, Floris van Doorn
55
-/
66
import data.ulift
7+
import data.fintype
78
import category_theory.opposites category_theory.equivalence
89

910
namespace category_theory
@@ -13,6 +14,9 @@ universes v₁ v₂ u₁ u₂ -- declare the `v`'s first; see `category_theory.c
1314
-- We only work in `Type`, rather than `Sort`, as we need to use `ulift`.
1415
def discrete (α : Type u₁) := α
1516

17+
instance {α : Type u₁} [fintype α] : fintype (discrete α) :=
18+
by { dsimp [discrete], apply_instance }
19+
1620
instance discrete_category (α : Type u₁) : small_category (discrete α) :=
1721
{ hom := λ X Y, ulift (plift (X = Y)),
1822
id := λ X, ulift.up (plift.up rfl),
@@ -30,27 +34,35 @@ include 𝒞
3034

3135
namespace functor
3236

33-
@[simp] def of_function {I : Type u₁} (F : I → C) : (discrete I) ⥤ C :=
37+
def of_function {I : Type u₁} (F : I → C) : (discrete I) ⥤ C :=
3438
{ obj := F,
3539
map := λ X Y f, begin cases f, cases f, cases f, exact 𝟙 (F X) end }
3640

41+
@[simp] lemma of_function_obj {I : Type u₁} (F : I → C) (i : I) : (of_function F).obj i = F i := rfl
42+
@[simp] lemma of_function_map {I : Type u₁} (F : I → C) {i : discrete I} (f : i ⟶ i) :
43+
(of_function F).map f = 𝟙 (F i) :=
44+
by { cases f, cases f, cases f, refl }
45+
3746
end functor
3847

3948
namespace nat_trans
4049

41-
@[simp] def of_homs {I : Type u₁} {F G : discrete I ⥤ C}
50+
def of_homs {I : Type u₁} {F G : discrete I ⥤ C}
4251
(f : Π i : discrete I, F.obj i ⟶ G.obj i) : F ⟶ G :=
4352
{ app := f }
4453

45-
@[simp] def of_function {I : Type u₁} {F G : I → C} (f : Π i : I, F i ⟶ G i) :
54+
def of_function {I : Type u₁} {F G : I → C} (f : Π i : I, F i ⟶ G i) :
4655
(functor.of_function F) ⟶ (functor.of_function G) :=
4756
of_homs f
4857

58+
@[simp] lemma of_function_app {I : Type u₁} {F G : I → C} (f : Π i : I, F i ⟶ G i) (i : I) :
59+
(of_function f).app i = f i := rfl
60+
4961
end nat_trans
5062

5163
namespace nat_iso
5264

53-
@[simp] def of_isos {I : Type u₁} {F G : discrete I ⥤ C}
65+
def of_isos {I : Type u₁} {F G : discrete I ⥤ C}
5466
(f : Π i : discrete I, F.obj i ≅ G.obj i) : F ≅ G :=
5567
of_components f (by tidy)
5668

src/category_theory/functor_category.lean

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ infix ` ◫ `:80 := hcomp
6363
@[simp] lemma hcomp_app {H I : D ⥤ E} (α : F ⟶ G) (β : H ⟶ I) (X : C) :
6464
(α ◫ β).app X = (β.app (F.obj X)) ≫ (I.map (α.app X)) := rfl
6565

66-
-- Note that we don't yet prove a `hcomp_assoc` lemma here: even stating it is painful, because we need to use associativity of functor composition
66+
-- Note that we don't yet prove a `hcomp_assoc` lemma here: even stating it is painful, because we
67+
-- need to use associativity of functor composition
6768

6869
lemma exchange {I J K : D ⥤ E} (α : F ⟶ G) (β : G ⟶ H)
6970
(γ : I ⟶ J) (δ : J ⟶ K) : (α ≫ β) ◫ (γ ≫ δ) = (α ◫ γ) ≫ (β ◫ δ) :=

src/category_theory/limits/limits.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ def limit.lift (F : J ⥤ C) [has_limit F] (c : cone F) : c.X ⟶ limit F :=
298298
@[simp] lemma limit.is_limit_lift {F : J ⥤ C} [has_limit F] (c : cone F) :
299299
(limit.is_limit F).lift c = limit.lift F c := rfl
300300

301-
@[simp] lemma limit.lift_π {F : J ⥤ C} [has_limit F] (c : cone F) (j : J) :
301+
@[simp,reassoc] lemma limit.lift_π {F : J ⥤ C} [has_limit F] (c : cone F) (j : J) :
302302
limit.lift F c ≫ limit.π F j = c.π.app j :=
303303
is_limit.fac _ c j
304304

@@ -453,7 +453,7 @@ def lim : (J ⥤ C) ⥤ C :=
453453

454454
variables {F} {G : J ⥤ C} (α : F ⟶ G)
455455

456-
@[simp] lemma lim.map_π (j : J) : lim.map α ≫ limit.π G j = limit.π F j ≫ α.app j :=
456+
@[simp,reassoc] lemma lim.map_π (j : J) : lim.map α ≫ limit.π G j = limit.π F j ≫ α.app j :=
457457
by apply is_limit.fac
458458

459459
@[simp] lemma limit.lift_map (c : cone F) :

0 commit comments

Comments
 (0)