Skip to content

Commit d5cab0e

Browse files
committed
refactor(CategoryTheory/Generator): use ObjectProperty instead of Set (#30269)
In certain applications (see #30247), it becomes unpractical to have certains notions like `IsSeparating` defined for `Set C`, while the API for the relatively new `ObjectProperty` is expanding. In this PR, we move the definition of `IsSeparating` to the `ObjectProperty` namespace.
1 parent 4b88792 commit d5cab0e

File tree

12 files changed

+447
-305
lines changed

12 files changed

+447
-305
lines changed

Mathlib/Algebra/Category/ModuleCat/AB.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ instance : AB4Star (ModuleCat.{u} R) where
3636

3737
lemma ModuleCat.isSeparator [Small.{v} R] : IsSeparator (ModuleCat.of.{v} R (Shrink.{v} R)) :=
3838
fun X Y f g h ↦ by
39-
simp only [Set.mem_singleton_iff, forall_eq, ModuleCat.hom_ext_iff, LinearMap.ext_iff] at h
39+
simp only [ObjectProperty.singleton_iff, ModuleCat.hom_ext_iff, hom_comp,
40+
LinearMap.ext_iff, LinearMap.coe_comp, Function.comp_apply, forall_eq'] at h
4041
ext x
41-
simpa [Shrink.linearEquiv, Equiv.linearEquiv] using
42-
h (ModuleCat.ofHom ((LinearMap.toSpanSingleton R X x).comp
43-
(Shrink.linearEquiv R R : Shrink R →ₗ[R] R))) 1
42+
simpa using h (ModuleCat.ofHom ((LinearMap.toSpanSingleton R X x).comp
43+
(Shrink.linearEquiv R R : Shrink R →ₗ[R] R))) 1
4444

4545
instance [Small.{v} R] : HasSeparator (ModuleCat.{v} R) where
4646
hasSeparator := ⟨ModuleCat.of R (Shrink.{v} R), ModuleCat.isSeparator R⟩

Mathlib/Algebra/Category/ModuleCat/Presheaf/Generator.lean

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,24 +69,23 @@ lemma freeYonedaEquiv_comp {M N : PresheafOfModules.{v} R} {X : C}
6969
variable (R) in
7070
/-- The set of `PresheafOfModules.{v} R` consisting of objects of the
7171
form `(free R).obj (yoneda.obj X)` for some `X`. -/
72-
def freeYoneda : Set (PresheafOfModules.{v} R) := Set.range (yoneda ⋙ free R).obj
72+
def freeYoneda : ObjectProperty (PresheafOfModules.{v} R) := .ofObj (yoneda ⋙ free R).obj
7373

7474
namespace freeYoneda
7575

76-
instance : Small.{u} (freeYoneda R) := by
77-
let π : C → freeYoneda R := fun X ↦ ⟨_, ⟨X, rfl⟩⟩
78-
have hπ : Function.Surjective π := by rintro ⟨_, ⟨X, rfl⟩⟩; exact ⟨X, rfl⟩
79-
exact small_of_surjective hπ
76+
instance : ObjectProperty.Small.{u} (freeYoneda R) := by
77+
dsimp [freeYoneda]
78+
infer_instance
8079

8180
variable (R)
8281

83-
lemma isSeparating : IsSeparating (freeYoneda R) := by
82+
lemma isSeparating : ObjectProperty.IsSeparating (freeYoneda R) := by
8483
intro M N f₁ f₂ h
8584
ext ⟨X⟩ m
8685
obtain ⟨g, rfl⟩ := freeYonedaEquiv.surjective m
87-
exact congr_arg freeYonedaEquiv (h _ ⟨X, rfl⟩ g)
86+
exact congr_arg freeYonedaEquiv (h _ ⟨X⟩ g)
8887

89-
lemma isDetecting : IsDetecting (freeYoneda R) :=
88+
lemma isDetecting : ObjectProperty.IsDetecting (freeYoneda R) :=
9089
(isSeparating R).isDetecting
9190

9291
end freeYoneda

Mathlib/CategoryTheory/Abelian/GrothendieckCategory/EnoughInjectives.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ lemma exists_pushouts
111111
∃ (X' : C) (i : X ⟶ X') (p' : X' ⟶ Y) (_ : (generatingMonomorphisms G).pushouts i)
112112
(_ : ¬ IsIso i) (_ : Mono p'), i ≫ p' = p := by
113113
rw [hG.isDetector.isIso_iff_of_mono] at hp
114-
simp only [coyoneda_obj_obj, coyoneda_obj_map, Set.mem_singleton_iff, forall_eq,
115-
Function.Surjective, not_forall, not_exists] at hp
114+
simp only [ObjectProperty.singleton_iff, Function.Surjective, coyoneda_obj_obj,
115+
coyoneda_obj_map, forall_eq', not_forall, not_exists] at hp
116116
-- `f : G ⟶ Y` is a monomorphism the image of which is not contained in `X`
117117
obtain ⟨f, hf⟩ := hp
118118
-- we use the subobject `X'` of `Y` that is generated by the images of `p : X ⟶ Y`

Mathlib/CategoryTheory/Abelian/GrothendieckCategory/ModuleEmbedding/GabrielPopescu.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ namespace CategoryTheory.IsGrothendieckAbelian
4040
variable {C : Type u} [Category.{v} C] [Abelian C] [IsGrothendieckAbelian.{v} C]
4141

4242
instance {G : C} : (preadditiveCoyonedaObj G).IsRightAdjoint :=
43-
isRightAdjoint_of_preservesLimits_of_isCoseparating (isCoseparator_coseparator _) _
43+
isRightAdjoint_of_preservesLimits_of_isCoseparating.{v} (isCoseparator_coseparator _) _
4444

4545
/-- The left adjoint of the functor `Hom(G, ·)`, which can be thought of as `· ⊗ G`. -/
4646
noncomputable def tensorObj (G : C) : ModuleCat (End G)ᵐᵒᵖ ⥤ C :=

Mathlib/CategoryTheory/Adjunction/AdjointFunctorTheorems.lean

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -101,20 +101,22 @@ variable {D : Type u'} [Category.{v} D]
101101
well-powered and has a small coseparating set, then `G` has a left adjoint.
102102
-/
103103
lemma isRightAdjoint_of_preservesLimits_of_isCoseparating [HasLimits D] [WellPowered.{v} D]
104-
{𝒢 : Set D} [Small.{v} 𝒢] (h𝒢 : IsCoseparating 𝒢) (G : D ⥤ C) [PreservesLimits G] :
105-
G.IsRightAdjoint :=
106-
have : ∀ A, HasInitial (StructuredArrow A G) := fun A =>
107-
hasInitial_of_isCoseparating (StructuredArrow.isCoseparating_proj_preimage A G h𝒢)
108-
isRightAdjointOfStructuredArrowInitials _
104+
{P : ObjectProperty D} [ObjectProperty.Small.{v} P]
105+
(hP : P.IsCoseparating) (G : D ⥤ C) [PreservesLimits G] :
106+
G.IsRightAdjoint := by
107+
have : ∀ A, HasInitial (StructuredArrow A G) := fun A ↦
108+
hasInitial_of_isCoseparating (StructuredArrow.isCoseparating_inverseImage_proj A G hP)
109+
exact isRightAdjointOfStructuredArrowInitials _
109110

110111
/-- The special adjoint functor theorem: if `F : C ⥤ D` preserves colimits and `C` is cocomplete,
111112
well-copowered and has a small separating set, then `F` has a right adjoint.
112113
-/
113114
lemma isLeftAdjoint_of_preservesColimits_of_isSeparating [HasColimits C] [WellPowered.{v} Cᵒᵖ]
114-
{𝒢 : Set C} [Small.{v} 𝒢] (h𝒢 : IsSeparating 𝒢) (F : C ⥤ D) [PreservesColimits F] :
115+
{P : ObjectProperty C} [ObjectProperty.Small.{v} P]
116+
(h𝒢 : P.IsSeparating) (F : C ⥤ D) [PreservesColimits F] :
115117
F.IsLeftAdjoint :=
116118
have : ∀ A, HasTerminal (CostructuredArrow F A) := fun A =>
117-
hasTerminal_of_isSeparating (CostructuredArrow.isSeparating_proj_preimage F A h𝒢)
119+
hasTerminal_of_isSeparating (CostructuredArrow.isSeparating_inverseImage_proj F A h𝒢)
118120
isLeftAdjoint_of_costructuredArrowTerminals _
119121

120122
end SpecialAdjointFunctorTheorem
@@ -123,19 +125,19 @@ namespace Limits
123125

124126
/-- A consequence of the special adjoint functor theorem: if `C` is complete, well-powered and
125127
has a small coseparating set, then it is cocomplete. -/
126-
theorem hasColimits_of_hasLimits_of_isCoseparating [HasLimits C] [WellPowered.{v} C] {𝒢 : Set C}
127-
[Small.{v} 𝒢] (h𝒢 : IsCoseparating 𝒢) : HasColimits C :=
128+
theorem hasColimits_of_hasLimits_of_isCoseparating [HasLimits C] [WellPowered.{v} C]
129+
{P : ObjectProperty C} [ObjectProperty.Small.{v} P] (hP : P.IsCoseparating) : HasColimits C :=
128130
{ has_colimits_of_shape := fun _ _ =>
129131
hasColimitsOfShape_iff_isRightAdjoint_const.2
130-
(isRightAdjoint_of_preservesLimits_of_isCoseparating h𝒢 _) }
132+
(isRightAdjoint_of_preservesLimits_of_isCoseparating hP _) }
131133

132134
/-- A consequence of the special adjoint functor theorem: if `C` is cocomplete, well-copowered and
133135
has a small separating set, then it is complete. -/
134-
theorem hasLimits_of_hasColimits_of_isSeparating [HasColimits C] [WellPowered.{v} Cᵒᵖ] {𝒢 : Set C}
135-
[Small.{v} 𝒢] (h𝒢 : IsSeparating 𝒢) : HasLimits C :=
136+
theorem hasLimits_of_hasColimits_of_isSeparating [HasColimits C] [WellPowered.{v} Cᵒᵖ]
137+
{P : ObjectProperty C} [ObjectProperty.Small.{v} P] (hP : P.IsSeparating) : HasLimits C :=
136138
{ has_limits_of_shape := fun _ _ =>
137139
hasLimitsOfShape_iff_isLeftAdjoint_const.2
138-
(isLeftAdjoint_of_preservesColimits_of_isSeparating h𝒢 _) }
140+
(isLeftAdjoint_of_preservesColimits_of_isSeparating hP _) }
139141

140142
/-- A consequence of the special adjoint functor theorem: if `C` is complete, well-powered and
141143
has a separator, then it is complete. -/

Mathlib/CategoryTheory/Comma/StructuredArrow/Small.lean

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Authors: Markus Himmel
55
-/
66
import Mathlib.CategoryTheory.Comma.StructuredArrow.Basic
77
import Mathlib.CategoryTheory.EssentiallySmall
8-
import Mathlib.Logic.Small.Set
8+
import Mathlib.CategoryTheory.ObjectProperty.Small
99

1010
/-!
1111
# Small sets in the category of structured arrows
@@ -25,26 +25,39 @@ namespace StructuredArrow
2525

2626
variable {S : D} {T : C ⥤ D}
2727

28-
instance small_proj_preimage_of_locallySmall {𝒢 : Set C} [Small.{v₁} 𝒢] [LocallySmall.{v₁} D] :
29-
Small.{v₁} ((proj S T).obj ⁻¹' 𝒢) := by
30-
suffices (proj S T).obj ⁻¹' 𝒢 = Set.range fun f : Σ G : 𝒢, S ⟶ T.obj G => mk f.2 by
28+
instance small_inverseImage_proj_of_locallySmall
29+
{P : ObjectProperty C} [ObjectProperty.Small.{v₁} P] [LocallySmall.{v₁} D] :
30+
ObjectProperty.Small.{v₁} (P.inverseImage (proj S T)) := by
31+
suffices P.inverseImage (proj S T) = .ofObj fun f : Σ (G : Subtype P), S ⟶ T.obj G => mk f.2 by
3132
rw [this]
3233
infer_instance
33-
exact Set.ext fun X => ⟨fun h => ⟨⟨⟨_, h⟩, X.hom⟩, (eq_mk _).symm⟩, by cat_disch⟩
34+
ext X
35+
simp only [ObjectProperty.prop_inverseImage_iff, proj_obj, ObjectProperty.ofObj_iff,
36+
Sigma.exists, Subtype.exists, exists_prop]
37+
exact ⟨fun h ↦ ⟨_, h, _, rfl⟩, by rintro ⟨_, h, _, rfl⟩; exact h⟩
38+
39+
@[deprecated (since := "2025-10-07")] alias small_proj_preimage_of_locallySmall :=
40+
small_inverseImage_proj_of_locallySmall
3441

3542
end StructuredArrow
3643

3744
namespace CostructuredArrow
3845

3946
variable {S : C ⥤ D} {T : D}
4047

41-
instance small_proj_preimage_of_locallySmall {𝒢 : Set C} [Small.{v₁} 𝒢] [LocallySmall.{v₁} D] :
42-
Small.{v₁} ((proj S T).obj ⁻¹' 𝒢) := by
43-
suffices (proj S T).obj ⁻¹' 𝒢 = Set.range fun f : Σ G : 𝒢, S.obj G ⟶ T => mk f.2 by
48+
instance small_inverseImage_proj_of_locallySmall
49+
{P : ObjectProperty C} [ObjectProperty.Small.{v₁} P] [LocallySmall.{v₁} D] :
50+
ObjectProperty.Small.{v₁} (P.inverseImage (proj S T)) := by
51+
suffices P.inverseImage (proj S T) = .ofObj fun f : Σ (G : Subtype P), S.obj G ⟶ T => mk f.2 by
4452
rw [this]
4553
infer_instance
46-
exact Set.ext fun X => ⟨fun h => ⟨⟨⟨_, h⟩, X.hom⟩, (eq_mk _).symm⟩, by cat_disch⟩
54+
ext X
55+
simp only [ObjectProperty.prop_inverseImage_iff, proj_obj, ObjectProperty.ofObj_iff,
56+
Sigma.exists, Subtype.exists, exists_prop]
57+
exact ⟨fun h ↦ ⟨_, h, _, rfl⟩, by rintro ⟨_, h, _, rfl⟩; exact h⟩
4758

59+
@[deprecated (since := "2025-10-07")] alias small_proj_preimage_of_locallySmall :=
60+
small_inverseImage_proj_of_locallySmall
4861
end CostructuredArrow
4962

5063
end CategoryTheory

0 commit comments

Comments
 (0)