@@ -43,9 +43,6 @@ class PreservesFiniteLimits (F : C ⥤ D) : Prop where
4343
4444attribute [instance] PreservesFiniteLimits.preservesFiniteLimits
4545
46- instance (F : C ⥤ D) : Subsingleton (PreservesFiniteLimits F) :=
47- ⟨fun ⟨a⟩ ⟨b⟩ => by congr⟩
48-
4946/-- Preserving finite limits also implies preserving limits over finite shapes in higher universes,
5047though through a noncomputable instance. -/
5148instance (priority := 100 ) preservesLimitsOfShapeOfPreservesFiniteLimits (F : C ⥤ D)
@@ -93,29 +90,25 @@ lemma preservesFiniteLimits_of_natIso {F G : C ⥤ D} (h : F ≅ G) [PreservesFi
9390
9491/- Porting note: adding this class because quantified classes don't behave well
9592https://github.com/leanprover-community/mathlib4/pull/2764 -/
96- /-- A functor `F` preserves finite products if it preserves all from `Discrete J`
97- for `Fintype J` -/
93+ /-- A functor `F` preserves finite products if it preserves all from `Discrete J` for `Finite J`.
94+ We require this for `J = Fin n` in the definition,
95+ then generalize to `J : Type u` in the instance. -/
9896class PreservesFiniteProducts (F : C ⥤ D) : Prop where
99- preserves : ∀ (J : Type ) [Fintype J], PreservesLimitsOfShape (Discrete J) F
100-
101- attribute [instance] PreservesFiniteProducts.preserves
102-
103- instance (F : C ⥤ D) : Subsingleton (PreservesFiniteProducts F) :=
104- ⟨fun ⟨a⟩ ⟨b⟩ => by congr⟩
97+ preserves : ∀ n, PreservesLimitsOfShape (Discrete (Fin n)) F
10598
10699instance (priority := 100 ) (F : C ⥤ D) (J : Type u) [Finite J]
107100 [PreservesFiniteProducts F] : PreservesLimitsOfShape (Discrete J) F := by
108- apply Nonempty.some
109101 obtain ⟨n, ⟨e⟩⟩ := Finite.exists_equiv_fin J
110- exact ⟨preservesLimitsOfShape_of_equiv (Discrete.equivalence e.symm) F⟩
102+ have := PreservesFiniteProducts.preserves (F := F) n
103+ exact preservesLimitsOfShape_of_equiv (Discrete.equivalence e.symm) F
111104
112105instance comp_preservesFiniteProducts (F : C ⥤ D) (G : D ⥤ E)
113106 [PreservesFiniteProducts F] [PreservesFiniteProducts G] :
114107 PreservesFiniteProducts (F ⋙ G) where
115- preserves _ _ := inferInstance
108+ preserves _ := inferInstance
116109
117110instance (F : C ⥤ D) [PreservesFiniteLimits F] : PreservesFiniteProducts F where
118- preserves _ _ := inferInstance
111+ preserves _ := inferInstance
119112
120113/--
121114A functor is said to reflect finite limits, if it reflects all limits of shape `J`,
@@ -127,20 +120,20 @@ class ReflectsFiniteLimits (F : C ⥤ D) : Prop where
127120
128121attribute [instance] ReflectsFiniteLimits.reflects
129122
130- instance (F : C ⥤ D) : Subsingleton (ReflectsFiniteLimits F) :=
131- ⟨fun ⟨a⟩ ⟨b⟩ => by congr⟩
132-
133123/- Similarly to preserving finite products, quantified classes don't behave well. -/
134124/--
135- A functor `F` preserves finite products if it reflects limits of shape `Discrete J` for finite `J`
125+ A functor `F` preserves finite products if it reflects limits of shape `Discrete J` for finite `J`.
126+ We require this for `J = Fin n` in the definition,
127+ then generalize to `J : Type u` in the instance.
136128-/
137129class ReflectsFiniteProducts (F : C ⥤ D) : Prop where
138- reflects : ∀ (J : Type ) [Fintype J] , ReflectsLimitsOfShape (Discrete J ) F
130+ reflects : ∀ n , ReflectsLimitsOfShape (Discrete (Fin n) ) F
139131
140- attribute [instance] ReflectsFiniteProducts.reflects
141-
142- instance (F : C ⥤ D) : Subsingleton (ReflectsFiniteProducts F) :=
143- ⟨fun ⟨a⟩ ⟨b⟩ => by congr⟩
132+ instance (priority := 100 ) (F : C ⥤ D) [ReflectsFiniteProducts F] (J : Type u) [Finite J] :
133+ ReflectsLimitsOfShape (Discrete J) F :=
134+ let ⟨n, ⟨e⟩⟩ := Finite.exists_equiv_fin J
135+ have := ReflectsFiniteProducts.reflects (F := F) n
136+ reflectsLimitsOfShape_of_equiv (Discrete.equivalence e.symm) _
144137
145138-- This is a dangerous instance as it has unbound universe variables.
146139/-- If we reflect limits of some arbitrary size, then we reflect all finite limits. -/
@@ -174,7 +167,7 @@ finite products.
174167-/
175168lemma preservesFiniteProducts_of_reflects_of_preserves (F : C ⥤ D) (G : D ⥤ E)
176169 [PreservesFiniteProducts (F ⋙ G)] [ReflectsFiniteProducts G] : PreservesFiniteProducts F where
177- preserves _ _ := preservesLimitsOfShape_of_reflects_of_preserves F G
170+ preserves _ := preservesLimitsOfShape_of_reflects_of_preserves F G
178171
179172instance reflectsFiniteLimits_of_reflectsIsomorphisms (F : C ⥤ D)
180173 [F.ReflectsIsomorphisms] [HasFiniteLimits C] [PreservesFiniteLimits F] :
@@ -184,15 +177,15 @@ instance reflectsFiniteLimits_of_reflectsIsomorphisms (F : C ⥤ D)
184177instance reflectsFiniteProducts_of_reflectsIsomorphisms (F : C ⥤ D)
185178 [F.ReflectsIsomorphisms] [HasFiniteProducts C] [PreservesFiniteProducts F] :
186179 ReflectsFiniteProducts F where
187- reflects _ _ := reflectsLimitsOfShape_of_reflectsIsomorphisms
180+ reflects _ := reflectsLimitsOfShape_of_reflectsIsomorphisms
188181
189182instance comp_reflectsFiniteProducts (F : C ⥤ D) (G : D ⥤ E)
190183 [ReflectsFiniteProducts F] [ReflectsFiniteProducts G] :
191184 ReflectsFiniteProducts (F ⋙ G) where
192- reflects _ _ := inferInstance
185+ reflects _ := inferInstance
193186
194187instance (F : C ⥤ D) [ReflectsFiniteLimits F] : ReflectsFiniteProducts F where
195- reflects _ _ := inferInstance
188+ reflects _ := inferInstance
196189
197190/-- A functor is said to preserve finite colimits, if it preserves all colimits of
198191shape `J`, where `J : Type` is a finite category.
@@ -204,9 +197,6 @@ class PreservesFiniteColimits (F : C ⥤ D) : Prop where
204197
205198attribute [instance] PreservesFiniteColimits.preservesFiniteColimits
206199
207- instance (F : C ⥤ D) : Subsingleton (PreservesFiniteColimits F) :=
208- ⟨fun ⟨a⟩ ⟨b⟩ => by congr⟩
209-
210200/--
211201Preserving finite colimits also implies preserving colimits over finite shapes in higher
212202universes.
@@ -257,44 +247,36 @@ lemma preservesFiniteColimits_of_natIso {F G : C ⥤ D} (h : F ≅ G) [Preserves
257247
258248/- Porting note: adding this class because quantified classes don't behave well
259249https://github.com/leanprover-community/mathlib4/pull/2764 -/
260- /-- A functor `F` preserves finite products if it preserves all from `Discrete J`
261- for `Fintype J` -/
250+ /-- A functor `F` preserves finite products if it preserves all from `Discrete J` for `Fintype J`.
251+ We require this for `J = Fin n` in the definition,
252+ then generalize to `J : Type u` in the instance. -/
262253class PreservesFiniteCoproducts (F : C ⥤ D) : Prop where
263- /-- preservation of colimits indexed by `Discrete J` when `[Fintype J]` -/
264- preserves : ∀ (J : Type ) [Fintype J], PreservesColimitsOfShape (Discrete J) F
265-
266- attribute [instance] PreservesFiniteCoproducts.preserves
267-
268- instance (F : C ⥤ D) : Subsingleton (PreservesFiniteCoproducts F) :=
269- ⟨fun ⟨a⟩ ⟨b⟩ => by congr⟩
254+ /-- preservation of colimits indexed by `Discrete (Fin n)`. -/
255+ preserves : ∀ n, PreservesColimitsOfShape (Discrete (Fin n)) F
270256
271257instance (priority := 100 ) (F : C ⥤ D) (J : Type u) [Finite J]
272- [PreservesFiniteCoproducts F] : PreservesColimitsOfShape (Discrete J) F := by
273- apply Nonempty.some
274- obtain ⟨n, ⟨e⟩⟩ := Finite.exists_equiv_fin J
275- exact ⟨ preservesColimitsOfShape_of_equiv (Discrete.equivalence e.symm) F⟩
258+ [PreservesFiniteCoproducts F] : PreservesColimitsOfShape (Discrete J) F :=
259+ let ⟨n, ⟨e⟩⟩ := Finite.exists_equiv_fin J
260+ have := PreservesFiniteCoproducts.preserves (F := F) n
261+ preservesColimitsOfShape_of_equiv (Discrete.equivalence e.symm) F
276262
277263instance comp_preservesFiniteCoproducts (F : C ⥤ D) (G : D ⥤ E)
278264 [PreservesFiniteCoproducts F] [PreservesFiniteCoproducts G] :
279265 PreservesFiniteCoproducts (F ⋙ G) where
280- preserves _ _ := inferInstance
266+ preserves _ := inferInstance
281267
282268instance (F : C ⥤ D) [PreservesFiniteColimits F] : PreservesFiniteCoproducts F where
283- preserves _ _ := inferInstance
269+ preserves _ := inferInstance
284270
285271/--
286272A functor is said to reflect finite colimits, if it reflects all colimits of shape `J`,
287273where `J : Type` is a finite category.
288274-/
289275class ReflectsFiniteColimits (F : C ⥤ D) : Prop where
290- reflects : ∀ (J : Type ) [SmallCategory J] [FinCategory J], ReflectsColimitsOfShape J F := by
291- infer_instance
276+ [reflects : ∀ (J : Type ) [SmallCategory J] [FinCategory J], ReflectsColimitsOfShape J F]
292277
293278attribute [instance] ReflectsFiniteColimits.reflects
294279
295- instance (F : C ⥤ D) : Subsingleton (ReflectsFiniteColimits F) :=
296- ⟨fun ⟨a⟩ ⟨b⟩ => by congr⟩
297-
298280-- This is a dangerous instance as it has unbound universe variables.
299281/-- If we reflect colimits of some arbitrary size, then we reflect all finite colimits. -/
300282lemma ReflectsColimitsOfSize.reflectsFiniteColimits
@@ -315,16 +297,20 @@ instance (priority := 120) (F : C ⥤ D)
315297
316298/- Similarly to preserving finite coproducts, quantified classes don't behave well. -/
317299/--
318- A functor `F` preserves finite coproducts if it reflects colimits of shape `Discrete J` for
319- finite `J`
300+ A functor `F` preserves finite coproducts if it reflects colimits of shape `Discrete J`
301+ for finite `J`.
302+
303+ We require this for `J = Fin n` in the definition,
304+ then generalize to `J : Type u` in the instance.
320305-/
321306class ReflectsFiniteCoproducts (F : C ⥤ D) : Prop where
322- reflects : ∀ (J : Type ) [Fintype J], ReflectsColimitsOfShape (Discrete J) F
323-
324- attribute [instance] ReflectsFiniteCoproducts.reflects
307+ reflects : ∀ n, ReflectsColimitsOfShape (Discrete (Fin n)) F
325308
326- instance (F : C ⥤ D) : Subsingleton (ReflectsFiniteCoproducts F) :=
327- ⟨fun ⟨a⟩ ⟨b⟩ => by congr⟩
309+ instance (priority := 100 ) (F : C ⥤ D) [ReflectsFiniteCoproducts F] (J : Type u) [Finite J] :
310+ ReflectsColimitsOfShape (Discrete J) F :=
311+ let ⟨n, ⟨e⟩⟩ := Finite.exists_equiv_fin J
312+ have := ReflectsFiniteCoproducts.reflects (F := F) n
313+ reflectsColimitsOfShape_of_equiv (Discrete.equivalence e.symm) _
328314
329315/--
330316If `F ⋙ G` preserves finite colimits and `G` reflects finite colimits, then `F` preserves finite
@@ -341,7 +327,7 @@ finite coproducts.
341327lemma preservesFiniteCoproducts_of_reflects_of_preserves (F : C ⥤ D) (G : D ⥤ E)
342328 [PreservesFiniteCoproducts (F ⋙ G)] [ReflectsFiniteCoproducts G] :
343329 PreservesFiniteCoproducts F where
344- preserves _ _ := preservesColimitsOfShape_of_reflects_of_preserves F G
330+ preserves _ := preservesColimitsOfShape_of_reflects_of_preserves F G
345331
346332instance reflectsFiniteColimitsOfReflectsIsomorphisms (F : C ⥤ D)
347333 [F.ReflectsIsomorphisms] [HasFiniteColimits C] [PreservesFiniteColimits F] :
@@ -351,14 +337,14 @@ instance reflectsFiniteColimitsOfReflectsIsomorphisms (F : C ⥤ D)
351337instance reflectsFiniteCoproductsOfReflectsIsomorphisms (F : C ⥤ D)
352338 [F.ReflectsIsomorphisms] [HasFiniteCoproducts C] [PreservesFiniteCoproducts F] :
353339 ReflectsFiniteCoproducts F where
354- reflects _ _ := reflectsColimitsOfShape_of_reflectsIsomorphisms
340+ reflects _ := reflectsColimitsOfShape_of_reflectsIsomorphisms
355341
356342instance comp_reflectsFiniteCoproducts (F : C ⥤ D) (G : D ⥤ E)
357343 [ReflectsFiniteCoproducts F] [ReflectsFiniteCoproducts G] :
358344 ReflectsFiniteCoproducts (F ⋙ G) where
359- reflects _ _ := inferInstance
345+ reflects _ := inferInstance
360346
361347instance (F : C ⥤ D) [ReflectsFiniteColimits F] : ReflectsFiniteCoproducts F where
362- reflects _ _ := inferInstance
348+ reflects _ := inferInstance
363349
364350end CategoryTheory.Limits
0 commit comments