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

Commit ef11fb3

Browse files
kim-emmergify[bot]
authored andcommitted
feat(category_theory/limits/opposites): (co)limits in opposite categories (#926)
* (co)limits in opposite categories * moving lemmas * moving stuff about complete lattices to separate PR * renaming category_of_preorder elsewhere * build limits functor/shape at a time * removing stray commas, and making one-liners * remove non-terminal simps
1 parent 69094fc commit ef11fb3

File tree

5 files changed

+216
-1
lines changed

5 files changed

+216
-1
lines changed

src/category_theory/const.lean

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

55
import category_theory.functor_category
66
import category_theory.isomorphism
7+
import category_theory.opposites
78

89
universes v₁ v₂ v₃ u₁ u₂ u₃ -- declare the `v`'s first; see `category_theory.category` for an explanation
910

@@ -22,11 +23,33 @@ def const : C ⥤ (J ⥤ C) :=
2223
map := λ X Y f, { app := λ j, f } }
2324

2425
namespace const
26+
variables {J}
27+
2528
@[simp] lemma obj_obj (X : C) (j : J) : ((const J).obj X).obj j = X := rfl
2629
@[simp] lemma obj_map (X : C) {j j' : J} (f : j ⟶ j') : ((const J).obj X).map f = 𝟙 X := rfl
2730
@[simp] lemma map_app {X Y : C} (f : X ⟶ Y) (j : J) : ((const J).map f).app j = f := rfl
31+
32+
def op_obj_op (X : C) :
33+
(const Jᵒᵖ).obj (op X) ≅ ((const J).obj X).op :=
34+
{ hom := { app := λ j, 𝟙 _ },
35+
inv := { app := λ j, 𝟙 _ } }
36+
37+
@[simp] lemma op_obj_op_hom_app (X : C) (j : Jᵒᵖ) : (op_obj_op X).hom.app j = 𝟙 _ := rfl
38+
@[simp] lemma op_obj_op_inv_app (X : C) (j : Jᵒᵖ) : (op_obj_op X).inv.app j = 𝟙 _ := rfl
39+
40+
def op_obj_unop (X : Cᵒᵖ) :
41+
(const Jᵒᵖ).obj (unop X) ≅ ((const J).obj X).left_op :=
42+
{ hom := { app := λ j, 𝟙 _ },
43+
inv := { app := λ j, 𝟙 _ } }
44+
45+
-- Lean needs some help with universes here.
46+
@[simp] lemma op_obj_unop_hom_app (X : Cᵒᵖ) (j : Jᵒᵖ) : (op_obj_unop.{v₁ v₂} X).hom.app j = 𝟙 _ := rfl
47+
@[simp] lemma op_obj_unop_inv_app (X : Cᵒᵖ) (j : Jᵒᵖ) : (op_obj_unop.{v₁ v₂} X).inv.app j = 𝟙 _ := rfl
48+
2849
end const
2950

51+
52+
3053
section
3154
variables {D : Sort u₃} [𝒟 : category.{v₃} D]
3255
include 𝒟

src/category_theory/limits/cones.lean

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,3 +313,53 @@ def map_cocone_morphism {c c' : cocone F} (f : cocone_morphism c c') :
313313
end functor
314314

315315
end category_theory
316+
317+
namespace category_theory.limits
318+
319+
variables {F : J ⥤ Cᵒᵖ}
320+
321+
def cone_of_cocone_left_op (c : cocone F.left_op) : cone F :=
322+
{ X := op c.X,
323+
π := nat_trans.right_op (c.ι ≫ (const.op_obj_unop (op c.X)).hom) }
324+
325+
@[simp] lemma cone_of_cocone_left_op_X (c : cocone F.left_op) :
326+
(cone_of_cocone_left_op c).X = op c.X :=
327+
rfl
328+
@[simp] lemma cone_of_cocone_left_op_π_app (c : cocone F.left_op) (j) :
329+
(cone_of_cocone_left_op c).π.app j = (c.ι.app (op j)).op :=
330+
by { dsimp [cone_of_cocone_left_op], simp }
331+
332+
def cocone_left_op_of_cone (c : cone F) : cocone (F.left_op) :=
333+
{ X := unop c.X,
334+
ι := nat_trans.left_op c.π }
335+
336+
@[simp] lemma cocone_left_op_of_cone_X (c : cone F) :
337+
(cocone_left_op_of_cone c).X = unop c.X :=
338+
rfl
339+
@[simp] lemma cocone_left_op_of_cone_ι_app (c : cone F) (j) :
340+
(cocone_left_op_of_cone c).ι.app j = (c.π.app (unop j)).unop :=
341+
by { dsimp [cocone_left_op_of_cone], simp }
342+
343+
def cocone_of_cone_left_op (c : cone F.left_op) : cocone F :=
344+
{ X := op c.X,
345+
ι := nat_trans.right_op ((const.op_obj_unop (op c.X)).hom ≫ c.π) }
346+
347+
@[simp] lemma cocone_of_cone_left_op_X (c : cone F.left_op) :
348+
(cocone_of_cone_left_op c).X = op c.X :=
349+
rfl
350+
@[simp] lemma cocone_of_cone_left_op_ι_app (c : cone F.left_op) (j) :
351+
(cocone_of_cone_left_op c).ι.app j = (c.π.app (op j)).op :=
352+
by { dsimp [cocone_of_cone_left_op], simp }
353+
354+
def cone_left_op_of_cocone (c : cocone F) : cone (F.left_op) :=
355+
{ X := unop c.X,
356+
π := nat_trans.left_op c.ι }
357+
358+
@[simp] lemma cone_left_op_of_cocone_X (c : cocone F) :
359+
(cone_left_op_of_cocone c).X = unop c.X :=
360+
rfl
361+
@[simp] lemma cone_left_op_of_cocone_π_app (c : cocone F) (j) :
362+
(cone_left_op_of_cocone c).π.app j = (c.ι.app (unop j)).unop :=
363+
by { dsimp [cone_left_op_of_cocone], simp }
364+
365+
end category_theory.limits
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
-- Copyright (c) 2019 Scott Morrison. All rights reserved.
2+
-- Released under Apache 2.0 license as described in the file LICENSE.
3+
-- Authors: Scott Morrison
4+
5+
import category_theory.limits.limits
6+
7+
universes v u
8+
9+
open category_theory
10+
open category_theory.functor
11+
12+
namespace category_theory.limits
13+
14+
variables {C : Sort u} [𝒞 : category.{v+1} C]
15+
include 𝒞
16+
variables {J : Type v} [small_category J]
17+
variable (F : J ⥤ Cᵒᵖ)
18+
19+
instance [has_colimit.{v} F.left_op] : has_limit.{v} F :=
20+
{ cone := cone_of_cocone_left_op (colimit.cocone F.left_op),
21+
is_limit :=
22+
{ lift := λ s, (colimit.desc F.left_op (cocone_left_op_of_cone s)).op,
23+
fac' := λ s j,
24+
begin
25+
rw [cone_of_cocone_left_op_π_app, colimit.cocone_ι, ←op_comp,
26+
colimit.ι_desc, cocone_left_op_of_cone_ι_app, has_hom.hom.op_unop],
27+
refl, end,
28+
uniq' := λ s m w,
29+
begin
30+
-- It's a pity we can't do this automatically.
31+
-- Usually something like this would work by limit.hom_ext,
32+
-- but the opposites get in the way of this firing.
33+
have u := (colimit.is_colimit F.left_op).uniq (cocone_left_op_of_cone s) (m.unop),
34+
convert congr_arg (λ f : _ ⟶ _, f.op) (u _), clear u,
35+
intro j,
36+
rw [cocone_left_op_of_cone_ι_app, colimit.cocone_ι],
37+
convert congr_arg (λ f : _ ⟶ _, f.unop) (w (unop j)), clear w,
38+
rw [cone_of_cocone_left_op_π_app, colimit.cocone_ι, has_hom.hom.unop_op],
39+
refl,
40+
end } }
41+
42+
instance [has_colimits_of_shape.{v} Jᵒᵖ C] : has_limits_of_shape.{v} J Cᵒᵖ :=
43+
{ has_limit := λ F, by apply_instance }
44+
45+
instance [has_colimits.{v} C] : has_limits.{v} Cᵒᵖ :=
46+
{ has_limits_of_shape := λ J 𝒥, by { resetI, apply_instance } }
47+
48+
instance [has_limit.{v} F.left_op] : has_colimit.{v} F :=
49+
{ cocone := cocone_of_cone_left_op (limit.cone F.left_op),
50+
is_colimit :=
51+
{ desc := λ s, (limit.lift F.left_op (cone_left_op_of_cocone s)).op,
52+
fac' := λ s j,
53+
begin
54+
rw [cocone_of_cone_left_op_ι_app, limit.cone_π, ←op_comp,
55+
limit.lift_π, cone_left_op_of_cocone_π_app, has_hom.hom.op_unop],
56+
refl, end,
57+
uniq' := λ s m w,
58+
begin
59+
have u := (limit.is_limit F.left_op).uniq (cone_left_op_of_cocone s) (m.unop),
60+
convert congr_arg (λ f : _ ⟶ _, f.op) (u _), clear u,
61+
intro j,
62+
rw [cone_left_op_of_cocone_π_app, limit.cone_π],
63+
convert congr_arg (λ f : _ ⟶ _, f.unop) (w (unop j)), clear w,
64+
rw [cocone_of_cone_left_op_ι_app, limit.cone_π, has_hom.hom.unop_op],
65+
refl,
66+
end } }
67+
68+
instance [has_limits_of_shape.{v} Jᵒᵖ C] : has_colimits_of_shape.{v} J Cᵒᵖ :=
69+
{ has_colimit := λ F, by apply_instance }
70+
71+
instance [has_limits.{v} C] : has_colimits.{v} Cᵒᵖ :=
72+
{ has_colimits_of_shape := λ J 𝒥, by { resetI, apply_instance } }
73+
74+
end category_theory.limits

src/category_theory/opposites.lean

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ instance category.opposite : category.{v₁} Cᵒᵖ :=
9898
@[simp] lemma unop_comp {X Y Z : Cᵒᵖ} {f : X ⟶ Y} {g : Y ⟶ Z} :
9999
(f ≫ g).unop = g.unop ≫ f.unop := rfl
100100
@[simp] lemma unop_id {X : Cᵒᵖ} : (𝟙 X).unop = 𝟙 (unop X) := rfl
101+
101102
@[simp] lemma unop_id_op {X : C} : (𝟙 (op X)).unop = 𝟙 X := rfl
102103
@[simp] lemma op_id_unop {X : Cᵒᵖ} : (𝟙 (unop X)).op = 𝟙 X := rfl
103104

@@ -154,6 +155,28 @@ definition op_inv : (Cᵒᵖ ⥤ Dᵒᵖ) ⥤ (C ⥤ D)ᵒᵖ :=
154155

155156
-- TODO show these form an equivalence
156157

158+
variables {C D}
159+
160+
protected definition left_op (F : C ⥤ Dᵒᵖ) : Cᵒᵖ ⥤ D :=
161+
{ obj := λ X, unop (F.obj (unop X)),
162+
map := λ X Y f, (F.map f.unop).unop }
163+
164+
@[simp] lemma left_op_obj (F : C ⥤ Dᵒᵖ) (X : Cᵒᵖ) : (F.left_op).obj X = unop (F.obj (unop X)) := rfl
165+
@[simp] lemma left_op_map (F : C ⥤ Dᵒᵖ) {X Y : Cᵒᵖ} (f : X ⟶ Y) :
166+
(F.left_op).map f = (F.map f.unop).unop :=
167+
rfl
168+
169+
protected definition right_op (F : Cᵒᵖ ⥤ D) : C ⥤ Dᵒᵖ :=
170+
{ obj := λ X, op (F.obj (op X)),
171+
map := λ X Y f, (F.map f.op).op }
172+
173+
@[simp] lemma right_op_obj (F : Cᵒᵖ ⥤ D) (X : C) : (F.right_op).obj X = op (F.obj (op X)) := rfl
174+
@[simp] lemma right_op_map (F : Cᵒᵖ ⥤ D) {X Y : C} (f : X ⟶ Y) :
175+
(F.right_op).map f = (F.map f.op).op :=
176+
rfl
177+
178+
-- TODO show these form an equivalence
179+
157180
instance {F : C ⥤ D} [full F] : full F.op :=
158181
{ preimage := λ X Y f, (F.preimage f.unop).op }
159182

@@ -182,6 +205,50 @@ end
182205

183206
end functor
184207

208+
namespace nat_trans
209+
210+
variables {D : Sort u₂} [𝒟 : category.{v₂} D]
211+
include 𝒟
212+
213+
section
214+
variables {F G : C ⥤ D}
215+
216+
protected definition op (α : F ⟶ G) : G.op ⟶ F.op :=
217+
{ app := λ X, (α.app (unop X)).op,
218+
naturality' := begin tidy, erw α.naturality, refl, end }
219+
220+
@[simp] lemma op_app (α : F ⟶ G) (X) : (nat_trans.op α).app X = (α.app (unop X)).op := rfl
221+
222+
protected definition unop (α : F.op ⟶ G.op) : G ⟶ F :=
223+
{ app := λ X, (α.app (op X)).unop,
224+
naturality' := begin tidy, erw α.naturality, refl, end }
225+
226+
@[simp] lemma unop_app (α : F.op ⟶ G.op) (X) : (nat_trans.unop α).app X = (α.app (op X)).unop := rfl
227+
228+
end
229+
230+
section
231+
variables {F G : C ⥤ Dᵒᵖ}
232+
233+
protected definition left_op (α : F ⟶ G) : G.left_op ⟶ F.left_op :=
234+
{ app := λ X, (α.app (unop X)).unop,
235+
naturality' := begin tidy, erw α.naturality, refl, end }
236+
237+
@[simp] lemma left_op_app (α : F ⟶ G) (X) :
238+
(nat_trans.left_op α).app X = (α.app (unop X)).unop :=
239+
rfl
240+
241+
protected definition right_op (α : F.left_op ⟶ G.left_op) : G ⟶ F :=
242+
{ app := λ X, (α.app (op X)).op,
243+
naturality' := begin tidy, erw α.naturality, refl, end }
244+
245+
@[simp] lemma right_op_app (α : F.left_op ⟶ G.left_op) (X) :
246+
(nat_trans.right_op α).app X = (α.app (op X)).op :=
247+
rfl
248+
249+
end
250+
end nat_trans
251+
185252
-- TODO the following definitions do not belong here
186253

187254
omit 𝒞

src/category_theory/yoneda.lean

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@ def yoneda_lemma : yoneda_pairing C ≅ yoneda_evaluation C :=
161161
erw [←functor_to_types.naturality,
162162
obj_map_id,
163163
functor_to_types.naturality,
164-
functor_to_types.map_id], refl,
164+
functor_to_types.map_id],
165+
refl,
165166
end,
166167
inv_hom_id' :=
167168
begin

0 commit comments

Comments
 (0)