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

Commit b4d007f

Browse files
committed
feat(category_theory/limits): transport is_limit along F.left_op and similar (#12166)
1 parent 371b48a commit b4d007f

File tree

1 file changed

+193
-35
lines changed

1 file changed

+193
-35
lines changed

src/category_theory/limits/opposites.lean

Lines changed: 193 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ but not yet for pullbacks / pushouts or for (co)equalizers.
1414
1515
-/
1616

17-
universes v u
17+
universes v₁ v₂ u₁ u₂
1818

1919
noncomputable theory
2020

@@ -24,28 +24,196 @@ open opposite
2424

2525
namespace category_theory.limits
2626

27-
variables {C : Type u} [category.{v} C]
28-
variables {J : Type v} [small_category J]
29-
variable (F : J ⥤ Cᵒᵖ)
27+
variables {C : Type u₁} [category.{v₁} C]
28+
variables {J : Type u₂} [category.{v₂} J]
29+
30+
/-- Turn a colimit for `F : J ⥤ C` into a limit for `F.op : Jᵒᵖ ⥤ Cᵒᵖ`. -/
31+
@[simps] def is_limit_cocone_op (F : J ⥤ C) {c : cocone F} (hc : is_colimit c) :
32+
is_limit c.op :=
33+
{ lift := λ s, (hc.desc s.unop).op,
34+
fac' := λ s j, quiver.hom.unop_inj (by simpa),
35+
uniq' := λ s m w,
36+
begin
37+
refine quiver.hom.unop_inj (hc.hom_ext (λ j, quiver.hom.op_inj _)),
38+
simpa only [quiver.hom.unop_op, is_colimit.fac] using w (op j)
39+
end }
40+
41+
/-- Turn a limit for `F : J ⥤ C` into a colimit for `F.op : Jᵒᵖ ⥤ Cᵒᵖ`. -/
42+
@[simps] def is_colimit_cone_op (F : J ⥤ C) {c : cone F} (hc : is_limit c) :
43+
is_colimit c.op :=
44+
{ desc := λ s, (hc.lift s.unop).op,
45+
fac' := λ s j, quiver.hom.unop_inj (by simpa),
46+
uniq' := λ s m w,
47+
begin
48+
refine quiver.hom.unop_inj (hc.hom_ext (λ j, quiver.hom.op_inj _)),
49+
simpa only [quiver.hom.unop_op, is_limit.fac] using w (op j)
50+
end }
51+
52+
/-- Turn a colimit for `F : J ⥤ Cᵒᵖ` into a limit for `F.left_op : Jᵒᵖ ⥤ C`. -/
53+
@[simps] def is_limit_cone_left_op_of_cocone (F : J ⥤ Cᵒᵖ) {c : cocone F} (hc : is_colimit c) :
54+
is_limit (cone_left_op_of_cocone c) :=
55+
{ lift := λ s, (hc.desc (cocone_of_cone_left_op s)).unop,
56+
fac' := λ s j, quiver.hom.op_inj $ by simpa only [cone_left_op_of_cocone_π_app, op_comp,
57+
quiver.hom.op_unop, is_colimit.fac, cocone_of_cone_left_op_ι_app],
58+
uniq' := λ s m w,
59+
begin
60+
refine quiver.hom.op_inj (hc.hom_ext (λ j, quiver.hom.unop_inj _)),
61+
simpa only [quiver.hom.op_unop, is_colimit.fac, cocone_of_cone_left_op_ι_app] using w (op j)
62+
end }
63+
64+
/-- Turn a limit of `F : J ⥤ Cᵒᵖ` into a colimit of `F.left_op : Jᵒᵖ ⥤ C`. -/
65+
@[simps] def is_colimit_cocone_left_op_of_cone (F : J ⥤ Cᵒᵖ) {c : cone F} (hc : is_limit c) :
66+
is_colimit (cocone_left_op_of_cone c) :=
67+
{ desc := λ s, (hc.lift (cone_of_cocone_left_op s)).unop,
68+
fac' := λ s j, quiver.hom.op_inj $ by simpa only [cocone_left_op_of_cone_ι_app, op_comp,
69+
quiver.hom.op_unop, is_limit.fac, cone_of_cocone_left_op_π_app],
70+
uniq' := λ s m w,
71+
begin
72+
refine quiver.hom.op_inj (hc.hom_ext (λ j, quiver.hom.unop_inj _)),
73+
simpa only [quiver.hom.op_unop, is_limit.fac, cone_of_cocone_left_op_π_app] using w (op j)
74+
end }
75+
76+
/-- Turn a colimit for `F : Jᵒᵖ ⥤ C` into a limit for `F.right_op : J ⥤ Cᵒᵖ`. -/
77+
@[simps] def is_limit_cone_right_op_of_cocone (F : Jᵒᵖ ⥤ C) {c : cocone F} (hc : is_colimit c) :
78+
is_limit (cone_right_op_of_cocone c) :=
79+
{ lift := λ s, (hc.desc (cocone_of_cone_right_op s)).op,
80+
fac' := λ s j, quiver.hom.unop_inj (by simpa),
81+
uniq' := λ s m w,
82+
begin
83+
refine quiver.hom.unop_inj (hc.hom_ext (λ j, quiver.hom.op_inj _)),
84+
simpa only [quiver.hom.unop_op, is_colimit.fac] using w (unop j)
85+
end }
86+
87+
/-- Turn a limit for `F : Jᵒᵖ ⥤ C` into a colimit for `F.right_op : J ⥤ Cᵒᵖ`. -/
88+
@[simps] def is_colimit_cocone_right_op_of_cone (F : Jᵒᵖ ⥤ C) {c : cone F} (hc : is_limit c) :
89+
is_colimit (cocone_right_op_of_cone c) :=
90+
{ desc := λ s, (hc.lift (cone_of_cocone_right_op s)).op,
91+
fac' := λ s j, quiver.hom.unop_inj (by simpa),
92+
uniq' := λ s m w,
93+
begin
94+
refine quiver.hom.unop_inj (hc.hom_ext (λ j, quiver.hom.op_inj _)),
95+
simpa only [quiver.hom.unop_op, is_limit.fac] using w (unop j)
96+
end }
97+
98+
/-- Turn a colimit for `F : Jᵒᵖ ⥤ Cᵒᵖ` into a limit for `F.unop : J ⥤ C`. -/
99+
@[simps] def is_limit_cone_unop_of_cocone (F : Jᵒᵖ ⥤ Cᵒᵖ) {c : cocone F} (hc : is_colimit c) :
100+
is_limit (cone_unop_of_cocone c) :=
101+
{ lift := λ s, (hc.desc (cocone_of_cone_unop s)).unop,
102+
fac' := λ s j, quiver.hom.op_inj (by simpa),
103+
uniq' := λ s m w,
104+
begin
105+
refine quiver.hom.op_inj (hc.hom_ext (λ j, quiver.hom.unop_inj _)),
106+
simpa only [quiver.hom.op_unop, is_colimit.fac] using w (unop j)
107+
end }
108+
109+
/-- Turn a limit of `F : Jᵒᵖ ⥤ Cᵒᵖ` into a colimit of `F.unop : J ⥤ C`. -/
110+
@[simps] def is_colimit_cocone_unop_of_cone (F : Jᵒᵖ ⥤ Cᵒᵖ) {c : cone F} (hc : is_limit c) :
111+
is_colimit (cocone_unop_of_cone c) :=
112+
{ desc := λ s, (hc.lift (cone_of_cocone_unop s)).unop,
113+
fac' := λ s j, quiver.hom.op_inj (by simpa),
114+
uniq' := λ s m w,
115+
begin
116+
refine quiver.hom.op_inj (hc.hom_ext (λ j, quiver.hom.unop_inj _)),
117+
simpa only [quiver.hom.op_unop, is_limit.fac] using w (unop j)
118+
end }
119+
120+
/-- Turn a colimit for `F.op : Jᵒᵖ ⥤ Cᵒᵖ` into a limit for `F : J ⥤ C`. -/
121+
@[simps] def is_limit_cocone_unop (F : J ⥤ C) {c : cocone F.op} (hc : is_colimit c) :
122+
is_limit c.unop :=
123+
{ lift := λ s, (hc.desc s.op).unop,
124+
fac' := λ s j, quiver.hom.op_inj (by simpa),
125+
uniq' := λ s m w,
126+
begin
127+
refine quiver.hom.op_inj (hc.hom_ext (λ j, quiver.hom.unop_inj _)),
128+
simpa only [quiver.hom.op_unop, is_colimit.fac] using w (unop j)
129+
end }
130+
131+
/-- Turn a limit for `F.op : Jᵒᵖ ⥤ Cᵒᵖ` into a colimit for `F : J ⥤ C`. -/
132+
@[simps] def is_colimit_cone_unop (F : J ⥤ C) {c : cone F.op} (hc : is_limit c) :
133+
is_colimit c.unop :=
134+
{ desc := λ s, (hc.lift s.op).unop,
135+
fac' := λ s j, quiver.hom.op_inj (by simpa),
136+
uniq' := λ s m w,
137+
begin
138+
refine quiver.hom.op_inj (hc.hom_ext (λ j, quiver.hom.unop_inj _)),
139+
simpa only [quiver.hom.op_unop, is_limit.fac] using w (unop j)
140+
end }
141+
142+
/-- Turn a colimit for `F.left_op : Jᵒᵖ ⥤ C` into a limit for `F : J ⥤ Cᵒᵖ`. -/
143+
@[simps] def is_limit_cone_of_cocone_left_op (F : J ⥤ Cᵒᵖ) {c : cocone F.left_op}
144+
(hc : is_colimit c) : is_limit (cone_of_cocone_left_op c) :=
145+
{ lift := λ s, (hc.desc (cocone_left_op_of_cone s)).op,
146+
fac' := λ s j, quiver.hom.unop_inj $ by simpa only [cone_of_cocone_left_op_π_app, unop_comp,
147+
quiver.hom.unop_op, is_colimit.fac, cocone_left_op_of_cone_ι_app],
148+
uniq' := λ s m w,
149+
begin
150+
refine quiver.hom.unop_inj (hc.hom_ext (λ j, quiver.hom.op_inj _)),
151+
simpa only [quiver.hom.unop_op, is_colimit.fac, cone_of_cocone_left_op_π_app] using w (unop j)
152+
end }
153+
154+
/-- Turn a limit of `F.left_op : Jᵒᵖ ⥤ C` into a colimit of `F : J ⥤ Cᵒᵖ`. -/
155+
@[simps] def is_colimit_cocone_of_cone_left_op (F : J ⥤ Cᵒᵖ) {c : cone (F.left_op)}
156+
(hc : is_limit c) : is_colimit (cocone_of_cone_left_op c) :=
157+
{ desc := λ s, (hc.lift (cone_left_op_of_cocone s)).op,
158+
fac' := λ s j, quiver.hom.unop_inj $ by simpa only [cocone_of_cone_left_op_ι_app, unop_comp,
159+
quiver.hom.unop_op, is_limit.fac, cone_left_op_of_cocone_π_app],
160+
uniq' := λ s m w,
161+
begin
162+
refine quiver.hom.unop_inj (hc.hom_ext (λ j, quiver.hom.op_inj _)),
163+
simpa only [quiver.hom.unop_op, is_limit.fac, cocone_of_cone_left_op_ι_app] using w (unop j)
164+
end }
165+
166+
/-- Turn a colimit for `F.right_op : J ⥤ Cᵒᵖ` into a limit for `F : Jᵒᵖ ⥤ C`. -/
167+
@[simps] def is_limit_cone_of_cocone_right_op (F : Jᵒᵖ ⥤ C) {c : cocone F.right_op}
168+
(hc : is_colimit c) : is_limit (cone_of_cocone_right_op c) :=
169+
{ lift := λ s, (hc.desc (cocone_right_op_of_cone s)).unop,
170+
fac' := λ s j, quiver.hom.op_inj (by simpa),
171+
uniq' := λ s m w,
172+
begin
173+
refine quiver.hom.op_inj (hc.hom_ext (λ j, quiver.hom.unop_inj _)),
174+
simpa only [quiver.hom.op_unop, is_colimit.fac] using w (op j)
175+
end }
176+
177+
/-- Turn a limit for `F.right_op : J ⥤ Cᵒᵖ` into a limit for `F : Jᵒᵖ ⥤ C`. -/
178+
@[simps] def is_colimit_cocone_of_cone_right_op (F : Jᵒᵖ ⥤ C) {c : cone F.right_op}
179+
(hc : is_limit c) : is_colimit (cocone_of_cone_right_op c) :=
180+
{ desc := λ s, (hc.lift (cone_right_op_of_cocone s)).unop,
181+
fac' := λ s j, quiver.hom.op_inj (by simpa),
182+
uniq' := λ s m w,
183+
begin
184+
refine quiver.hom.op_inj (hc.hom_ext (λ j, quiver.hom.unop_inj _)),
185+
simpa only [quiver.hom.op_unop, is_limit.fac] using w (op j)
186+
end }
187+
188+
/-- Turn a colimit for `F.unop : J ⥤ C` into a limit for `F : Jᵒᵖ ⥤ Cᵒᵖ`. -/
189+
@[simps] def is_limit_cone_of_cocone_unop (F : Jᵒᵖ ⥤ Cᵒᵖ) {c : cocone F.unop} (hc : is_colimit c) :
190+
is_limit (cone_of_cocone_unop c) :=
191+
{ lift := λ s, (hc.desc (cocone_unop_of_cone s)).op,
192+
fac' := λ s j, quiver.hom.unop_inj (by simpa),
193+
uniq' := λ s m w,
194+
begin
195+
refine quiver.hom.unop_inj (hc.hom_ext (λ j, quiver.hom.op_inj _)),
196+
simpa only [quiver.hom.unop_op, is_colimit.fac] using w (op j)
197+
end }
198+
199+
/-- Turn a limit for `F.unop : J ⥤ C` into a colimit for `F : Jᵒᵖ ⥤ Cᵒᵖ`. -/
200+
@[simps] def is_colimit_cone_of_cocone_unop (F : Jᵒᵖ ⥤ Cᵒᵖ) {c : cone F.unop} (hc : is_limit c) :
201+
is_colimit (cocone_of_cone_unop c) :=
202+
{ desc := λ s, (hc.lift (cone_unop_of_cocone s)).op,
203+
fac' := λ s j, quiver.hom.unop_inj (by simpa),
204+
uniq' := λ s m w,
205+
begin
206+
refine quiver.hom.unop_inj (hc.hom_ext (λ j, quiver.hom.op_inj _)),
207+
simpa only [quiver.hom.unop_op, is_limit.fac] using w (op j)
208+
end }
30209

31210
/--
32211
If `F.left_op : Jᵒᵖ ⥤ C` has a colimit, we can construct a limit for `F : J ⥤ Cᵒᵖ`.
33212
-/
34-
lemma has_limit_of_has_colimit_left_op [has_colimit F.left_op] : has_limit F :=
213+
lemma has_limit_of_has_colimit_left_op (F : J ⥤ Cᵒᵖ) [has_colimit F.left_op] : has_limit F :=
35214
has_limit.mk
36215
{ cone := cone_of_cocone_left_op (colimit.cocone F.left_op),
37-
is_limit :=
38-
{ lift := λ s, (colimit.desc F.left_op (cocone_left_op_of_cone s)).op,
39-
fac' := λ s j,
40-
begin
41-
rw [cone_of_cocone_left_op_π_app, colimit.cocone_ι, ←op_comp,
42-
colimit.ι_desc, cocone_left_op_of_cone_ι_app, quiver.hom.op_unop],
43-
refl, end,
44-
uniq' := λ s m w,
45-
begin
46-
refine quiver.hom.unop_inj (colimit.hom_ext (λ j, quiver.hom.op_inj _)),
47-
simpa only [quiver.hom.unop_op, colimit.ι_desc] using w (unop j)
48-
end } }
216+
is_limit := is_limit_cone_of_cocone_left_op _ (colimit.is_colimit _) }
49217

50218
/--
51219
If `C` has colimits of shape `Jᵒᵖ`, we can construct limits in `Cᵒᵖ` of shape `J`.
@@ -61,24 +229,14 @@ If `C` has colimits, we can construct limits for `Cᵒᵖ`.
61229
-/
62230
lemma has_limits_op_of_has_colimits [has_colimits C] : has_limits Cᵒᵖ := ⟨infer_instance⟩
63231

232+
64233
/--
65234
If `F.left_op : Jᵒᵖ ⥤ C` has a limit, we can construct a colimit for `F : J ⥤ Cᵒᵖ`.
66235
-/
67-
lemma has_colimit_of_has_limit_left_op [has_limit F.left_op] : has_colimit F :=
236+
lemma has_colimit_of_has_limit_left_op (F : J ⥤ Cᵒᵖ) [has_limit F.left_op] : has_colimit F :=
68237
has_colimit.mk
69238
{ cocone := cocone_of_cone_left_op (limit.cone F.left_op),
70-
is_colimit :=
71-
{ desc := λ s, (limit.lift F.left_op (cone_left_op_of_cocone s)).op,
72-
fac' := λ s j,
73-
begin
74-
rw [cocone_of_cone_left_op_ι_app, limit.cone_π, ←op_comp,
75-
limit.lift_π, cone_left_op_of_cocone_π_app, quiver.hom.op_unop],
76-
refl, end,
77-
uniq' := λ s m w,
78-
begin
79-
refine quiver.hom.unop_inj (limit.hom_ext (λ j, quiver.hom.op_inj _)),
80-
simpa only [quiver.hom.unop_op, limit.lift_π] using w (unop j),
81-
end } }
239+
is_colimit := is_colimit_cocone_of_cone_left_op _ (limit.is_limit _) }
82240

83241
/--
84242
If `C` has colimits of shape `Jᵒᵖ`, we can construct limits in `Cᵒᵖ` of shape `J`.
@@ -94,7 +252,7 @@ If `C` has limits, we can construct colimits for `Cᵒᵖ`.
94252
-/
95253
lemma has_colimits_op_of_has_limits [has_limits C] : has_colimits Cᵒᵖ := ⟨infer_instance⟩
96254

97-
variables (X : Type v)
255+
variables (X : Type v)
98256
/--
99257
If `C` has products indexed by `X`, then `Cᵒᵖ` has coproducts indexed by `X`.
100258
-/
@@ -137,15 +295,15 @@ lemma has_finite_products_opposite [has_finite_coproducts C] :
137295

138296
lemma has_equalizers_opposite [has_coequalizers C] : has_equalizers Cᵒᵖ :=
139297
begin
140-
haveI : has_colimits_of_shape walking_parallel_pair.{v}ᵒᵖ C :=
141-
has_colimits_of_shape_of_equivalence walking_parallel_pair_op_equiv.{v},
298+
haveI : has_colimits_of_shape walking_parallel_pair.{v}ᵒᵖ C :=
299+
has_colimits_of_shape_of_equivalence walking_parallel_pair_op_equiv.{v},
142300
apply_instance
143301
end
144302

145303
lemma has_coequalizers_opposite [has_equalizers C] : has_coequalizers Cᵒᵖ :=
146304
begin
147-
haveI : has_limits_of_shape walking_parallel_pair.{v}ᵒᵖ C :=
148-
has_limits_of_shape_of_equivalence walking_parallel_pair_op_equiv.{v},
305+
haveI : has_limits_of_shape walking_parallel_pair.{v}ᵒᵖ C :=
306+
has_limits_of_shape_of_equivalence walking_parallel_pair_op_equiv.{v},
149307
apply_instance
150308
end
151309

0 commit comments

Comments
 (0)