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

Commit 02f2f94

Browse files
committed
refactor(category_theory/finite_limits): missing piece of #3320 (#3400)
A recent PR #3320 did some refactoring of special shapes of limits. It seems I forgot to include `wide_pullbacks` in that refactor, so I've done that here. Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
1 parent a0846da commit 02f2f94

File tree

2 files changed

+63
-47
lines changed

2 files changed

+63
-47
lines changed

src/category_theory/limits/shapes/finite_limits.lean

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +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
55
-/
6+
import data.fintype.basic
67
import category_theory.limits.shapes.products
78
import category_theory.limits.shapes.equalizers
89
import category_theory.limits.shapes.pullbacks
@@ -89,12 +90,70 @@ def has_coequalizers_of_has_finite_colimits [has_finite_colimits C] : has_coequa
8990

9091
variables {J : Type v}
9192

93+
local attribute [tidy] tactic.case_bash
94+
95+
namespace wide_pullback_shape
96+
97+
instance fintype_obj [fintype J] : fintype (wide_pullback_shape J) :=
98+
by { rw wide_pullback_shape, apply_instance }
99+
100+
instance fintype_hom [decidable_eq J] (j j' : wide_pullback_shape J) :
101+
fintype (j ⟶ j') :=
102+
{ elems :=
103+
begin
104+
cases j',
105+
{ cases j,
106+
{ exact {hom.id none} },
107+
{ exact {hom.term j} } },
108+
{ by_cases some j' = j,
109+
{ rw h,
110+
exact {hom.id j} },
111+
{ exact ∅ } }
112+
end,
113+
complete := by tidy }
114+
115+
end wide_pullback_shape
116+
117+
namespace wide_pushout_shape
118+
119+
instance fintype_obj [fintype J] : fintype (wide_pushout_shape J) :=
120+
by { rw wide_pushout_shape, apply_instance }
121+
122+
instance fintype_hom [decidable_eq J] (j j' : wide_pushout_shape J) :
123+
fintype (j ⟶ j') :=
124+
{ elems :=
125+
begin
126+
cases j,
127+
{ cases j',
128+
{ exact {hom.id none} },
129+
{ exact {hom.init j'} } },
130+
{ by_cases some j = j',
131+
{ rw h,
132+
exact {hom.id j'} },
133+
{ exact ∅ } }
134+
end,
135+
complete := by tidy }
136+
137+
end wide_pushout_shape
138+
92139
instance fin_category_wide_pullback [fintype J] [decidable_eq J] : fin_category (wide_pullback_shape J) :=
93140
{ fintype_hom := wide_pullback_shape.fintype_hom }
94141

95142
instance fin_category_wide_pushout [fintype J] [decidable_eq J] : fin_category (wide_pushout_shape J) :=
96143
{ fintype_hom := wide_pushout_shape.fintype_hom }
97144

145+
/-- `has_finite_wide_pullbacks` represents a choice of wide pullback for every finite collection of morphisms -/
146+
class has_finite_wide_pullbacks :=
147+
(has_limits_of_shape : Π (J : Type v) [decidable_eq J] [fintype J], has_limits_of_shape (wide_pullback_shape J) C)
148+
149+
attribute [instance] has_finite_wide_pullbacks.has_limits_of_shape
150+
151+
/-- `has_finite_wide_pushouts` represents a choice of wide pushout for every finite collection of morphisms -/
152+
class has_finite_wide_pushouts :=
153+
(has_colimits_of_shape : Π (J : Type v) [decidable_eq J] [fintype J], has_colimits_of_shape (wide_pushout_shape J) C)
154+
155+
attribute [instance] has_finite_wide_pushouts.has_colimits_of_shape
156+
98157
/-- Finite wide pullbacks are finite limits, so if `C` has all finite limits, it also has finite wide pullbacks -/
99158
def has_finite_wide_pullbacks_of_has_finite_limits [has_finite_limits C] : has_finite_wide_pullbacks C :=
100159
{ has_limits_of_shape := λ J _ _, by exactI (has_finite_limits.has_limits_of_shape _) }

src/category_theory/limits/shapes/wide_pullbacks.lean

Lines changed: 4 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ Copyright (c) 2020 Bhavik Mehta. All rights reserved.
33
Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Bhavik Mehta
55
-/
6-
import data.fintype.basic
76
import category_theory.limits.limits
87
import category_theory.sparse
98

@@ -29,6 +28,8 @@ universes v u
2928

3029
open category_theory category_theory.limits
3130

31+
namespace category_theory.limits
32+
3233
variable (J : Type v)
3334

3435
/-- A wide pullback shape for any type `J` can be written simply as `option J`. -/
@@ -41,9 +42,6 @@ def wide_pushout_shape := option J
4142

4243
namespace wide_pullback_shape
4344

44-
instance fintype_obj [fintype J] : fintype (wide_pullback_shape J) :=
45-
by { rw wide_pullback_shape, apply_instance }
46-
4745
variable {J}
4846

4947
/-- The type of arrows for the shape indexing a wide pullback. -/
@@ -69,21 +67,6 @@ instance hom.inhabited : inhabited (hom none none) := ⟨hom.id (none : wide_pul
6967

7068
local attribute [tidy] tactic.case_bash
7169

72-
instance fintype_hom [decidable_eq J] (j j' : wide_pullback_shape J) :
73-
fintype (j ⟶ j') :=
74-
{ elems :=
75-
begin
76-
cases j',
77-
{ cases j,
78-
{ exact {hom.id none} },
79-
{ exact {hom.term j} } },
80-
{ by_cases some j' = j,
81-
{ rw h,
82-
exact {hom.id j} },
83-
{ exact ∅ } }
84-
end,
85-
complete := by tidy }
86-
8770
instance subsingleton_hom (j j' : wide_pullback_shape J) : subsingleton (j ⟶ j') :=
8871
by tidy⟩
8972

@@ -116,9 +99,6 @@ end wide_pullback_shape
11699

117100
namespace wide_pushout_shape
118101

119-
instance fintype_obj [fintype J] : fintype (wide_pushout_shape J) :=
120-
by { rw wide_pushout_shape, apply_instance }
121-
122102
variable {J}
123103

124104
/-- The type of arrows for the shape indexing a wide psuhout. -/
@@ -144,21 +124,6 @@ instance hom.inhabited : inhabited (hom none none) := ⟨hom.id (none : wide_pus
144124

145125
local attribute [tidy] tactic.case_bash
146126

147-
instance fintype_hom [decidable_eq J] (j j' : wide_pushout_shape J) :
148-
fintype (j ⟶ j') :=
149-
{ elems :=
150-
begin
151-
cases j,
152-
{ cases j',
153-
{ exact {hom.id none} },
154-
{ exact {hom.init j'} } },
155-
{ by_cases some j = j',
156-
{ rw h,
157-
exact {hom.id j'} },
158-
{ exact ∅ } }
159-
end,
160-
complete := by tidy }
161-
162127
instance subsingleton_hom (j j' : wide_pushout_shape J) : subsingleton (j ⟶ j') :=
163128
by tidy⟩
164129

@@ -195,20 +160,12 @@ variables (C : Type u) [category.{v} C]
195160
class has_wide_pullbacks :=
196161
(has_limits_of_shape : Π (J : Type v), has_limits_of_shape (wide_pullback_shape J) C)
197162

198-
/-- `has_wide_pullbacks` represents a choice of wide pullback for every finite collection of morphisms -/
199-
class has_finite_wide_pullbacks :=
200-
(has_limits_of_shape : Π (J : Type v) [decidable_eq J] [fintype J], has_limits_of_shape (wide_pullback_shape J) C)
201-
202163
attribute [instance] has_wide_pullbacks.has_limits_of_shape
203-
attribute [instance] has_finite_wide_pullbacks.has_limits_of_shape
204164

205165
/-- `has_wide_pushouts` represents a choice of wide pushout for every collection of morphisms -/
206166
class has_wide_pushouts :=
207167
(has_colimits_of_shape : Π (J : Type v), has_colimits_of_shape (wide_pushout_shape J) C)
208168

209-
/-- `has_wide_pushouts` represents a choice of wide pushout for every finite collection of morphisms -/
210-
class has_finite_wide_pushouts :=
211-
(has_colimits_of_shape : Π (J : Type v) [decidable_eq J] [fintype J], has_colimits_of_shape (wide_pushout_shape J) C)
212-
213169
attribute [instance] has_wide_pushouts.has_colimits_of_shape
214-
attribute [instance] has_finite_wide_pushouts.has_colimits_of_shape
170+
171+
end category_theory.limits

0 commit comments

Comments
 (0)