Skip to content

Commit aec008a

Browse files
kim-emclaude
andcommitted
add @[univ_out_params] where universe params are not determined by inputs
Classes like `Category.{v}`, `HasLimitsOfSize.{v₁,u₁}`, `Functor.IsContinuous.{t}`, and `UCompactlyGeneratedSpace.{u}` have universe parameters that do not appear in their input parameter types. With the new TC resolution cache (lean4#12286), these default to output parameters, causing cache collisions when the same class is queried at different universe levels. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 8edfc65 commit aec008a

File tree

9 files changed

+18
-16
lines changed

9 files changed

+18
-16
lines changed

Mathlib/CategoryTheory/Category/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ set_option mathlib.tactic.category.grind true
191191
/-- The typeclass `Category C` describes morphisms associated to objects of type `C`.
192192
The universe levels of the objects and morphisms are unconstrained, and will often need to be
193193
specified explicitly, as `Category.{v} C`. (See also `LargeCategory` and `SmallCategory`.) -/
194-
@[pp_with_univ, stacks 0014]
194+
@[univ_out_params, pp_with_univ, stacks 0014]
195195
class Category (obj : Type u) : Type max u (v + 1) extends CategoryStruct.{v} obj where
196196
/-- Identity morphisms are left identities for composition. -/
197197
id_comp : ∀ {X Y : obj} (f : X ⟶ Y), 𝟙 X ≫ f = f := by cat_disch

Mathlib/CategoryTheory/Enriched/Limits/HasConicalLimits.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ attribute [instance] HasConicalLimitsOfShape.hasConicalLimit
7272
`C` has all conical limits of size `v₁ u₁` (`HasLimitsOfSize.{v₁ u₁} C`)
7373
if it has conical limits of every shape `J : Type u₁` with `[Category.{v₁} J]`.
7474
-/
75-
@[pp_with_univ]
75+
@[univ_out_params, pp_with_univ]
7676
class HasConicalLimitsOfSize : Prop where
7777
/-- All functors `F : J ⥤ C` from all small `J` have conical limits -/
7878
hasConicalLimitsOfShape : ∀ (J : Type u₁) [Category.{v₁} J], HasConicalLimitsOfShape J V C := by

Mathlib/CategoryTheory/Limits/Creates.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class CreatesLimitsOfShape (J : Type w) [Category.{w'} J] (F : C ⥤ D) where
8282

8383
-- This should be used with explicit universe variables.
8484
/-- `F` creates limits if it creates limits of shape `J` for any `J`. -/
85-
@[nolint checkUnivs, pp_with_univ]
85+
@[univ_out_params, nolint checkUnivs, pp_with_univ]
8686
class CreatesLimitsOfSize (F : C ⥤ D) where
8787
CreatesLimitsOfShape : ∀ {J : Type w} [Category.{w'} J], CreatesLimitsOfShape J F := by
8888
infer_instance
@@ -111,7 +111,7 @@ class CreatesColimitsOfShape (J : Type w) [Category.{w'} J] (F : C ⥤ D) where
111111

112112
-- This should be used with explicit universe variables.
113113
/-- `F` creates colimits if it creates colimits of shape `J` for any small `J`. -/
114-
@[nolint checkUnivs, pp_with_univ]
114+
@[univ_out_params, nolint checkUnivs, pp_with_univ]
115115
class CreatesColimitsOfSize (F : C ⥤ D) where
116116
CreatesColimitsOfShape : ∀ {J : Type w} [Category.{w'} J], CreatesColimitsOfShape J F := by
117117
infer_instance

Mathlib/CategoryTheory/Limits/Filtered.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,13 @@ section
7070
variable (C)
7171

7272
/-- Class for having all cofiltered limits of a given size. -/
73-
@[pp_with_univ]
73+
@[univ_out_params, pp_with_univ]
7474
class HasCofilteredLimitsOfSize : Prop where
7575
/-- For all filtered types of size `w`, we have limits -/
7676
HasLimitsOfShape : ∀ (I : Type w) [Category.{w'} I] [IsCofiltered I], HasLimitsOfShape I C
7777

7878
/-- Class for having all filtered colimits of a given size. -/
79-
@[pp_with_univ]
79+
@[univ_out_params, pp_with_univ]
8080
class HasFilteredColimitsOfSize : Prop where
8181
/-- For all filtered types of a size `w`, we have colimits -/
8282
HasColimitsOfShape : ∀ (I : Type w) [Category.{w'} I] [IsFiltered I], HasColimitsOfShape I C

Mathlib/CategoryTheory/Limits/HasLimits.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class HasLimitsOfShape : Prop where
104104
/-- `C` has all limits of size `v₁ u₁` (`HasLimitsOfSize.{v₁ u₁} C`)
105105
if it has limits of every shape `J : Type u₁` with `[Category.{v₁} J]`.
106106
-/
107-
@[pp_with_univ]
107+
@[univ_out_params, pp_with_univ]
108108
class HasLimitsOfSize (C : Type u) [Category.{v} C] : Prop where
109109
/-- All functors `F : J ⥤ C` from all small `J` have limits -/
110110
has_limits_of_shape : ∀ (J : Type u₁) [Category.{v₁} J], HasLimitsOfShape J C := by
@@ -626,7 +626,7 @@ class HasColimitsOfShape : Prop where
626626
/-- `C` has all colimits of size `v₁ u₁` (`HasColimitsOfSize.{v₁ u₁} C`)
627627
if it has colimits of every shape `J : Type u₁` with `[Category.{v₁} J]`.
628628
-/
629-
@[pp_with_univ]
629+
@[univ_out_params, pp_with_univ]
630630
class HasColimitsOfSize (C : Type u) [Category.{v} C] : Prop where
631631
/-- All `F : J ⥤ C` have colimits for all small `J` -/
632632
has_colimits_of_shape : ∀ (J : Type u₁) [Category.{v₁} J], HasColimitsOfShape J C := by

Mathlib/CategoryTheory/Limits/Preserves/Basic.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class PreservesColimitsOfShape (J : Type w) [Category.{w'} J] (F : C ⥤ D) : Pr
7575
-- This should be used with explicit universe variables.
7676
/-- `PreservesLimitsOfSize.{v u} F` means that `F` sends all limit cones over any
7777
diagram `J ⥤ C` to limit cones, where `J : Type u` with `[Category.{v} J]`. -/
78-
@[nolint checkUnivs, pp_with_univ]
78+
@[univ_out_params, nolint checkUnivs, pp_with_univ]
7979
class PreservesLimitsOfSize (F : C ⥤ D) : Prop where
8080
preservesLimitsOfShape : ∀ {J : Type w} [Category.{w'} J], PreservesLimitsOfShape J F := by
8181
infer_instance
@@ -88,7 +88,7 @@ abbrev PreservesLimits (F : C ⥤ D) :=
8888
-- This should be used with explicit universe variables.
8989
/-- `PreservesColimitsOfSize.{v u} F` means that `F` sends all colimit cocones over any
9090
diagram `J ⥤ C` to colimit cocones, where `J : Type u` with `[Category.{v} J]`. -/
91-
@[nolint checkUnivs, pp_with_univ]
91+
@[univ_out_params, nolint checkUnivs, pp_with_univ]
9292
class PreservesColimitsOfSize (F : C ⥤ D) : Prop where
9393
preservesColimitsOfShape : ∀ {J : Type w} [Category.{w'} J], PreservesColimitsOfShape J F := by
9494
infer_instance
@@ -355,7 +355,7 @@ whenever the image of a cone over some `K : J ⥤ C` under `F` is a limit cone i
355355
the cone was already a limit cone in `C`.
356356
Note that we do not assume a priori that `D` actually has any limits.
357357
-/
358-
@[nolint checkUnivs, pp_with_univ]
358+
@[univ_out_params, nolint checkUnivs, pp_with_univ]
359359
class ReflectsLimitsOfSize (F : C ⥤ D) : Prop where
360360
reflectsLimitsOfShape : ∀ {J : Type w} [Category.{w'} J], ReflectsLimitsOfShape J F := by
361361
infer_instance
@@ -374,7 +374,7 @@ whenever the image of a cocone over some `K : J ⥤ C` under `F` is a colimit co
374374
the cocone was already a colimit cocone in `C`.
375375
Note that we do not assume a priori that `D` actually has any colimits.
376376
-/
377-
@[nolint checkUnivs, pp_with_univ]
377+
@[univ_out_params, nolint checkUnivs, pp_with_univ]
378378
class ReflectsColimitsOfSize (F : C ⥤ D) : Prop where
379379
reflectsColimitsOfShape : ∀ {J : Type w} [Category.{w'} J], ReflectsColimitsOfShape J F := by
380380
infer_instance

Mathlib/CategoryTheory/Limits/Preserves/Filtered.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ section Preserves
4343
-- This should be used with explicit universe variables.
4444
/-- `PreservesFilteredColimitsOfSize.{w', w} F` means that `F` sends all colimit cocones over any
4545
filtered diagram `J ⥤ C` to colimit cocones, where `J : Type w` with `[Category.{w'} J]`. -/
46-
@[nolint checkUnivs, pp_with_univ]
46+
@[univ_out_params, nolint checkUnivs, pp_with_univ]
4747
class PreservesFilteredColimitsOfSize (F : C ⥤ D) : Prop where
4848
preserves_filtered_colimits :
4949
∀ (J : Type w) [Category.{w'} J] [IsFiltered J], PreservesColimitsOfShape J F
@@ -99,7 +99,7 @@ section Reflects
9999
-- This should be used with explicit universe variables.
100100
/-- `ReflectsFilteredColimitsOfSize.{w', w} F` means that whenever the image of a filtered cocone
101101
under `F` is a colimit cocone, the original cocone was already a colimit. -/
102-
@[nolint checkUnivs, pp_with_univ]
102+
@[univ_out_params, nolint checkUnivs, pp_with_univ]
103103
class ReflectsFilteredColimitsOfSize (F : C ⥤ D) : Prop where
104104
reflects_filtered_colimits :
105105
∀ (J : Type w) [Category.{w'} J] [IsFiltered J], ReflectsColimitsOfShape J F
@@ -159,7 +159,7 @@ section Preserves
159159
-- This should be used with explicit universe variables.
160160
/-- `PreservesCofilteredLimitsOfSize.{w', w} F` means that `F` sends all limit cones over any
161161
cofiltered diagram `J ⥤ C` to limit cones, where `J : Type w` with `[Category.{w'} J]`. -/
162-
@[nolint checkUnivs, pp_with_univ]
162+
@[univ_out_params, nolint checkUnivs, pp_with_univ]
163163
class PreservesCofilteredLimitsOfSize (F : C ⥤ D) : Prop where
164164
preserves_cofiltered_limits :
165165
∀ (J : Type w) [Category.{w'} J] [IsCofiltered J], PreservesLimitsOfShape J F
@@ -215,7 +215,7 @@ section Reflects
215215
-- This should be used with explicit universe variables.
216216
/-- `ReflectsCofilteredLimitsOfSize.{w', w} F` means that whenever the image of a cofiltered cone
217217
under `F` is a limit cone, the original cone was already a limit. -/
218-
@[nolint checkUnivs, pp_with_univ]
218+
@[univ_out_params, nolint checkUnivs, pp_with_univ]
219219
class ReflectsCofilteredLimitsOfSize (F : C ⥤ D) : Prop where
220220
reflects_cofiltered_limits :
221221
∀ (J : Type w) [Category.{w'} J] [IsCofiltered J], ReflectsLimitsOfShape J F

Mathlib/CategoryTheory/Sites/Continuous.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ abbrev PreservesOneHypercovers :=
120120

121121
/-- A functor `F` is continuous if the precomposition with `F.op` sends sheaves of `Type t`
122122
to sheaves. -/
123+
@[univ_out_params]
123124
class IsContinuous : Prop where
124125
op_comp_isSheaf_of_types (G : Sheaf K (Type t)) : Presieve.IsSheaf J (F.op ⋙ G.val)
125126

Mathlib/Topology/Compactness/CompactlyGeneratedSpace.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ This version includes an explicit universe parameter `u` which should always be
8080
intended for categorical purposes. See `CompactlyGeneratedSpace` for the version without this
8181
parameter, intended for topological purposes.
8282
-/
83+
@[univ_out_params]
8384
class UCompactlyGeneratedSpace (X : Type v) [t : TopologicalSpace X] : Prop where
8485
/-- The topology of `X` is finer than the compactly generated topology. -/
8586
le_compactlyGenerated : t ≤ compactlyGenerated.{u} X

0 commit comments

Comments
 (0)