Skip to content

Commit f598df3

Browse files
committed
refactor(CategoryTheory): introduce ObjectProperty (#22286)
An abbreviation `ObjectProperty C` for predicates on objects of a category `C` is introduced in the file `CategoryTheory.ObjectProperty.Basic`. The file `CategoryTheory.ClosedUnderIsomorphisms` is moved to `ObjectProperty.ClosedUnderIsomorphisms`. Co-authored-by: Joël Riou <37772949+joelriou@users.noreply.github.com>
1 parent d6d30b2 commit f598df3

File tree

13 files changed

+272
-199
lines changed

13 files changed

+272
-199
lines changed

Mathlib.lean

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1821,7 +1821,6 @@ import Mathlib.CategoryTheory.Closed.Ideal
18211821
import Mathlib.CategoryTheory.Closed.Monoidal
18221822
import Mathlib.CategoryTheory.Closed.Types
18231823
import Mathlib.CategoryTheory.Closed.Zero
1824-
import Mathlib.CategoryTheory.ClosedUnderIsomorphisms
18251824
import Mathlib.CategoryTheory.CodiscreteCategory
18261825
import Mathlib.CategoryTheory.CofilteredSystem
18271826
import Mathlib.CategoryTheory.CommSq
@@ -2219,6 +2218,9 @@ import Mathlib.CategoryTheory.MorphismProperty.TransfiniteComposition
22192218
import Mathlib.CategoryTheory.NatIso
22202219
import Mathlib.CategoryTheory.NatTrans
22212220
import Mathlib.CategoryTheory.Noetherian
2221+
import Mathlib.CategoryTheory.ObjectProperty.Basic
2222+
import Mathlib.CategoryTheory.ObjectProperty.ClosedUnderIsomorphisms
2223+
import Mathlib.CategoryTheory.ObjectProperty.Shift
22222224
import Mathlib.CategoryTheory.Opposites
22232225
import Mathlib.CategoryTheory.PEmpty
22242226
import Mathlib.CategoryTheory.PUnit
@@ -2268,7 +2270,6 @@ import Mathlib.CategoryTheory.Shift.Induced
22682270
import Mathlib.CategoryTheory.Shift.InducedShiftSequence
22692271
import Mathlib.CategoryTheory.Shift.Localization
22702272
import Mathlib.CategoryTheory.Shift.Opposite
2271-
import Mathlib.CategoryTheory.Shift.Predicate
22722273
import Mathlib.CategoryTheory.Shift.Pullback
22732274
import Mathlib.CategoryTheory.Shift.Quotient
22742275
import Mathlib.CategoryTheory.Shift.ShiftSequence

Mathlib/Algebra/Homology/DerivedCategory/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ of acyclic complexes. -/
7575
def subcategoryAcyclic : Triangulated.Subcategory (HomotopyCategory C (ComplexShape.up ℤ)) :=
7676
(homologyFunctor C (ComplexShape.up ℤ) 0).homologicalKernel
7777

78-
instance : ClosedUnderIsomorphisms (subcategoryAcyclic C).P := by
78+
instance : (subcategoryAcyclic C).P.IsClosedUnderIsomorphisms := by
7979
dsimp [subcategoryAcyclic]
8080
infer_instance
8181

Mathlib/CategoryTheory/ClosedUnderIsomorphisms.lean

Lines changed: 0 additions & 70 deletions
This file was deleted.

Mathlib/CategoryTheory/Limits/FullSubcategory.lean

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Markus Himmel
55
-/
66
import Mathlib.CategoryTheory.Limits.Creates
7-
import Mathlib.CategoryTheory.ClosedUnderIsomorphisms
7+
import Mathlib.CategoryTheory.ObjectProperty.ClosedUnderIsomorphisms
88

99
/-!
1010
# Limits in full subcategories
@@ -27,32 +27,32 @@ namespace CategoryTheory.Limits
2727
/-- We say that a property is closed under limits of shape `J` if whenever all objects in a
2828
`J`-shaped diagram have the property, any limit of this diagram also has the property. -/
2929
def ClosedUnderLimitsOfShape {C : Type u} [Category.{v} C] (J : Type w) [Category.{w'} J]
30-
(P : C → Prop) : Prop :=
30+
(P : ObjectProperty C) : Prop :=
3131
∀ ⦃F : J ⥤ C⦄ ⦃c : Cone F⦄ (_hc : IsLimit c), (∀ j, P (F.obj j)) → P c.pt
3232

3333
/-- We say that a property is closed under colimits of shape `J` if whenever all objects in a
3434
`J`-shaped diagram have the property, any colimit of this diagram also has the property. -/
3535
def ClosedUnderColimitsOfShape {C : Type u} [Category.{v} C] (J : Type w) [Category.{w'} J]
36-
(P : C → Prop) : Prop :=
36+
(P : ObjectProperty C) : Prop :=
3737
∀ ⦃F : J ⥤ C⦄ ⦃c : Cocone F⦄ (_hc : IsColimit c), (∀ j, P (F.obj j)) → P c.pt
3838

3939
section
4040

41-
variable {C : Type u} [Category.{v} C] {J : Type w} [Category.{w'} J] {P : C → Prop}
41+
variable {C : Type u} [Category.{v} C] {J : Type w} [Category.{w'} J] {P : ObjectProperty C}
4242

43-
theorem closedUnderLimitsOfShape_of_limit [ClosedUnderIsomorphisms P]
43+
theorem closedUnderLimitsOfShape_of_limit [P.IsClosedUnderIsomorphisms]
4444
(h : ∀ {F : J ⥤ C} [HasLimit F], (∀ j, P (F.obj j)) → P (limit F)) :
4545
ClosedUnderLimitsOfShape J P := by
4646
intros F c hc hF
4747
have : HasLimit F := ⟨_, hc⟩
48-
exact mem_of_iso P ((limit.isLimit _).conePointUniqueUpToIso hc) (h hF)
48+
exact P.prop_of_iso ((limit.isLimit _).conePointUniqueUpToIso hc) (h hF)
4949

50-
theorem closedUnderColimitsOfShape_of_colimit [ClosedUnderIsomorphisms P]
50+
theorem closedUnderColimitsOfShape_of_colimit [P.IsClosedUnderIsomorphisms]
5151
(h : ∀ {F : J ⥤ C} [HasColimit F], (∀ j, P (F.obj j)) → P (colimit F)) :
5252
ClosedUnderColimitsOfShape J P := by
5353
intros F c hc hF
5454
have : HasColimit F := ⟨_, hc⟩
55-
exact mem_of_iso P ((colimit.isColimit _).coconePointUniqueUpToIso hc) (h hF)
55+
exact P.prop_of_iso ((colimit.isColimit _).coconePointUniqueUpToIso hc) (h hF)
5656

5757
theorem ClosedUnderLimitsOfShape.limit (h : ClosedUnderLimitsOfShape J P) {F : J ⥤ C} [HasLimit F] :
5858
(∀ j, P (F.obj j)) → P (limit F) :=

Mathlib/CategoryTheory/Limits/Indization/IndObject.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Authors: Markus Himmel
66
import Mathlib.CategoryTheory.Limits.FinallySmall
77
import Mathlib.CategoryTheory.Limits.Presheaf
88
import Mathlib.CategoryTheory.Filtered.Small
9-
import Mathlib.CategoryTheory.ClosedUnderIsomorphisms
9+
import Mathlib.CategoryTheory.ObjectProperty.ClosedUnderIsomorphisms
1010
import Mathlib.CategoryTheory.Limits.Preserves.Finite
1111
import Mathlib.CategoryTheory.Limits.Preserves.Presheaf
1212

@@ -141,7 +141,7 @@ theorem map {A B : Cᵒᵖ ⥤ Type v} (η : A ⟶ B) [IsIso η] : IsIndObject A
141141
theorem iff_of_iso {A B : Cᵒᵖ ⥤ Type v} (η : A ⟶ B) [IsIso η] : IsIndObject A ↔ IsIndObject B :=
142142
⟨.map η, .map (inv η)⟩
143143

144-
instance : ClosedUnderIsomorphisms (IsIndObject (C := C)) where
144+
instance : ObjectProperty.IsClosedUnderIsomorphisms (IsIndObject (C := C)) where
145145
of_iso i h := h.map i.hom
146146

147147
/-- Pick a presentation for an ind-object using choice. -/

Mathlib/CategoryTheory/Localization/Bousfield.lean

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ Copyright (c) 2024 Joël Riou. All rights reserved.
33
Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Joël Riou
55
-/
6-
import Mathlib.CategoryTheory.ClosedUnderIsomorphisms
6+
import Mathlib.CategoryTheory.ObjectProperty.ClosedUnderIsomorphisms
77
import Mathlib.CategoryTheory.MorphismProperty.Composition
88
import Mathlib.CategoryTheory.Localization.Adjunction
99

1010
/-!
1111
# Bousfield localization
1212
13-
Given a predicate `P : C → Prop` on the objects of a category `C`,
13+
Given a predicate `P : ObjectProperty C` on the objects of a category `C`,
1414
we define `Localization.LeftBousfield.W P : MorphismProperty C`
1515
as the class of morphisms `f : X ⟶ Y` such that for any `Z : C`
1616
such that `P Z`, the precomposition with `f` induces a bijection
@@ -42,9 +42,9 @@ namespace LeftBousfield
4242

4343
section
4444

45-
variable (P : C → Prop)
45+
variable (P : ObjectProperty C)
4646

47-
/-- Given a predicate `P : C → Prop`, this is the class of morphisms `f : X ⟶ Y`
47+
/-- Given `P : ObjectProperty C`, this is the class of morphisms `f : X ⟶ Y`
4848
such that for all `Z : C` such that `P Z`, the precomposition with `f` induces
4949
a bijection `(Y ⟶ Z) ≃ (X ⟶ Z)`. -/
5050
def W : MorphismProperty C := fun _ _ f =>
@@ -58,11 +58,11 @@ noncomputable def W.homEquiv {X Y : C} {f : X ⟶ Y} (hf : W P f) (Z : C) (hZ :
5858
(Y ⟶ Z) ≃ (X ⟶ Z) :=
5959
Equiv.ofBijective _ (hf Z hZ)
6060

61-
lemma W_isoClosure : W (isoClosure P) = W P := by
61+
lemma W_isoClosure : W P.isoClosure = W P := by
6262
ext X Y f
6363
constructor
6464
· intro hf Z hZ
65-
exact hf _ (le_isoClosure _ _ hZ)
65+
exact hf _ (P.le_isoClosure _ hZ)
6666
· rintro hf Z ⟨Z', hZ', ⟨e⟩⟩
6767
constructor
6868
· intro g₁ g₂ eq
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/-
2+
Copyright (c) 2025 Joël Riou. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Joël Riou
5+
-/
6+
import Mathlib.CategoryTheory.Category.Basic
7+
8+
/-!
9+
# Properties of objects in a category
10+
11+
Given a category `C`, we introduce an abbreviation `ObjectProperty C`
12+
for predicates `C → Prop`.
13+
14+
## TODO
15+
16+
* refactor the file `Limits.FullSubcategory` in order to rename `ClosedUnderLimitsOfShape`
17+
as `ObjectProperty.IsClosedUnderLimitsOfShape` (and make it a type class)
18+
* refactor the file `Triangulated.Subcategory` in order to make it a type class
19+
regarding terms in `ObjectProperty C` when `C` is pretriangulated
20+
21+
-/
22+
23+
universe v u
24+
25+
namespace CategoryTheory
26+
27+
/-- A property of objects in a category `C` is a predicate `C → Prop`. -/
28+
@[nolint unusedArguments]
29+
abbrev ObjectProperty (C : Type u) [Category.{v} C] : Type u := C → Prop
30+
31+
end CategoryTheory
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
/-
2+
Copyright (c) 2024 Joël Riou. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Joël Riou
5+
-/
6+
import Mathlib.CategoryTheory.Iso
7+
import Mathlib.CategoryTheory.ObjectProperty.Basic
8+
import Mathlib.Order.Basic
9+
10+
/-! # Properties of objects which are closed under isomorphisms
11+
12+
Given a category `C` and `P : ObjectProperty C` (i.e. `P : C → Prop`),
13+
this file introduces the type class `P.IsClosedUnderIsomorphisms`.
14+
15+
-/
16+
17+
namespace CategoryTheory
18+
19+
variable {C : Type*} [Category C] (P Q : ObjectProperty C)
20+
21+
namespace ObjectProperty
22+
23+
/-- A predicate `C → Prop` on the objects of a category is closed under isomorphisms
24+
if whenever `P X`, then all the objects `Y` that are isomorphic to `X` also satisfy `P Y`. -/
25+
class IsClosedUnderIsomorphisms : Prop where
26+
of_iso {X Y : C} (_ : X ≅ Y) (_ : P X) : P Y
27+
28+
@[deprecated (since := "2025-02-25")] alias ClosedUnderIsomorphisms := IsClosedUnderIsomorphisms
29+
30+
lemma prop_of_iso [IsClosedUnderIsomorphisms P] {X Y : C} (e : X ≅ Y) (hX : P X) : P Y :=
31+
IsClosedUnderIsomorphisms.of_iso e hX
32+
33+
lemma prop_iff_of_iso [IsClosedUnderIsomorphisms P] {X Y : C} (e : X ≅ Y) : P X ↔ P Y :=
34+
⟨prop_of_iso P e, prop_of_iso P e.symm⟩
35+
36+
lemma prop_of_isIso [IsClosedUnderIsomorphisms P] {X Y : C} (f : X ⟶ Y) [IsIso f] (hX : P X) :
37+
P Y :=
38+
prop_of_iso P (asIso f) hX
39+
40+
lemma prop_iff_of_isIso [IsClosedUnderIsomorphisms P] {X Y : C} (f : X ⟶ Y) [IsIso f] : P X ↔ P Y :=
41+
prop_iff_of_iso P (asIso f)
42+
43+
/-- The closure by isomorphisms of a predicate on objects in a category. -/
44+
def isoClosure : ObjectProperty C := fun X => ∃ (Y : C) (_ : P Y), Nonempty (X ≅ Y)
45+
46+
lemma prop_isoClosure_iff (X : C) :
47+
isoClosure P X ↔ ∃ (Y : C) (_ : P Y), Nonempty (X ≅ Y) := by rfl
48+
49+
variable {P} in
50+
lemma prop_isoClosure {X Y : C} (h : P X) (e : X ⟶ Y) [IsIso e] : isoClosure P Y :=
51+
⟨X, h, ⟨(asIso e).symm⟩⟩
52+
53+
lemma le_isoClosure : P ≤ isoClosure P :=
54+
fun X hX => ⟨X, hX, ⟨Iso.refl X⟩⟩
55+
56+
variable {P Q} in
57+
lemma monotone_isoClosure (h : P ≤ Q) : isoClosure P ≤ isoClosure Q := by
58+
rintro X ⟨X', hX', ⟨e⟩⟩
59+
exact ⟨X', h _ hX', ⟨e⟩⟩
60+
61+
lemma isoClosure_eq_self [IsClosedUnderIsomorphisms P] : isoClosure P = P := by
62+
apply le_antisymm
63+
· intro X ⟨Y, hY, ⟨e⟩⟩
64+
exact prop_of_iso P e.symm hY
65+
· exact le_isoClosure P
66+
67+
lemma isoClosure_le_iff [IsClosedUnderIsomorphisms Q] : isoClosure P ≤ Q ↔ P ≤ Q :=
68+
⟨(le_isoClosure P).trans,
69+
fun h => (monotone_isoClosure h).trans (by rw [isoClosure_eq_self])⟩
70+
71+
instance : IsClosedUnderIsomorphisms (isoClosure P) where
72+
of_iso := by
73+
rintro X Y e ⟨Z, hZ, ⟨f⟩⟩
74+
exact ⟨Z, hZ, ⟨e.symm.trans f⟩⟩
75+
76+
end ObjectProperty
77+
78+
open ObjectProperty
79+
80+
@[deprecated (since := "2025-02-25")] alias mem_of_iso := prop_of_iso
81+
@[deprecated (since := "2025-02-25")] alias mem_iff_of_iso := prop_iff_of_iso
82+
@[deprecated (since := "2025-02-25")] alias mem_of_isIso := prop_of_isIso
83+
@[deprecated (since := "2025-02-25")] alias mem_iff_of_isIso := prop_iff_of_isIso
84+
@[deprecated (since := "2025-02-25")] alias isoClosure := isoClosure
85+
@[deprecated (since := "2025-02-25")] alias mem_isoClosure_iff := prop_isoClosure_iff
86+
@[deprecated (since := "2025-02-25")] alias mem_isoClosure := prop_isoClosure
87+
88+
end CategoryTheory
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/-
2+
Copyright (c) 2024 Joël Riou. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Joël Riou
5+
-/
6+
import Mathlib.CategoryTheory.ObjectProperty.ClosedUnderIsomorphisms
7+
import Mathlib.CategoryTheory.Shift.Basic
8+
9+
/-!
10+
# Properties of objects on categories equipped with shift
11+
12+
Given a predicate `P : ObjectProperty C` on objects of a category equipped with a shift
13+
by `A`, we define shifted properties of objects `P.shift a` for all `a : A`.
14+
15+
-/
16+
17+
open CategoryTheory Category
18+
19+
namespace CategoryTheory
20+
21+
variable {C : Type*} [Category C] (P : ObjectProperty C)
22+
{A : Type*} [AddMonoid A] [HasShift C A]
23+
24+
namespace ObjectProperty
25+
26+
/-- Given a predicate `P : C → Prop` on objects of a category equipped with a shift by `A`,
27+
this is the predicate which is satisfied by `X` if `P (X⟦a⟧)`. -/
28+
def shift (a : A) : ObjectProperty C := fun X => P (X⟦a⟧)
29+
30+
lemma prop_shift_iff (a : A) (X : C) : P.shift a X ↔ P (X⟦a⟧) := Iff.rfl
31+
32+
instance (a : A) [P.IsClosedUnderIsomorphisms] :
33+
(P.shift a).IsClosedUnderIsomorphisms where
34+
of_iso e hX := P.prop_of_iso ((shiftFunctor C a).mapIso e) hX
35+
36+
variable (A)
37+
38+
@[simp]
39+
lemma shift_zero [P.IsClosedUnderIsomorphisms] : P.shift (0 : A) = P := by
40+
ext X
41+
exact P.prop_iff_of_iso ((shiftFunctorZero C A).app X)
42+
43+
variable {A}
44+
45+
lemma shift_shift (a b c : A) (h : a + b = c) [P.IsClosedUnderIsomorphisms] :
46+
(P.shift b).shift a = P.shift c := by
47+
ext X
48+
exact P.prop_iff_of_iso ((shiftFunctorAdd' C a b c h).symm.app X)
49+
50+
end ObjectProperty
51+
52+
@[deprecated (since := "2025-02-25")] alias PredicateShift := ObjectProperty.shift
53+
@[deprecated (since := "2025-02-25")] alias predicateShift_iff := ObjectProperty.prop_shift_iff
54+
@[deprecated (since := "2025-02-25")] alias predicateShift_zero := ObjectProperty.shift_zero
55+
@[deprecated (since := "2025-02-25")] alias predicateShift_predicateShift :=
56+
ObjectProperty.shift_shift
57+
58+
end CategoryTheory

0 commit comments

Comments
 (0)