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

Commit 5680428

Browse files
committed
chore(category_theory/limits): minor changes in equalizers and products (#3603)
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
1 parent 17ef529 commit 5680428

21 files changed

+386
-307
lines changed

src/algebra/category/Group/abelian.lean

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,9 @@ equivalence_reflects_normal_epi (forget₂ (Module ℤ) AddCommGroup).inv $
3535

3636
end
3737

38-
local attribute [instance] has_equalizers_of_has_finite_limits
39-
local attribute [instance] has_coequalizers_of_has_finite_colimits
40-
4138
/-- The category of abelian groups is abelian. -/
4239
instance : abelian AddCommGroup :=
43-
{ has_finite_products := by apply_instance,
44-
has_kernels := by apply_instance,
45-
has_cokernels := by apply_instance,
40+
{ has_finite_products := by { dsimp [has_finite_products], apply_instance },
4641
normal_mono := λ X Y, normal_mono,
4742
normal_epi := λ X Y, normal_epi }
4843

src/algebra/category/Module/abelian.lean

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,9 @@ def normal_epi (hf : epi f) : normal_epi f :=
6464
(linear_map.quot_ker_equiv_range f)) (linear_equiv.of_top _ (range_eq_top_of_epi _)))) $
6565
by { ext, refl } }
6666

67-
local attribute [instance] has_equalizers_of_has_finite_limits
68-
6967
/-- The category of R-modules is abelian. -/
7068
instance : abelian (Module R) :=
71-
{ has_finite_products := by apply_instance,
69+
{ has_finite_products := by { dsimp [has_finite_products], apply_instance },
7270
has_kernels := by apply_instance,
7371
has_cokernels := has_cokernels_Module,
7472
normal_mono := λ X Y, normal_mono,

src/category_theory/abelian/non_preadditive.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,16 +271,16 @@ section
271271
local attribute [instance] has_limit_parallel_pair
272272

273273
/-- A `non_preadditive_abelian` category has all equalizers. -/
274-
@[priority 100] instance : has_equalizers C :=
274+
@[priority 100] instance has_equalizers : has_equalizers C :=
275275
has_equalizers_of_has_limit_parallel_pair _
276276

277277
end
278278

279279
section
280280
local attribute [instance] has_colimit_parallel_pair
281281

282-
/-- A `non_preadditive_abelian` category as all coequalizers. -/
283-
@[priority 100] instance : has_coequalizers C :=
282+
/-- A `non_preadditive_abelian` category has all coequalizers. -/
283+
@[priority 100] instance has_coequalizers : has_coequalizers C :=
284284
has_coequalizers_of_has_colimit_parallel_pair _
285285

286286
end

src/category_theory/limits/lattice.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,22 @@ variables {α : Type u}
1717
@[priority 100] -- see Note [lower instance priority]
1818
instance has_finite_limits_of_semilattice_inf_top [semilattice_inf_top α] :
1919
has_finite_limits α :=
20-
{ has_limits_of_shape := λ J 𝒥₁ 𝒥₂, by exactI
20+
λ J 𝒥₁ 𝒥₂, by exactI
2121
{ has_limit := λ F,
2222
{ cone :=
2323
{ X := finset.univ.inf F.obj,
2424
π := { app := λ j, ⟨⟨finset.inf_le (fintype.complete _)⟩⟩ } },
25-
is_limit := { lift := λ s, ⟨⟨finset.le_inf (λ j _, le_of_hom (s.π.app j))⟩⟩ } } } }
25+
is_limit := { lift := λ s, ⟨⟨finset.le_inf (λ j _, (s.π.app j).down.down)⟩⟩ } } }
2626

2727
@[priority 100] -- see Note [lower instance priority]
2828
instance has_finite_colimits_of_semilattice_sup_bot [semilattice_sup_bot α] :
2929
has_finite_colimits α :=
30-
{ has_colimits_of_shape := λ J 𝒥₁ 𝒥₂, by exactI
30+
λ J 𝒥₁ 𝒥₂, by exactI
3131
{ has_colimit := λ F,
3232
{ cocone :=
3333
{ X := finset.univ.sup F.obj,
3434
ι := { app := λ i, ⟨⟨finset.le_sup (fintype.complete _)⟩⟩ } },
35-
is_colimit := { desc := λ s, ⟨⟨finset.sup_le (λ j _, le_of_hom (s.ι.app j))⟩⟩ } } } }
35+
is_colimit := { desc := λ s, ⟨⟨finset.sup_le (λ j _, (s.ι.app j).down.down)⟩⟩ } } }
3636

3737
-- It would be nice to only use the `Inf` half of the complete lattice, but
3838
-- this seems not to have been described separately.

src/category_theory/limits/opposites.lean

Lines changed: 45 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Copyright (c) 2019 Scott Morrison. All rights reserved.
33
Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Scott Morrison, Floris van Doorn
55
-/
6-
import category_theory.limits.limits
6+
import category_theory.limits.shapes.products
77
import category_theory.discrete_category
88

99
universes v u
@@ -18,7 +18,10 @@ variables {C : Type u} [category.{v} C]
1818
variables {J : Type v} [small_category J]
1919
variable (F : J ⥤ Cᵒᵖ)
2020

21-
instance has_limit_of_has_colimit_left_op [has_colimit F.left_op] : has_limit F :=
21+
/--
22+
If `F.left_op : Jᵒᵖ ⥤ C` has a chosen colimit, we can construct a chosen limit for `F : J ⥤ Cᵒᵖ`.
23+
-/
24+
def has_limit_of_has_colimit_left_op [has_colimit F.left_op] : has_limit F :=
2225
{ cone := cone_of_cocone_left_op (colimit.cocone F.left_op),
2326
is_limit :=
2427
{ lift := λ s, (colimit.desc F.left_op (cocone_left_op_of_cone s)).op,
@@ -41,14 +44,25 @@ instance has_limit_of_has_colimit_left_op [has_colimit F.left_op] : has_limit F
4144
refl,
4245
end } }
4346

44-
instance has_limits_of_shape_op_of_has_colimits_of_shape [has_colimits_of_shape Jᵒᵖ C] :
47+
/--
48+
If `C` has chosen colimits of shape `Jᵒᵖ`, we can construct chosen limits in `Cᵒᵖ` of shape `J`.
49+
-/
50+
def has_limits_of_shape_op_of_has_colimits_of_shape [has_colimits_of_shape Jᵒᵖ C] :
4551
has_limits_of_shape J Cᵒᵖ :=
46-
{ has_limit := λ F, by apply_instance }
52+
{ has_limit := λ F, has_limit_of_has_colimit_left_op F }
53+
54+
local attribute [instance] has_limits_of_shape_op_of_has_colimits_of_shape
4755

48-
instance has_limits_op_of_has_colimits [has_colimits C] : has_limits Cᵒᵖ :=
56+
/--
57+
If `C` has chosen colimits, we can construct chosen limits for `Cᵒᵖ`.
58+
-/
59+
def has_limits_op_of_has_colimits [has_colimits C] : has_limits Cᵒᵖ :=
4960
{ has_limits_of_shape := λ J 𝒥, by { resetI, apply_instance } }
5061

51-
instance has_colimit_of_has_limit_left_op [has_limit F.left_op] : has_colimit F :=
62+
/--
63+
If `F.left_op : Jᵒᵖ ⥤ C` has a chosen limit, we can construct a chosen colimit for `F : J ⥤ Cᵒᵖ`.
64+
-/
65+
def has_colimit_of_has_limit_left_op [has_limit F.left_op] : has_colimit F :=
5266
{ cocone := cocone_of_cone_left_op (limit.cone F.left_op),
5367
is_colimit :=
5468
{ desc := λ s, (limit.lift F.left_op (cone_left_op_of_cocone s)).op,
@@ -68,27 +82,42 @@ instance has_colimit_of_has_limit_left_op [has_limit F.left_op] : has_colimit F
6882
refl,
6983
end } }
7084

71-
instance has_colimits_of_shape_op_of_has_limits_of_shape [has_limits_of_shape Jᵒᵖ C] :
85+
/--
86+
If `C` has chosen colimits of shape `Jᵒᵖ`, we can construct chosen limits in `Cᵒᵖ` of shape `J`.
87+
-/
88+
def has_colimits_of_shape_op_of_has_limits_of_shape [has_limits_of_shape Jᵒᵖ C] :
7289
has_colimits_of_shape J Cᵒᵖ :=
73-
{ has_colimit := λ F, by apply_instance }
90+
{ has_colimit := λ F, has_colimit_of_has_limit_left_op F }
7491

75-
instance has_colimits_op_of_has_limits [has_limits C] : has_colimits Cᵒᵖ :=
92+
local attribute [instance] has_colimits_of_shape_op_of_has_limits_of_shape
93+
94+
/--
95+
If `C` has chosen limits, we can construct chosen colimits for `Cᵒᵖ`.
96+
-/
97+
def has_colimits_op_of_has_limits [has_limits C] : has_colimits Cᵒᵖ :=
7698
{ has_colimits_of_shape := λ J 𝒥, by { resetI, apply_instance } }
7799

78100
variables (X : Type v)
79-
instance has_coproducts_opposite [has_limits_of_shape (discrete X) C] :
80-
has_colimits_of_shape (discrete X) Cᵒᵖ :=
101+
/--
102+
If `C` has products indexed by `X`, then `Cᵒᵖ` has coproducts indexed by `X`.
103+
-/
104+
def has_coproducts_opposite [has_products_of_shape X C] :
105+
has_coproducts_of_shape X Cᵒᵖ :=
81106
begin
82107
haveI : has_limits_of_shape (discrete X)ᵒᵖ C :=
83-
has_limits_of_shape_of_equivalence (discrete.opposite X).symm, apply_instance
108+
has_limits_of_shape_of_equivalence (discrete.opposite X).symm,
109+
apply_instance
84110
end
85111

86-
instance has_products_opposite [has_colimits_of_shape (discrete X) C] :
87-
has_limits_of_shape (discrete X) Cᵒᵖ :=
112+
/--
113+
If `C` has coproducts indexed by `X`, then `Cᵒᵖ` has products indexed by `X`.
114+
-/
115+
def has_products_opposite [has_coproducts_of_shape X C] :
116+
has_products_of_shape X Cᵒᵖ :=
88117
begin
89118
haveI : has_colimits_of_shape (discrete X)ᵒᵖ C :=
90-
has_colimits_of_shape_of_equivalence (discrete.opposite X).symm, apply_instance
119+
has_colimits_of_shape_of_equivalence (discrete.opposite X).symm,
120+
apply_instance
91121
end
92122

93-
94123
end category_theory.limits

src/category_theory/limits/shapes/binary_products.lean

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -402,24 +402,20 @@ end coprod_lemmas
402402
variables (C)
403403

404404
/-- `has_binary_products` represents a choice of product for every pair of objects. -/
405-
class has_binary_products :=
406-
(has_limits_of_shape : has_limits_of_shape (discrete walking_pair) C)
405+
abbreviation has_binary_products := has_limits_of_shape (discrete walking_pair) C
407406

408407
/-- `has_binary_coproducts` represents a choice of coproduct for every pair of objects. -/
409-
class has_binary_coproducts :=
410-
(has_colimits_of_shape : has_colimits_of_shape (discrete walking_pair) C)
411-
412-
attribute [instance] has_binary_products.has_limits_of_shape has_binary_coproducts.has_colimits_of_shape
408+
abbreviation has_binary_coproducts := has_colimits_of_shape (discrete walking_pair) C
413409

414410
/-- If `C` has all limits of diagrams `pair X Y`, then it has all binary products -/
415411
def has_binary_products_of_has_limit_pair [Π {X Y : C}, has_limit (pair X Y)] :
416412
has_binary_products C :=
417-
{ has_limits_of_shape := { has_limit := λ F, has_limit_of_iso (diagram_iso_pair F).symm } }
413+
{ has_limit := λ F, has_limit_of_iso (diagram_iso_pair F).symm }
418414

419415
/-- If `C` has all colimits of diagrams `pair X Y`, then it has all binary coproducts -/
420416
def has_binary_coproducts_of_has_colimit_pair [Π {X Y : C}, has_colimit (pair X Y)] :
421417
has_binary_coproducts C :=
422-
{ has_colimits_of_shape := { has_colimit := λ F, has_colimit_of_iso (diagram_iso_pair F) } }
418+
{ has_colimit := λ F, has_colimit_of_iso (diagram_iso_pair F) }
423419

424420
section prod_functor
425421
variables {C} [has_binary_products C]

src/category_theory/limits/shapes/biproducts.lean

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -123,20 +123,20 @@ attribute [instance, priority 100] has_biproducts_of_shape.has_biproduct
123123
/-- `has_finite_biproducts C` represents a choice of biproduct for every family of objects in `C`
124124
indexed by a finite type with decidable equality. -/
125125
class has_finite_biproducts :=
126-
(has_biproducts_of_shape : Π (J : Type v) [fintype J] [decidable_eq J],
126+
(has_biproducts_of_shape : Π (J : Type v) [decidable_eq J] [fintype J],
127127
has_biproducts_of_shape J C)
128128

129129
attribute [instance, priority 100] has_finite_biproducts.has_biproducts_of_shape
130130

131131
@[priority 100]
132132
instance has_finite_products_of_has_finite_biproducts [has_finite_biproducts C] :
133133
has_finite_products C :=
134-
λ J _ _, ⟨λ F, by exactI has_limit_of_iso discrete.nat_iso_functor.symm
134+
λ J _ _, ⟨λ F, by exactI has_limit_of_iso discrete.nat_iso_functor.symm⟩
135135

136136
@[priority 100]
137137
instance has_finite_coproducts_of_has_finite_biproducts [has_finite_biproducts C] :
138138
has_finite_coproducts C :=
139-
λ J _ _, ⟨λ F, by exactI has_colimit_of_iso discrete.nat_iso_functor
139+
λ J _ _, ⟨λ F, by exactI has_colimit_of_iso discrete.nat_iso_functor⟩
140140

141141
variables {J C}
142142

@@ -421,24 +421,14 @@ instance has_binary_biproduct.has_colimit_pair [has_binary_biproduct P Q] :
421421
{ cocone := has_binary_biproduct.bicone.to_cocone,
422422
is_colimit := has_binary_biproduct.is_colimit, }
423423

424-
@[priority 100]
425-
instance has_limits_of_shape_walking_pair [has_binary_biproducts C] :
426-
has_limits_of_shape (discrete walking_pair) C :=
427-
{ has_limit := λ F, has_limit_of_iso (diagram_iso_pair F).symm }
428-
@[priority 100]
429-
instance has_colimits_of_shape_walking_pair [has_binary_biproducts C] :
430-
has_colimits_of_shape (discrete walking_pair) C :=
431-
{ has_colimit := λ F, has_colimit_of_iso (diagram_iso_pair F) }
432-
433424
@[priority 100]
434425
instance has_binary_products_of_has_binary_biproducts [has_binary_biproducts C] :
435426
has_binary_products C :=
436-
by apply_instance⟩
437-
427+
{ has_limit := λ F, has_limit_of_iso (diagram_iso_pair F).symm }
438428
@[priority 100]
439429
instance has_binary_coproducts_of_has_binary_biproducts [has_binary_biproducts C] :
440430
has_binary_coproducts C :=
441-
by apply_instance⟩
431+
{ has_colimit := λ F, has_colimit_of_iso (diagram_iso_pair F) }
442432

443433
/--
444434
The isomorphism between the specified binary product and the specified binary coproduct for
@@ -637,7 +627,7 @@ namespace category_theory.limits
637627

638628
section preadditive
639629
variables {C : Type u} [category.{v} C] [preadditive C]
640-
variables {J : Type v} [fintype J] [decidable_eq J]
630+
variables {J : Type v} [decidable_eq J] [fintype J]
641631

642632
open category_theory.preadditive
643633
open_locale big_operators

src/category_theory/limits/shapes/constructions/binary_products.lean

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,20 @@ open category_theory category_theory.category category_theory.limits
2424
def has_binary_products_of_terminal_and_pullbacks
2525
(C : Type u) [𝒞 : category.{v} C] [has_terminal C] [has_pullbacks C] :
2626
has_binary_products C :=
27-
{ has_limits_of_shape :=
28-
{ has_limit := λ F,
29-
{ cone :=
30-
{ X := pullback (terminal.from (F.obj walking_pair.left))
31-
(terminal.from (F.obj walking_pair.right)),
32-
π := discrete.nat_trans (λ x, walking_pair.cases_on x pullback.fst pullback.snd)},
33-
is_limit :=
34-
{ lift := λ c, pullback.lift ((c.π).app walking_pair.left)
35-
((c.π).app walking_pair.right)
36-
(subsingleton.elim _ _),
37-
fac' := λ s c, walking_pair.cases_on c (limit.lift_π _ _) (limit.lift_π _ _),
38-
uniq' := λ s m J,
39-
begin
40-
rw [←J, ←J],
41-
ext;
42-
rw limit.lift_π;
43-
refl
44-
end } } } }
27+
{ has_limit := λ F,
28+
{ cone :=
29+
{ X := pullback (terminal.from (F.obj walking_pair.left))
30+
(terminal.from (F.obj walking_pair.right)),
31+
π := discrete.nat_trans (λ x, walking_pair.cases_on x pullback.fst pullback.snd)},
32+
is_limit :=
33+
{ lift := λ c, pullback.lift ((c.π).app walking_pair.left)
34+
((c.π).app walking_pair.right)
35+
(subsingleton.elim _ _),
36+
fac' := λ s c, walking_pair.cases_on c (limit.lift_π _ _) (limit.lift_π _ _),
37+
uniq' := λ s m J,
38+
begin
39+
rw [←J, ←J],
40+
ext;
41+
rw limit.lift_π;
42+
refl
43+
end } } }

src/category_theory/limits/shapes/constructions/equalizers.lean

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,8 @@ open has_equalizers_of_pullbacks_and_binary_products
7575
-- This is not an instance, as it is not always how one wants to construct equalizers!
7676
def has_equalizers_of_pullbacks_and_binary_products :
7777
has_equalizers C :=
78-
{ has_limits_of_shape :=
79-
{ has_limit := λ F,
80-
{ cone := equalizer_cone F,
81-
is_limit := equalizer_cone_is_limit F } } }
78+
{ has_limit := λ F,
79+
{ cone := equalizer_cone F,
80+
is_limit := equalizer_cone_is_limit F } }
8281

8382
end category_theory.limits

src/category_theory/limits/shapes/constructions/limits_of_products_and_equalizers.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def limits_from_equalizers_and_products
122122
-- This is not an instance, as it is not always how one wants to construct finite limits!
123123
def finite_limits_from_equalizers_and_finite_products
124124
[has_finite_products C] [has_equalizers C] : has_finite_limits C :=
125-
{ has_limits_of_shape := λ J _ _, by exactI
126-
{ has_limit := λ F, has_limit.of_cones_iso (diagram F) F (cones_iso F) } }
125+
λ J _ _, by exactI
126+
{ has_limit := λ F, has_limit.of_cones_iso (diagram F) F (cones_iso F) }
127127

128128
end category_theory.limits

0 commit comments

Comments
 (0)