From 0757d2d478417d9cbf0982a7e22bc978a54dd869 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sat, 20 Sep 2025 23:20:43 +0200 Subject: [PATCH 01/69] feat(CategoryTheory): colimits of objects satisfying a property --- Mathlib.lean | 1 + .../CategoryTheory/Comma/CardinalArrow.lean | 23 ++- .../CategoryTheory/Limits/Presentation.lean | 12 ++ .../CategoryTheory/ObjectProperty/Basic.lean | 6 +- .../ObjectProperty/ColimitsOfShape.lean | 143 ++++++++++++++++++ .../ObjectProperty/FullSubcategory.lean | 6 +- 6 files changed, 188 insertions(+), 3 deletions(-) create mode 100644 Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean diff --git a/Mathlib.lean b/Mathlib.lean index 5eac9a0f2fb3d7..cef78536c75928 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -2632,6 +2632,7 @@ import Mathlib.CategoryTheory.NatTrans import Mathlib.CategoryTheory.Noetherian import Mathlib.CategoryTheory.ObjectProperty.Basic import Mathlib.CategoryTheory.ObjectProperty.ClosedUnderIsomorphisms +import Mathlib.CategoryTheory.ObjectProperty.ColimitsOfShape import Mathlib.CategoryTheory.ObjectProperty.ContainsZero import Mathlib.CategoryTheory.ObjectProperty.EpiMono import Mathlib.CategoryTheory.ObjectProperty.Extensions diff --git a/Mathlib/CategoryTheory/Comma/CardinalArrow.lean b/Mathlib/CategoryTheory/Comma/CardinalArrow.lean index 0d4e57798f5bd5..60f6a619a2af14 100644 --- a/Mathlib/CategoryTheory/Comma/CardinalArrow.lean +++ b/Mathlib/CategoryTheory/Comma/CardinalArrow.lean @@ -18,7 +18,7 @@ If `A` is a (small) category, `Arrow C` is finite iff `FinCategory C` holds. -/ -universe w w' v u +universe w w' v' u' v u namespace CategoryTheory @@ -105,4 +105,25 @@ lemma hasCardinalLT_of_hasCardinalLT_arrow HasCardinalLT C κ := h.of_injective (fun X ↦ Arrow.mk (𝟙 X)) (fun _ _ h ↦ congr_arg Comma.left h) +instance {C : Type u} [Category.{v} C] [Small.{w} C] [LocallySmall.{w} C] : + Small.{w} (Arrow C) := by + let φ (f : Arrow C) : Σ (s t : C), s ⟶ t := ⟨_, _, f.hom⟩ + refine small_of_injective (f := φ) ?_ + rintro ⟨s, t, f⟩ ⟨s', t', f'⟩ h + obtain rfl : s = s' := congr_arg Sigma.fst h + simp only [Functor.id_obj, Sigma.mk.injEq, heq_eq_eq, true_and, φ] at h + obtain rfl : t = t' := h.1 + obtain rfl : f = f' := by simpa using h + rfl + +instance {C : Type u} [Category.{v} C] [Small.{w} C] [LocallySmall.{w} C] + {D : Type u'} [Category.{v'} D] [Small.{w} D] [LocallySmall.{w} D] : + Small.{w} (C ⥤ D) := by + let φ (F : C ⥤ D) (f : Arrow C) : Arrow D := ⟨_, _, F.map f.hom⟩ + refine small_of_injective (f := φ) (fun F G h ↦ Functor.ext (fun X ↦ ?_) (fun X Y f ↦ ?_)) + · exact congr_arg Comma.left (congr_fun h (Arrow.mk (𝟙 X))) + · have : Arrow.mk (F.map f) = Arrow.mk (G.map f) := congr_fun h (Arrow.mk f) + rw [Arrow.mk_eq_mk_iff] at this + tauto + end CategoryTheory diff --git a/Mathlib/CategoryTheory/Limits/Presentation.lean b/Mathlib/CategoryTheory/Limits/Presentation.lean index 2b0618556f9a40..ffa296b608adff 100644 --- a/Mathlib/CategoryTheory/Limits/Presentation.lean +++ b/Mathlib/CategoryTheory/Limits/Presentation.lean @@ -52,6 +52,9 @@ initialize_simps_projections ColimitPresentation (-isColimit) abbrev cocone (pres : ColimitPresentation J X) : Cocone pres.diag := Cocone.mk _ pres.ι +lemma hasColimit (pres : ColimitPresentation J X) : HasColimit pres.diag := + ⟨_, pres.isColimit⟩ + /-- The canonical colimit presentation of any object over a point. -/ @[simps] noncomputable @@ -70,6 +73,15 @@ def map (P : ColimitPresentation J X) {D : Type*} [Category D] (F : C ⥤ D) ι := Functor.whiskerRight P.ι F ≫ (F.constComp _ _).hom isColimit := (isColimitOfPreserves F P.isColimit).ofIsoColimit (Cocones.ext (.refl _) (by simp)) +/-- If `P` is a colimit presentation of `X`, it is possible to define another +colimit presentation of `X` where `P.diag` is replaced by an isomorphic functor. -/ +@[simps] +def chgDiag (P : ColimitPresentation J X) {F : J ⥤ C} (e : F ≅ P.diag) : + ColimitPresentation J X where + diag := F + ι := e.hom ≫ P.ι + isColimit := (IsColimit.precomposeHomEquiv e _).2 P.isColimit + /-- Map a colimit presentation under an isomorphism. -/ @[simps] def ofIso (P : ColimitPresentation J X) {Y : C} (e : X ≅ Y) : ColimitPresentation J Y where diff --git a/Mathlib/CategoryTheory/ObjectProperty/Basic.lean b/Mathlib/CategoryTheory/ObjectProperty/Basic.lean index 7cf7a47eb945ba..bb15eff69d909e 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/Basic.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/Basic.lean @@ -23,7 +23,7 @@ for predicates `C → Prop`. -/ -universe v v' u u' +universe w v v' u u' namespace CategoryTheory @@ -66,6 +66,10 @@ lemma prop_of_is (P : ObjectProperty C) (X : C) [P.Is X] : P X := by rwa [← P. lemma is_of_prop (P : ObjectProperty C) {X : C} (hX : P X) : P.Is X := by rwa [P.is_iff] +/-- A property of objects is small relative to a universe `w` +if the corresponding subtype is. -/ +protected abbrev Small (P : ObjectProperty C) : Prop := _root_.Small.{w} (Subtype P) + end ObjectProperty end CategoryTheory diff --git a/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean b/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean new file mode 100644 index 00000000000000..1dcad7b588ce26 --- /dev/null +++ b/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean @@ -0,0 +1,143 @@ +/- +Copyright (c) 2025 Joël Riou. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Joël Riou +-/ +import Mathlib.CategoryTheory.ObjectProperty.FullSubcategory +import Mathlib.CategoryTheory.Limits.Presentation + +/-! +# Objects that are colimits of objects satisfying a certain property + +Given a property of object `P : ObjectProperty C` and a category `J`, +we introduce two properties of objects `P.strictColimitsOfShape J` +and `P.colimitsOfShape J` + +## TODO + +* refactor `ClosedUnderColimitsOfShape J P` to make it a typeclass which +would say that `P.colimitsOfShape J ≤ J`. +* refactor `ObjectProperty.ind` by saying that it is the supremum +of `P.colimitsOfShape J` for a filtered category `J` +(generalize also to `κ`-filtered categories?) +* dualize the results and formalize the closure of `P` +under finite limits (which require iterating over `ℕ`), +and more generally the closure under limits indexed by a category +whose type of arrows has a cardinality that is bounded by a +certain regular cardinal (@joelriou) + +-/ + +universe w v' u' v u + +namespace CategoryTheory.ObjectProperty + +open Limits + +variable {C : Type*} [Category C] (P : ObjectProperty C) + (J : Type u') [Category.{v'} J] + +/-- The property of objects that are *equal* to `colimit F` for some +functor `F : J ⥤ C` where all `F.obj j` satisfy `P`. -/ +inductive strictColimitsOfShape : ObjectProperty C + | colimit (F : J ⥤ C) [HasColimit F] (hF : ∀ j, P (F.obj j)) : + strictColimitsOfShape (colimit F) + +variable {P} in +lemma strictColimitsOfShape_monotone {Q : ObjectProperty C} (h : P ≤ Q) : + P.strictColimitsOfShape J ≤ Q.strictColimitsOfShape J := by + rintro _ ⟨F, hF⟩ + exact ⟨F, fun j ↦ h _ (hF j)⟩ + +/-- A structure expressing that `X : C` is the colimit of a functor +`diag : J ⥤ C` such that `P (diag.obj j)` hold for all `j`. -/ +structure ColimitOfShape (X : C) extends ColimitPresentation J X where + prop_diag_obj (j : J) : P (diag.obj j) + +namespace ColimitOfShape + +variable {P J} + +/-- If `F : J ⥤ C` is a functor that has a colimit and is such that for all `j`, +`F.obj j` satisfies a property `P`, then this structure expresses that `colimit F` +is indeed a colimits of objects satisfying `P`. -/ +noncomputable def colimit (F : J ⥤ C) [HasColimit F] (hF : ∀ j, P (F.obj j)) : + P.ColimitOfShape J (colimit F) where + diag := F + ι := _ + isColimit := colimit.isColimit _ + prop_diag_obj := hF + +/-- If `X` is a colimit indexed by `J` of objects satisfying a property `P`, then +any object that is isomorphic to `X` also is. -/ +@[simps toColimitPresentation] +def ofIso {X : C} (h : P.ColimitOfShape J X) {Y : C} (e : X ≅ Y) : + P.ColimitOfShape J Y where + toColimitPresentation := .ofIso h.toColimitPresentation e + prop_diag_obj := h.prop_diag_obj + +/-- If `X` is a colimit indexed by `J` of objects satisfying a property `P`, +it is also a colimit indexed by `J` of objects satisfyind `Q` if `P ≤ Q`. -/ +@[simps toColimitPresentation] +def ofLE {X : C} (h : P.ColimitOfShape J X) {Q : ObjectProperty C} (hPQ : P ≤ Q) : + Q.ColimitOfShape J X where + toColimitPresentation := h.toColimitPresentation + prop_diag_obj j := hPQ _ (h.prop_diag_obj j) + +end ColimitOfShape + +/-- The property of objects that are the point of a colimit cocone for a +functor `F : J ⥤ C` where all objects `F.obj j` satisfy `P`. -/ +def colimitsOfShape : ObjectProperty C := + fun X ↦ Nonempty (P.ColimitOfShape J X) + +variable {P J} in +lemma ColimitOfShape.colimitsOfShape {X : C} (h : P.ColimitOfShape J X) : + P.colimitsOfShape J X := + ⟨h⟩ + +lemma strictColimitsOfShape_le_colimitsOfShape : + P.strictColimitsOfShape J ≤ P.colimitsOfShape J := by + rintro X ⟨F, hF⟩ + exact ⟨.colimit F hF⟩ + +instance : (P.colimitsOfShape J).IsClosedUnderIsomorphisms where + of_iso := by rintro _ _ e ⟨h⟩; exact ⟨h.ofIso e⟩ + +@[simp] +lemma isoClosure_strictColimitsOfShape : + (P.strictColimitsOfShape J).isoClosure = P.colimitsOfShape J := by + refine le_antisymm ?_ ?_ + · rw [isoClosure_le_iff] + apply strictColimitsOfShape_le_colimitsOfShape + · intro X ⟨h⟩ + have := h.hasColimit + exact ⟨colimit h.diag, strictColimitsOfShape.colimit h.diag h.prop_diag_obj, + ⟨h.isColimit.coconePointUniqueUpToIso (colimit.isColimit _)⟩⟩ + +variable {P} in +lemma colimitsOfShape_monotone {Q : ObjectProperty C} (hPQ : P ≤ Q) : + P.colimitsOfShape J ≤ Q.colimitsOfShape J := by + intro X ⟨h⟩ + exact ⟨h.ofLE hPQ⟩ + +@[simp] +lemma colimitsOfShape_isoClosure : + P.isoClosure.colimitsOfShape J = P.colimitsOfShape J := by + refine le_antisymm ?_ (colimitsOfShape_monotone _ (P.le_isoClosure)) + intro X ⟨h⟩ + choose obj h₁ h₂ using h.prop_diag_obj + exact + ⟨{ toColimitPresentation := h.chgDiag (h.diag.isoCopyObj obj (fun j ↦ (h₂ j).some)).symm + prop_diag_obj := h₁ }⟩ + +instance [ObjectProperty.Small.{w} P] [LocallySmall.{w} C] [Small.{w} J] [LocallySmall.{w} J] : + ObjectProperty.Small.{w} (P.strictColimitsOfShape J) := by + refine small_of_surjective + (f := fun (F : { F : J ⥤ P.FullSubcategory // HasColimit (F ⋙ P.ι) }) ↦ + letI := F.2 + (⟨_, ⟨F.1 ⋙ P.ι, fun j ↦ (F.1.obj j).2⟩⟩)) ?_ + rintro ⟨_, ⟨F, hF⟩⟩ + exact ⟨⟨P.lift F hF, by assumption⟩, rfl⟩ + +end CategoryTheory.ObjectProperty diff --git a/Mathlib/CategoryTheory/ObjectProperty/FullSubcategory.lean b/Mathlib/CategoryTheory/ObjectProperty/FullSubcategory.lean index b0e74c7e4521ce..a63cdba7037313 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/FullSubcategory.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/FullSubcategory.lean @@ -5,6 +5,7 @@ Authors: Kim Morrison, Reid Barton, Joël Riou -/ import Mathlib.CategoryTheory.InducedCategory import Mathlib.CategoryTheory.ObjectProperty.Basic +import Mathlib.Logic.Small.Basic /-! # The full subcategory associated to a property of objects @@ -15,7 +16,7 @@ of objects in `C` satisfying `P`. -/ -universe v v' u u' +universe w v v' u u' namespace CategoryTheory @@ -41,6 +42,9 @@ structure FullSubcategory where instance FullSubcategory.category : Category.{v} P.FullSubcategory := InducedCategory.category FullSubcategory.obj +instance [ObjectProperty.Small.{w} P] : Small.{w} P.FullSubcategory := + small_of_surjective (f := fun (x : Subtype P) ↦ ⟨x.1, x.2⟩) (fun x ↦ ⟨⟨x.1, x.2⟩, rfl⟩) + -- these lemmas are not particularly well-typed, so would probably be dangerous as simp lemmas lemma FullSubcategory.id_def (X : P.FullSubcategory) : 𝟙 X = 𝟙 X.obj := rfl From d6676bd20e86f177c00063e47595f63e167172cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sat, 20 Sep 2025 23:26:18 +0200 Subject: [PATCH 02/69] fix --- .../ObjectProperty/ColimitsOfShape.lean | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean b/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean index 1dcad7b588ce26..a7063e1ad39243 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean @@ -11,7 +11,16 @@ import Mathlib.CategoryTheory.Limits.Presentation Given a property of object `P : ObjectProperty C` and a category `J`, we introduce two properties of objects `P.strictColimitsOfShape J` -and `P.colimitsOfShape J` +and `P.colimitsOfShape J`. The former contains exactly the objects +of the form `colimit F` for any functor `F : J ⥤ C` that has +a colimit and such that `F.obj j` satisfies `P` for any `h`, while +the latter contains all the objects that are isomorphic to +the these "chosen" objects `colimit F`. + +Under certain circumstances, the type of objects satisfying +`P.strictColimitsOfShape J` is small: the main reason this variant is +introduced is to deduce that the full subcategory of `P.colimitsOfShape J` +is essentially small. ## TODO @@ -135,8 +144,7 @@ instance [ObjectProperty.Small.{w} P] [LocallySmall.{w} C] [Small.{w} J] [Locall ObjectProperty.Small.{w} (P.strictColimitsOfShape J) := by refine small_of_surjective (f := fun (F : { F : J ⥤ P.FullSubcategory // HasColimit (F ⋙ P.ι) }) ↦ - letI := F.2 - (⟨_, ⟨F.1 ⋙ P.ι, fun j ↦ (F.1.obj j).2⟩⟩)) ?_ + (⟨_, letI := F.2; ⟨F.1 ⋙ P.ι, fun j ↦ (F.1.obj j).2⟩⟩)) ?_ rintro ⟨_, ⟨F, hF⟩⟩ exact ⟨⟨P.lift F hF, by assumption⟩, rfl⟩ From a57afac649b081c088a5f5d2c3cc5e5ac00d80b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sat, 20 Sep 2025 23:27:16 +0200 Subject: [PATCH 03/69] typo --- Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean b/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean index a7063e1ad39243..5059b20ea6f3bc 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean @@ -13,9 +13,9 @@ Given a property of object `P : ObjectProperty C` and a category `J`, we introduce two properties of objects `P.strictColimitsOfShape J` and `P.colimitsOfShape J`. The former contains exactly the objects of the form `colimit F` for any functor `F : J ⥤ C` that has -a colimit and such that `F.obj j` satisfies `P` for any `h`, while +a colimit and such that `F.obj j` satisfies `P` for any `j`, while the latter contains all the objects that are isomorphic to -the these "chosen" objects `colimit F`. +these "chosen" objects `colimit F`. Under certain circumstances, the type of objects satisfying `P.strictColimitsOfShape J` is small: the main reason this variant is From 31376ce9368c5bdd8704c4623bfe0c99975e2d99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sat, 20 Sep 2025 23:30:44 +0200 Subject: [PATCH 04/69] fix --- Mathlib.lean | 1 + .../CategoryTheory/ObjectProperty/Basic.lean | 4 --- .../ObjectProperty/FullSubcategory.lean | 4 --- .../CategoryTheory/ObjectProperty/Small.lean | 28 +++++++++++++++++++ 4 files changed, 29 insertions(+), 8 deletions(-) create mode 100644 Mathlib/CategoryTheory/ObjectProperty/Small.lean diff --git a/Mathlib.lean b/Mathlib.lean index cef78536c75928..4eae68f68ca027 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -2639,6 +2639,7 @@ import Mathlib.CategoryTheory.ObjectProperty.Extensions import Mathlib.CategoryTheory.ObjectProperty.FullSubcategory import Mathlib.CategoryTheory.ObjectProperty.Ind import Mathlib.CategoryTheory.ObjectProperty.Shift +import Mathlib.CategoryTheory.ObjectProperty.Small import Mathlib.CategoryTheory.Opposites import Mathlib.CategoryTheory.PEmpty import Mathlib.CategoryTheory.PUnit diff --git a/Mathlib/CategoryTheory/ObjectProperty/Basic.lean b/Mathlib/CategoryTheory/ObjectProperty/Basic.lean index bb15eff69d909e..7ba505f5b7ef31 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/Basic.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/Basic.lean @@ -66,10 +66,6 @@ lemma prop_of_is (P : ObjectProperty C) (X : C) [P.Is X] : P X := by rwa [← P. lemma is_of_prop (P : ObjectProperty C) {X : C} (hX : P X) : P.Is X := by rwa [P.is_iff] -/-- A property of objects is small relative to a universe `w` -if the corresponding subtype is. -/ -protected abbrev Small (P : ObjectProperty C) : Prop := _root_.Small.{w} (Subtype P) - end ObjectProperty end CategoryTheory diff --git a/Mathlib/CategoryTheory/ObjectProperty/FullSubcategory.lean b/Mathlib/CategoryTheory/ObjectProperty/FullSubcategory.lean index a63cdba7037313..6b1ca7ff95c27b 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/FullSubcategory.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/FullSubcategory.lean @@ -5,7 +5,6 @@ Authors: Kim Morrison, Reid Barton, Joël Riou -/ import Mathlib.CategoryTheory.InducedCategory import Mathlib.CategoryTheory.ObjectProperty.Basic -import Mathlib.Logic.Small.Basic /-! # The full subcategory associated to a property of objects @@ -42,9 +41,6 @@ structure FullSubcategory where instance FullSubcategory.category : Category.{v} P.FullSubcategory := InducedCategory.category FullSubcategory.obj -instance [ObjectProperty.Small.{w} P] : Small.{w} P.FullSubcategory := - small_of_surjective (f := fun (x : Subtype P) ↦ ⟨x.1, x.2⟩) (fun x ↦ ⟨⟨x.1, x.2⟩, rfl⟩) - -- these lemmas are not particularly well-typed, so would probably be dangerous as simp lemmas lemma FullSubcategory.id_def (X : P.FullSubcategory) : 𝟙 X = 𝟙 X.obj := rfl diff --git a/Mathlib/CategoryTheory/ObjectProperty/Small.lean b/Mathlib/CategoryTheory/ObjectProperty/Small.lean new file mode 100644 index 00000000000000..cc03da79e5e803 --- /dev/null +++ b/Mathlib/CategoryTheory/ObjectProperty/Small.lean @@ -0,0 +1,28 @@ +/- +Copyright (c) 2025 Joël Riou. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Joël Riou +-/ +import Mathlib.CategoryTheory.ObjectProperty.FullSubcategory +import Mathlib.Logic.Small.Basic + +/-! +# Smallness of a property of objects + +-/ + +universe w v u + +namespace CategoryTheory.ObjectProperty + +variable {C : Type u} [Category.{v} C] + +/-- A property of objects is small relative to a universe `w` +if the corresponding subtype is. -/ +protected abbrev Small (P : ObjectProperty C) : Prop := _root_.Small.{w} (Subtype P) + +instance (P : ObjectProperty C) [ObjectProperty.Small.{w} P] : + Small.{w} P.FullSubcategory := + small_of_surjective (f := fun (x : Subtype P) ↦ ⟨x.1, x.2⟩) (fun x ↦ ⟨⟨x.1, x.2⟩, rfl⟩) + +end CategoryTheory.ObjectProperty From fd70884d22b328914d8a825e0dc2f3cd727ac088 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sat, 20 Sep 2025 23:32:09 +0200 Subject: [PATCH 05/69] better syntax --- Mathlib/CategoryTheory/Comma/CardinalArrow.lean | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Mathlib/CategoryTheory/Comma/CardinalArrow.lean b/Mathlib/CategoryTheory/Comma/CardinalArrow.lean index 60f6a619a2af14..37e402c8ff1b49 100644 --- a/Mathlib/CategoryTheory/Comma/CardinalArrow.lean +++ b/Mathlib/CategoryTheory/Comma/CardinalArrow.lean @@ -119,8 +119,8 @@ instance {C : Type u} [Category.{v} C] [Small.{w} C] [LocallySmall.{w} C] : instance {C : Type u} [Category.{v} C] [Small.{w} C] [LocallySmall.{w} C] {D : Type u'} [Category.{v'} D] [Small.{w} D] [LocallySmall.{w} D] : Small.{w} (C ⥤ D) := by - let φ (F : C ⥤ D) (f : Arrow C) : Arrow D := ⟨_, _, F.map f.hom⟩ - refine small_of_injective (f := φ) (fun F G h ↦ Functor.ext (fun X ↦ ?_) (fun X Y f ↦ ?_)) + refine small_of_injective (f := fun F (f : Arrow C) ↦ Arrow.mk (F.map f.hom)) + (fun F G h ↦ Functor.ext (fun X ↦ ?_) (fun X Y f ↦ ?_)) · exact congr_arg Comma.left (congr_fun h (Arrow.mk (𝟙 X))) · have : Arrow.mk (F.map f) = Arrow.mk (G.map f) := congr_fun h (Arrow.mk f) rw [Arrow.mk_eq_mk_iff] at this From 73661c242344137df44acf19840d6488a204afc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sat, 20 Sep 2025 23:32:38 +0200 Subject: [PATCH 06/69] typo --- Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean b/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean index 5059b20ea6f3bc..9623ec40cf9ee0 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean @@ -9,7 +9,7 @@ import Mathlib.CategoryTheory.Limits.Presentation /-! # Objects that are colimits of objects satisfying a certain property -Given a property of object `P : ObjectProperty C` and a category `J`, +Given a property of objects `P : ObjectProperty C` and a category `J`, we introduce two properties of objects `P.strictColimitsOfShape J` and `P.colimitsOfShape J`. The former contains exactly the objects of the form `colimit F` for any functor `F : J ⥤ C` that has From 41d6537c5f7e8d095328256112697ecb2bfaeedf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sat, 20 Sep 2025 23:52:22 +0200 Subject: [PATCH 07/69] fixing imports --- Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean b/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean index 9623ec40cf9ee0..208eedb4fedf75 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean @@ -3,7 +3,7 @@ Copyright (c) 2025 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ -import Mathlib.CategoryTheory.ObjectProperty.FullSubcategory +import Mathlib.CategoryTheory.ObjectProperty.Small import Mathlib.CategoryTheory.Limits.Presentation /-! From 89f7db39ba38ff85d93c1b8dd38d7c44db8c6b17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sun, 21 Sep 2025 12:49:48 +0200 Subject: [PATCH 08/69] feat(CategoryTheory): limit presentations --- .../CategoryTheory/Limits/Presentation.lean | 87 ++++++++++++++++++- 1 file changed, 85 insertions(+), 2 deletions(-) diff --git a/Mathlib/CategoryTheory/Limits/Presentation.lean b/Mathlib/CategoryTheory/Limits/Presentation.lean index 2b0618556f9a40..cbf8d56a9b2c25 100644 --- a/Mathlib/CategoryTheory/Limits/Presentation.lean +++ b/Mathlib/CategoryTheory/Limits/Presentation.lean @@ -19,10 +19,11 @@ the data of objects `Dⱼ` and natural maps `sⱼ : Dⱼ ⟶ X` that make `X` th `{Dᵢ}` in `C` and natural maps `sᵢ : Dᵢ ⟶ X` making `X` into the colimit of the `Dᵢ`. - `CategoryTheory.Limits.ColimitPresentation.bind`: Given a colimit presentation of `X` and colimit presentations of the components, this is the colimit presentation over the sigma type. +- `CategoryTheory.Limits.LimitPresentation`: A limit presentation of `X` over `J` is a diagram + `{Dᵢ}` in `C` and natural maps `sᵢ : X ⟶ Dᵢ` making `X` into the limit of the `Dᵢ`. ## TODOs: -- Dualise to obtain `LimitPresentation`. - Refactor `TransfiniteCompositionOfShape` so that it extends `ColimitPresentation`. -/ @@ -52,6 +53,9 @@ initialize_simps_projections ColimitPresentation (-isColimit) abbrev cocone (pres : ColimitPresentation J X) : Cocone pres.diag := Cocone.mk _ pres.ι +lemma hasColimit (pres : ColimitPresentation J X) : HasColimit pres.diag := + ⟨_, pres.isColimit⟩ + /-- The canonical colimit presentation of any object over a point. -/ @[simps] noncomputable @@ -70,6 +74,15 @@ def map (P : ColimitPresentation J X) {D : Type*} [Category D] (F : C ⥤ D) ι := Functor.whiskerRight P.ι F ≫ (F.constComp _ _).hom isColimit := (isColimitOfPreserves F P.isColimit).ofIsoColimit (Cocones.ext (.refl _) (by simp)) +/-- If `P` is a colimit presentation of `X`, it is possible to define another +colimit presentation of `X` where `P.diag` is replaced by an isomorphic functor. -/ +@[simps] +def chgDiag (P : ColimitPresentation J X) {F : J ⥤ C} (e : F ≅ P.diag) : + ColimitPresentation J X where + diag := F + ι := e.hom ≫ P.ι + isColimit := (IsColimit.precomposeHomEquiv e _).2 P.isColimit + /-- Map a colimit presentation under an isomorphism. -/ @[simps] def ofIso (P : ColimitPresentation J X) {Y : C} (e : X ≅ Y) : ColimitPresentation J Y where @@ -215,4 +228,74 @@ end Small end -end CategoryTheory.Limits.ColimitPresentation +end ColimitPresentation + +/-- A limit presentation of `X` over `J` is a diagram `{Dᵢ}` in `C` and natural maps +`sᵢ : X ⟶ Dᵢ` making `X` into the limit of the `Dᵢ`. -/ +structure LimitPresentation (J : Type w) [Category.{t} J] (X : C) where + /-- The diagram `{Dᵢ}`. -/ + diag : J ⥤ C + /-- The natural maps `sᵢ : X ⟶ Dᵢ`. -/ + π : (Functor.const J).obj X ⟶ diag + /-- `X` is the colimit of the `Dᵢ` via `sᵢ`. -/ + isLimit : IsLimit (Cone.mk _ π) + +variable {J : Type w} [Category.{t} J] {X : C} + +namespace LimitPresentation + +initialize_simps_projections LimitPresentation (-isLimit) + +/-- The cone associated to a limit presentation. -/ +abbrev cone (pres : LimitPresentation J X) : Cone pres.diag := + Cone.mk _ pres.π + +lemma hasLimit (pres : LimitPresentation J X) : HasLimit pres.diag := + ⟨_, pres.isLimit⟩ + +/-- The canonical limit presentation of any object over a point. -/ +@[simps] +noncomputable +def self (X : C) : LimitPresentation PUnit.{s + 1} X where + diag := (Functor.const _).obj X + π := 𝟙 _ + isLimit := isLimitConstCone _ _ + +/-- If `F` preserves limits of shape `J`, it maps limit presentations of `X` to +limit presentations of `F(X)`. -/ +@[simps] +noncomputable +def map (P : LimitPresentation J X) {D : Type*} [Category D] (F : C ⥤ D) + [PreservesLimitsOfShape J F] : LimitPresentation J (F.obj X) where + diag := P.diag ⋙ F + π := (F.constComp _ _).inv ≫ Functor.whiskerRight P.π F + isLimit := (isLimitOfPreserves F P.isLimit).ofIsoLimit (Cones.ext (.refl _) (by simp)) + +/-- If `P` is a limit presentation of `X`, it is possible to define another +limit presentation of `X` where `P.diag` is replaced by an isomorphic functor. -/ +@[simps] +def chgDiag (P : LimitPresentation J X) {F : J ⥤ C} (e : F ≅ P.diag) : + LimitPresentation J X where + diag := F + π := P.π ≫ e.inv + isLimit := (IsLimit.postcomposeHomEquiv e.symm _).2 P.isLimit + +/-- Map a limit presentation under an isomorphism. -/ +@[simps] +def ofIso (P : LimitPresentation J X) {Y : C} (e : X ≅ Y) : LimitPresentation J Y where + diag := P.diag + π := (Functor.const J).map e.inv ≫ P.π + isLimit := P.isLimit.ofIsoLimit (Cones.ext e) + +/-- Change the index category of a limit presentation. -/ +@[simps] +noncomputable +def reindex (P : LimitPresentation J X) {J' : Type*} [Category J'] (F : J' ⥤ J) [F.Initial] : + LimitPresentation J' X where + diag := F ⋙ P.diag + π := F.whiskerLeft P.π + isLimit := (Functor.Initial.isLimitWhiskerEquiv F _).symm P.isLimit + +end LimitPresentation + +end CategoryTheory.Limits From 627eb983f52f851a5d4944aa3a4f931fb6d04931 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sun, 21 Sep 2025 13:06:27 +0200 Subject: [PATCH 09/69] wip --- Mathlib.lean | 1 + .../ObjectProperty/ColimitsOfShape.lean | 5 - .../ObjectProperty/LimitsOfShape.lean | 145 ++++++++++++++++++ 3 files changed, 146 insertions(+), 5 deletions(-) create mode 100644 Mathlib/CategoryTheory/ObjectProperty/LimitsOfShape.lean diff --git a/Mathlib.lean b/Mathlib.lean index 4eae68f68ca027..5cd709def4c44b 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -2638,6 +2638,7 @@ import Mathlib.CategoryTheory.ObjectProperty.EpiMono import Mathlib.CategoryTheory.ObjectProperty.Extensions import Mathlib.CategoryTheory.ObjectProperty.FullSubcategory import Mathlib.CategoryTheory.ObjectProperty.Ind +import Mathlib.CategoryTheory.ObjectProperty.LimitsOfShape import Mathlib.CategoryTheory.ObjectProperty.Shift import Mathlib.CategoryTheory.ObjectProperty.Small import Mathlib.CategoryTheory.Opposites diff --git a/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean b/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean index 208eedb4fedf75..a95bdd7d1705b9 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean @@ -29,11 +29,6 @@ would say that `P.colimitsOfShape J ≤ J`. * refactor `ObjectProperty.ind` by saying that it is the supremum of `P.colimitsOfShape J` for a filtered category `J` (generalize also to `κ`-filtered categories?) -* dualize the results and formalize the closure of `P` -under finite limits (which require iterating over `ℕ`), -and more generally the closure under limits indexed by a category -whose type of arrows has a cardinality that is bounded by a -certain regular cardinal (@joelriou) -/ diff --git a/Mathlib/CategoryTheory/ObjectProperty/LimitsOfShape.lean b/Mathlib/CategoryTheory/ObjectProperty/LimitsOfShape.lean new file mode 100644 index 00000000000000..2aa869edfeca3e --- /dev/null +++ b/Mathlib/CategoryTheory/ObjectProperty/LimitsOfShape.lean @@ -0,0 +1,145 @@ +/- +Copyright (c) 2025 Joël Riou. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Joël Riou +-/ +import Mathlib.CategoryTheory.ObjectProperty.Small +import Mathlib.CategoryTheory.Limits.Presentation + +/-! +# Objects that are limits of objects satisfying a certain property + +Given a property of objects `P : ObjectProperty C` and a category `J`, +we introduce two properties of objects `P.strictLimitsOfShape J` +and `P.limitsOfShape J`. The former contains exactly the objects +of the form `limit F` for any functor `F : J ⥤ C` that has +a limit and such that `F.obj j` satisfies `P` for any `j`, while +the latter contains all the objects that are isomorphic to +these "chosen" objects `limit F`. + +Under certain circumstances, the type of objects satisfying +`P.strictLimitsOfShape J` is small: the main reason this variant is +introduced is to deduce that the full subcategory of `P.limitsOfShape J` +is essentially small. + +## TODO + +* formalize the closure of `P` under finite limits (which require +iterating over `ℕ`), and more generally the closure under limits +indexed by a category whose type of arrows has a cardinality +that is bounded by a certain regular cardinal (@joelriou) + +-/ + +universe w v' u' v u + +namespace CategoryTheory.ObjectProperty + +open Limits + +variable {C : Type*} [Category C] (P : ObjectProperty C) + (J : Type u') [Category.{v'} J] + +/-- The property of objects that are *equal* to `limit F` for some +functor `F : J ⥤ C` where all `F.obj j` satisfy `P`. -/ +inductive strictLimitsOfShape : ObjectProperty C + | limit (F : J ⥤ C) [HasLimit F] (hF : ∀ j, P (F.obj j)) : + strictLimitsOfShape (limit F) + +variable {P} in +lemma strictLimitsOfShape_monotone {Q : ObjectProperty C} (h : P ≤ Q) : + P.strictLimitsOfShape J ≤ Q.strictLimitsOfShape J := by + rintro _ ⟨F, hF⟩ + exact ⟨F, fun j ↦ h _ (hF j)⟩ + +/-- A structure expressing that `X : C` is the limit of a functor +`diag : J ⥤ C` such that `P (diag.obj j)` hold for all `j`. -/ +structure LimitOfShape (X : C) extends LimitPresentation J X where + prop_diag_obj (j : J) : P (diag.obj j) + +namespace LimitOfShape + +variable {P J} + +/-- If `F : J ⥤ C` is a functor that has a limit and is such that for all `j`, +`F.obj j` satisfies a property `P`, then this structure expresses that `limit F` +is indeed a limits of objects satisfying `P`. -/ +noncomputable def limit (F : J ⥤ C) [HasLimit F] (hF : ∀ j, P (F.obj j)) : + P.LimitOfShape J (limit F) where + diag := F + π := _ + isLimit := limit.isLimit _ + prop_diag_obj := hF + +/-- If `X` is a limit indexed by `J` of objects satisfying a property `P`, then +any object that is isomorphic to `X` also is. -/ +@[simps toLimitPresentation] +def ofIso {X : C} (h : P.LimitOfShape J X) {Y : C} (e : X ≅ Y) : + P.LimitOfShape J Y where + toLimitPresentation := .ofIso h.toLimitPresentation e + prop_diag_obj := h.prop_diag_obj + +/-- If `X` is a limit indexed by `J` of objects satisfying a property `P`, +it is also a limit indexed by `J` of objects satisfyind `Q` if `P ≤ Q`. -/ +@[simps toLimitPresentation] +def ofLE {X : C} (h : P.LimitOfShape J X) {Q : ObjectProperty C} (hPQ : P ≤ Q) : + Q.LimitOfShape J X where + toLimitPresentation := h.toLimitPresentation + prop_diag_obj j := hPQ _ (h.prop_diag_obj j) + +end LimitOfShape + +/-- The property of objects that are the point of a limit cone for a +functor `F : J ⥤ C` where all objects `F.obj j` satisfy `P`. -/ +def limitsOfShape : ObjectProperty C := + fun X ↦ Nonempty (P.LimitOfShape J X) + +variable {P J} in +lemma LimitOfShape.limitsOfShape {X : C} (h : P.LimitOfShape J X) : + P.limitsOfShape J X := + ⟨h⟩ + +lemma strictLimitsOfShape_le_limitsOfShape : + P.strictLimitsOfShape J ≤ P.limitsOfShape J := by + rintro X ⟨F, hF⟩ + exact ⟨.limit F hF⟩ + +instance : (P.limitsOfShape J).IsClosedUnderIsomorphisms where + of_iso := by rintro _ _ e ⟨h⟩; exact ⟨h.ofIso e⟩ + +@[simp] +lemma isoClosure_strictLimitsOfShape : + (P.strictLimitsOfShape J).isoClosure = P.limitsOfShape J := by + refine le_antisymm ?_ ?_ + · rw [isoClosure_le_iff] + apply strictLimitsOfShape_le_limitsOfShape + · intro X ⟨h⟩ + have := h.hasLimit + exact ⟨limit h.diag, strictLimitsOfShape.limit h.diag h.prop_diag_obj, + ⟨h.isLimit.conePointUniqueUpToIso (limit.isLimit _)⟩⟩ + +variable {P} in +lemma limitsOfShape_monotone {Q : ObjectProperty C} (hPQ : P ≤ Q) : + P.limitsOfShape J ≤ Q.limitsOfShape J := by + intro X ⟨h⟩ + exact ⟨h.ofLE hPQ⟩ + +@[simp] +lemma limitsOfShape_isoClosure : + P.isoClosure.limitsOfShape J = P.limitsOfShape J := by + refine le_antisymm ?_ (limitsOfShape_monotone _ (P.le_isoClosure)) + intro X ⟨h⟩ + choose obj h₁ h₂ using h.prop_diag_obj + exact + ⟨{ toLimitPresentation := h.chgDiag (h.diag.isoCopyObj obj (fun j ↦ (h₂ j).some)).symm + prop_diag_obj := h₁ }⟩ + +instance [ObjectProperty.Small.{w} P] [LocallySmall.{w} C] [Small.{w} J] [LocallySmall.{w} J] : + ObjectProperty.Small.{w} (P.strictLimitsOfShape J) := by + refine small_of_surjective + (f := fun (F : { F : J ⥤ P.FullSubcategory // HasLimit (F ⋙ P.ι) }) ↦ + (⟨_, letI := F.2; ⟨F.1 ⋙ P.ι, fun j ↦ (F.1.obj j).2⟩⟩)) ?_ + rintro ⟨_, ⟨F, hF⟩⟩ + exact ⟨⟨P.lift F hF, by assumption⟩, rfl⟩ + +end CategoryTheory.ObjectProperty From 35c1354ab2449dd004a6a214021e28983455b242 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sun, 21 Sep 2025 14:34:45 +0200 Subject: [PATCH 10/69] feat(CategoryTheory/ObjectProperty): closure under limits --- Mathlib.lean | 2 + .../ClosedUnderIsomorphisms.lean | 4 + .../ObjectProperty/CompleteLattice.lean | 75 ++++++++++++ .../ObjectProperty/LimitsClosure.lean | 114 ++++++++++++++++++ 4 files changed, 195 insertions(+) create mode 100644 Mathlib/CategoryTheory/ObjectProperty/CompleteLattice.lean create mode 100644 Mathlib/CategoryTheory/ObjectProperty/LimitsClosure.lean diff --git a/Mathlib.lean b/Mathlib.lean index 5cd709def4c44b..93127658f1c77f 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -2633,11 +2633,13 @@ import Mathlib.CategoryTheory.Noetherian import Mathlib.CategoryTheory.ObjectProperty.Basic import Mathlib.CategoryTheory.ObjectProperty.ClosedUnderIsomorphisms import Mathlib.CategoryTheory.ObjectProperty.ColimitsOfShape +import Mathlib.CategoryTheory.ObjectProperty.CompleteLattice import Mathlib.CategoryTheory.ObjectProperty.ContainsZero import Mathlib.CategoryTheory.ObjectProperty.EpiMono import Mathlib.CategoryTheory.ObjectProperty.Extensions import Mathlib.CategoryTheory.ObjectProperty.FullSubcategory import Mathlib.CategoryTheory.ObjectProperty.Ind +import Mathlib.CategoryTheory.ObjectProperty.LimitsClosure import Mathlib.CategoryTheory.ObjectProperty.LimitsOfShape import Mathlib.CategoryTheory.ObjectProperty.Shift import Mathlib.CategoryTheory.ObjectProperty.Small diff --git a/Mathlib/CategoryTheory/ObjectProperty/ClosedUnderIsomorphisms.lean b/Mathlib/CategoryTheory/ObjectProperty/ClosedUnderIsomorphisms.lean index b3119203920c5c..63c33f6e234eda 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/ClosedUnderIsomorphisms.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/ClosedUnderIsomorphisms.lean @@ -74,6 +74,10 @@ instance : IsClosedUnderIsomorphisms (isoClosure P) where rintro X Y e ⟨Z, hZ, ⟨f⟩⟩ exact ⟨Z, hZ, ⟨e.symm.trans f⟩⟩ +lemma isClosedUnderIsomorphisms_iff_isoClosure_eq_self : + IsClosedUnderIsomorphisms P ↔ isoClosure P = P := + ⟨fun _ ↦ isoClosure_eq_self _, fun h ↦ by rw [← h]; infer_instance⟩ + instance (F : C ⥤ D) : IsClosedUnderIsomorphisms (P.map F) where of_iso := by rintro _ _ e ⟨X, hX, ⟨e'⟩⟩ diff --git a/Mathlib/CategoryTheory/ObjectProperty/CompleteLattice.lean b/Mathlib/CategoryTheory/ObjectProperty/CompleteLattice.lean new file mode 100644 index 00000000000000..4009739895be12 --- /dev/null +++ b/Mathlib/CategoryTheory/ObjectProperty/CompleteLattice.lean @@ -0,0 +1,75 @@ +/- +Copyright (c) 2025 Joël Riou. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Joël Riou +-/ +import Mathlib.CategoryTheory.ObjectProperty.ClosedUnderIsomorphisms +import Mathlib.Order.CompleteLattice.Basic + +/-! +# ObjectProperty is a complete lattice + +-/ + +universe v u + +namespace CategoryTheory.ObjectProperty + +variable {C : Type u} [Category.{v} C] + +example : CompleteLattice (ObjectProperty C) := inferInstance + +section + +variable (P Q : ObjectProperty C) (X : C) + +@[simp high] lemma prop_inf_iff : (P ⊓ Q) X ↔ P X ∧ Q X := Iff.rfl + +@[simp high] lemma prop_sup_iff : (P ⊔ Q) X ↔ P X ∨ Q X := Iff.rfl + +lemma isoClosure_sup : (P ⊔ Q).isoClosure = P.isoClosure ⊔ Q.isoClosure := by + ext X + simp only [prop_sup_iff] + constructor + · rintro ⟨Y, hY, ⟨e⟩⟩ + simp only [prop_sup_iff] at hY + obtain hY | hY := hY + · exact Or.inl ⟨Y, hY, ⟨e⟩⟩ + · exact Or.inr ⟨Y, hY, ⟨e⟩⟩ + · rintro (hY | hY) + · exact monotone_isoClosure le_sup_left _ hY + · exact monotone_isoClosure le_sup_right _ hY + +instance [P.IsClosedUnderIsomorphisms] [Q.IsClosedUnderIsomorphisms] : + (P ⊔ Q).IsClosedUnderIsomorphisms := by + simp only [isClosedUnderIsomorphisms_iff_isoClosure_eq_self, isoClosure_sup, isoClosure_eq_self] + +end + +section + +variable {α : Sort*} (P : α → ObjectProperty C) (X : C) + +@[simp high] lemma prop_iSup_iff : + (⨆ (a : α), P a) X ↔ ∃ (a : α), P a X := by simp + +lemma isoClosure_iSup : + ((⨆ (a : α), P a)).isoClosure = ⨆ (a : α), (P a).isoClosure := by + refine le_antisymm ?_ ?_ + · rintro X ⟨Y, hY, ⟨e⟩⟩ + simp only [prop_iSup_iff] at hY ⊢ + obtain ⟨a, hY⟩ := hY + exact ⟨a, _, hY, ⟨e⟩⟩ + · simp only [iSup_le_iff] + intro a + rw [isoClosure_le_iff] + exact (le_iSup P a).trans (le_isoClosure _) + +instance [∀ a, (P a).IsClosedUnderIsomorphisms] : + ((⨆ (a : α), P a)).IsClosedUnderIsomorphisms := by + simp only [isClosedUnderIsomorphisms_iff_isoClosure_eq_self, + isoClosure_iSup, isoClosure_eq_self] + +end + +end CategoryTheory.ObjectProperty diff --git a/Mathlib/CategoryTheory/ObjectProperty/LimitsClosure.lean b/Mathlib/CategoryTheory/ObjectProperty/LimitsClosure.lean new file mode 100644 index 00000000000000..564547f432c717 --- /dev/null +++ b/Mathlib/CategoryTheory/ObjectProperty/LimitsClosure.lean @@ -0,0 +1,114 @@ +/- +Copyright (c) 2025 Joël Riou. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Joël Riou +-/ +import Mathlib.CategoryTheory.ObjectProperty.LimitsOfShape +import Mathlib.CategoryTheory.ObjectProperty.CompleteLattice +import Mathlib.Order.TransfiniteIteration + +/-! +# Closure of a property of objects under limits of certain shapes + +-/ +universe w t v' u' v u + +namespace CategoryTheory.ObjectProperty + +open Limits + +variable {C : Type u} [Category.{v} C] (P : ObjectProperty C) + {α : Type t} (J : α → Type u') [∀ a, Category.{v'} (J a)] + +/-- Given `P : ObjectProperty C` and a family of categories `J : α → Type _`, +this property objects contains `P` and all objects that are equal to `lim F` +for some functor `F : J a ⥤ C` such that `F.obj j` satisfies `P` for any `j`. -/ +def strictLimitClosureStep : ObjectProperty C := + P ⊔ (⨆ (a : α), P.strictLimitsOfShape (J a)) + +@[simp] +lemma le_strictLimitClosureStep : P ≤ P.strictLimitClosureStep J := le_sup_left + +variable {P} in +lemma strictLimitClosureStep_monotone {Q : ObjectProperty C} (h : P ≤ Q) : + P.strictLimitClosureStep J ≤ Q.strictLimitClosureStep J := by + dsimp [strictLimitClosureStep] + simp only [sup_le_iff, iSup_le_iff] + exact ⟨h.trans le_sup_left, fun a ↦ (strictLimitsOfShape_monotone (J a) h).trans + (le_trans (by rfl) ((le_iSup _ a).trans le_sup_right))⟩ + +/-- Given `P : ObjectProperty C` and a family of categories `J : α → Type _`, +this property objects contains `P.isoClosure` and all objects that are isomorphic to `lim F` +for some functor `F : J a ⥤ C` such that `F.obj j` satisfies `P` for any `j`. -/ +def limitClosureStep : ObjectProperty C := + P.isoClosure ⊔ (⨆ (a : α), P.limitsOfShape (J a)) + +@[simp] +lemma isoClosure_le_limitClosureStep : P.isoClosure ≤ P.limitClosureStep J := le_sup_left + +@[simp] +lemma le_limitClosureStep : P ≤ P.limitClosureStep J := + (le_isoClosure P).trans (P.isoClosure_le_limitClosureStep J) + +variable {P} in +lemma limitClosureStep_monotone {Q : ObjectProperty C} (h : P ≤ Q) : + P.limitClosureStep J ≤ Q.limitClosureStep J := by + dsimp [limitClosureStep] + simp only [sup_le_iff, iSup_le_iff] + exact ⟨(monotone_isoClosure h).trans le_sup_left, fun a ↦ (limitsOfShape_monotone (J a) h).trans + (le_trans (by rfl) ((le_iSup _ a).trans le_sup_right))⟩ + +instance : (P.limitClosureStep J).IsClosedUnderIsomorphisms := by + dsimp [limitClosureStep] + infer_instance + +@[simp] +lemma isoClosure_strictLimitClosureStep : + (P.strictLimitClosureStep J).isoClosure = P.limitClosureStep J := by + simp [limitClosureStep, strictLimitClosureStep, isoClosure_sup, isoClosure_iSup] + +@[simp] +lemma limitClosureStep_isoClosure : + P.isoClosure.limitClosureStep J = P.limitClosureStep J := by + refine le_antisymm ?_ (limitClosureStep_monotone _ (P.le_isoClosure)) + simp [limitClosureStep, isoClosure_eq_self] + +section + +variable {β : Type w} [LinearOrder β] [OrderBot β] [SuccOrder β] [WellFoundedLT β] + +/-- Given `P : ObjectProperty C`, a family of categories `J a`, this +is the transfinite iteration of `Q ↦ Q.strictLimitClosureStep J`. -/ +abbrev strictLimitClosureIter (b : β) : ObjectProperty C := + transfiniteIterate (φ := fun Q ↦ Q.strictLimitClosureStep J) b P + +/-- Given `P : ObjectProperty C`, a family of categories `J a`, this +is the transfinite iteration of `Q ↦ Q.limitClosureStep J`. -/ +abbrev limitClosureIter (b : β) : ObjectProperty C := + transfiniteIterate (φ := fun Q ↦ Q.limitClosureStep J) b P.isoClosure + +@[simp] +lemma isoClosure_strictLimitClosureIter (b : β) : + (P.strictLimitClosureIter J b).isoClosure = P.limitClosureIter J b := by + induction b using SuccOrder.limitRecOn with + | isMin b hb => + obtain rfl := hb.eq_bot + simp + | succ b hb hb' => + dsimp [strictLimitClosureIter, limitClosureIter] at hb' ⊢ + rw [transfiniteIterate_succ _ _ _ hb, transfiniteIterate_succ _ _ _ hb, ← hb', + isoClosure_strictLimitClosureStep, limitClosureStep_isoClosure] + | isSuccLimit b hb hb' => + dsimp [strictLimitClosureIter, limitClosureIter] at hb' ⊢ + rw [transfiniteIterate_limit _ _ _ hb, transfiniteIterate_limit _ _ _ hb, isoClosure_iSup] + congr + ext ⟨c, hc⟩ : 1 + exact hb' c hc + +instance (b : β) : (P.limitClosureIter J b).IsClosedUnderIsomorphisms := by + rw [← isoClosure_strictLimitClosureIter] + infer_instance + +end + +end CategoryTheory.ObjectProperty From 581970c62aa4a228b0ea6630e49ff288d0a03017 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sun, 21 Sep 2025 15:27:55 +0200 Subject: [PATCH 11/69] typo --- .../ObjectProperty/LimitsClosure.lean | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/Mathlib/CategoryTheory/ObjectProperty/LimitsClosure.lean b/Mathlib/CategoryTheory/ObjectProperty/LimitsClosure.lean index 564547f432c717..4113cfd97163e5 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/LimitsClosure.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/LimitsClosure.lean @@ -23,16 +23,16 @@ variable {C : Type u} [Category.{v} C] (P : ObjectProperty C) /-- Given `P : ObjectProperty C` and a family of categories `J : α → Type _`, this property objects contains `P` and all objects that are equal to `lim F` for some functor `F : J a ⥤ C` such that `F.obj j` satisfies `P` for any `j`. -/ -def strictLimitClosureStep : ObjectProperty C := +def strictLimitsClosureStep : ObjectProperty C := P ⊔ (⨆ (a : α), P.strictLimitsOfShape (J a)) @[simp] -lemma le_strictLimitClosureStep : P ≤ P.strictLimitClosureStep J := le_sup_left +lemma le_strictLimitsClosureStep : P ≤ P.strictLimitsClosureStep J := le_sup_left variable {P} in -lemma strictLimitClosureStep_monotone {Q : ObjectProperty C} (h : P ≤ Q) : - P.strictLimitClosureStep J ≤ Q.strictLimitClosureStep J := by - dsimp [strictLimitClosureStep] +lemma strictLimitsClosureStep_monotone {Q : ObjectProperty C} (h : P ≤ Q) : + P.strictLimitsClosureStep J ≤ Q.strictLimitsClosureStep J := by + dsimp [strictLimitsClosureStep] simp only [sup_le_iff, iSup_le_iff] exact ⟨h.trans le_sup_left, fun a ↦ (strictLimitsOfShape_monotone (J a) h).trans (le_trans (by rfl) ((le_iSup _ a).trans le_sup_right))⟩ @@ -63,9 +63,9 @@ instance : (P.limitClosureStep J).IsClosedUnderIsomorphisms := by infer_instance @[simp] -lemma isoClosure_strictLimitClosureStep : - (P.strictLimitClosureStep J).isoClosure = P.limitClosureStep J := by - simp [limitClosureStep, strictLimitClosureStep, isoClosure_sup, isoClosure_iSup] +lemma isoClosure_strictLimitsClosureStep : + (P.strictLimitsClosureStep J).isoClosure = P.limitClosureStep J := by + simp [limitClosureStep, strictLimitsClosureStep, isoClosure_sup, isoClosure_iSup] @[simp] lemma limitClosureStep_isoClosure : @@ -78,9 +78,9 @@ section variable {β : Type w} [LinearOrder β] [OrderBot β] [SuccOrder β] [WellFoundedLT β] /-- Given `P : ObjectProperty C`, a family of categories `J a`, this -is the transfinite iteration of `Q ↦ Q.strictLimitClosureStep J`. -/ -abbrev strictLimitClosureIter (b : β) : ObjectProperty C := - transfiniteIterate (φ := fun Q ↦ Q.strictLimitClosureStep J) b P +is the transfinite iteration of `Q ↦ Q.strictLimitsClosureStep J`. -/ +abbrev strictLimitsClosureIter (b : β) : ObjectProperty C := + transfiniteIterate (φ := fun Q ↦ Q.strictLimitsClosureStep J) b P /-- Given `P : ObjectProperty C`, a family of categories `J a`, this is the transfinite iteration of `Q ↦ Q.limitClosureStep J`. -/ @@ -88,25 +88,25 @@ abbrev limitClosureIter (b : β) : ObjectProperty C := transfiniteIterate (φ := fun Q ↦ Q.limitClosureStep J) b P.isoClosure @[simp] -lemma isoClosure_strictLimitClosureIter (b : β) : - (P.strictLimitClosureIter J b).isoClosure = P.limitClosureIter J b := by +lemma isoClosure_strictLimitsClosureIter (b : β) : + (P.strictLimitsClosureIter J b).isoClosure = P.limitClosureIter J b := by induction b using SuccOrder.limitRecOn with | isMin b hb => obtain rfl := hb.eq_bot simp | succ b hb hb' => - dsimp [strictLimitClosureIter, limitClosureIter] at hb' ⊢ + dsimp [strictLimitsClosureIter, limitClosureIter] at hb' ⊢ rw [transfiniteIterate_succ _ _ _ hb, transfiniteIterate_succ _ _ _ hb, ← hb', - isoClosure_strictLimitClosureStep, limitClosureStep_isoClosure] + isoClosure_strictLimitsClosureStep, limitClosureStep_isoClosure] | isSuccLimit b hb hb' => - dsimp [strictLimitClosureIter, limitClosureIter] at hb' ⊢ + dsimp [strictLimitsClosureIter, limitClosureIter] at hb' ⊢ rw [transfiniteIterate_limit _ _ _ hb, transfiniteIterate_limit _ _ _ hb, isoClosure_iSup] congr ext ⟨c, hc⟩ : 1 exact hb' c hc instance (b : β) : (P.limitClosureIter J b).IsClosedUnderIsomorphisms := by - rw [← isoClosure_strictLimitClosureIter] + rw [← isoClosure_strictLimitsClosureIter] infer_instance end From 6b20d72bdea4eeed0fed23b775ac2fcbb0fb6e06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sun, 21 Sep 2025 16:17:27 +0200 Subject: [PATCH 12/69] wip --- .../ObjectProperty/LimitsClosure.lean | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/Mathlib/CategoryTheory/ObjectProperty/LimitsClosure.lean b/Mathlib/CategoryTheory/ObjectProperty/LimitsClosure.lean index 4113cfd97163e5..bd155809b42728 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/LimitsClosure.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/LimitsClosure.lean @@ -111,4 +111,33 @@ instance (b : β) : (P.limitClosureIter J b).IsClosedUnderIsomorphisms := by end +-- TODO: remove the variable `b` and keep only `κ` +lemma strictLimitsClosureStep_strictLimitsClosureIter_eq_self + (b : Ordinal.{u'}) (κ : Cardinal.{u'}) (hκ : κ.IsRegular) + (hb : κ ≤ b.cof) (h : ∀ (a : α), HasCardinalLT (J a) κ) : + (P.strictLimitsClosureIter J b).strictLimitsClosureStep J = + (P.strictLimitsClosureIter J b) := by + have hb' : Order.IsSuccLimit b := Ordinal.aleph0_le_cof.1 ((hκ.aleph0_le).trans hb) + refine le_antisymm ?_ (le_of_le_of_eq (monotone_transfiniteIterate _ _ + (fun Q ↦ Q.le_strictLimitsClosureStep J) (Order.le_succ b)) + (transfiniteIterate_succ _ _ _ (by simp))) + intro X hX + simp only [strictLimitsClosureStep, prop_sup_iff, prop_iSup_iff] at hX + obtain (hX | ⟨a, F, hF⟩) := hX + · exact hX + · simp only [strictLimitsClosureIter, transfiniteIterate_limit _ _ _ hb', + prop_iSup_iff, Subtype.exists, Set.mem_Iio, exists_prop] at hF + choose o ho ho' using hF + obtain ⟨m, hm, hm'⟩ : ∃ (m : Ordinal.{u'}) (hm : m < b), ∀ (j : J a), o j ≤ m := + ⟨⨆ j, o j, Ordinal.iSup_lt_ord + (lt_of_lt_of_le ((hasCardinalLT_iff_cardinal_mk_lt _ _).1 (h a)) hb) ho, + le_ciSup (Ordinal.bddAbove_range _)⟩ + refine monotone_transfiniteIterate _ _ + (fun (Q : ObjectProperty C) ↦ Q.le_strictLimitsClosureStep J) (Order.succ_le_iff.2 hm) _ ?_ + dsimp + rw [transfiniteIterate_succ _ _ _ (by simp)] + simp only [strictLimitsClosureStep, prop_sup_iff, prop_iSup_iff] + exact Or.inr ⟨a, ⟨_, fun j ↦ monotone_transfiniteIterate _ _ + (fun (Q : ObjectProperty C) ↦ Q.le_strictLimitsClosureStep J) (hm' j) _ (ho' j)⟩⟩ + end CategoryTheory.ObjectProperty From b5c6c94a3a18145a33fdabc31a0920fbb2d492a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sun, 21 Sep 2025 16:36:48 +0200 Subject: [PATCH 13/69] wip --- .../ObjectProperty/LimitsClosure.lean | 88 +++++++++++-------- 1 file changed, 50 insertions(+), 38 deletions(-) diff --git a/Mathlib/CategoryTheory/ObjectProperty/LimitsClosure.lean b/Mathlib/CategoryTheory/ObjectProperty/LimitsClosure.lean index bd155809b42728..203f83645788bc 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/LimitsClosure.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/LimitsClosure.lean @@ -40,38 +40,38 @@ lemma strictLimitsClosureStep_monotone {Q : ObjectProperty C} (h : P ≤ Q) : /-- Given `P : ObjectProperty C` and a family of categories `J : α → Type _`, this property objects contains `P.isoClosure` and all objects that are isomorphic to `lim F` for some functor `F : J a ⥤ C` such that `F.obj j` satisfies `P` for any `j`. -/ -def limitClosureStep : ObjectProperty C := +def limitsClosureStep : ObjectProperty C := P.isoClosure ⊔ (⨆ (a : α), P.limitsOfShape (J a)) @[simp] -lemma isoClosure_le_limitClosureStep : P.isoClosure ≤ P.limitClosureStep J := le_sup_left +lemma isoClosure_le_limitsClosureStep : P.isoClosure ≤ P.limitsClosureStep J := le_sup_left @[simp] -lemma le_limitClosureStep : P ≤ P.limitClosureStep J := - (le_isoClosure P).trans (P.isoClosure_le_limitClosureStep J) +lemma le_limitsClosureStep : P ≤ P.limitsClosureStep J := + (le_isoClosure P).trans (P.isoClosure_le_limitsClosureStep J) variable {P} in -lemma limitClosureStep_monotone {Q : ObjectProperty C} (h : P ≤ Q) : - P.limitClosureStep J ≤ Q.limitClosureStep J := by - dsimp [limitClosureStep] +lemma limitsClosureStep_monotone {Q : ObjectProperty C} (h : P ≤ Q) : + P.limitsClosureStep J ≤ Q.limitsClosureStep J := by + dsimp [limitsClosureStep] simp only [sup_le_iff, iSup_le_iff] exact ⟨(monotone_isoClosure h).trans le_sup_left, fun a ↦ (limitsOfShape_monotone (J a) h).trans (le_trans (by rfl) ((le_iSup _ a).trans le_sup_right))⟩ -instance : (P.limitClosureStep J).IsClosedUnderIsomorphisms := by - dsimp [limitClosureStep] +instance : (P.limitsClosureStep J).IsClosedUnderIsomorphisms := by + dsimp [limitsClosureStep] infer_instance @[simp] lemma isoClosure_strictLimitsClosureStep : - (P.strictLimitsClosureStep J).isoClosure = P.limitClosureStep J := by - simp [limitClosureStep, strictLimitsClosureStep, isoClosure_sup, isoClosure_iSup] + (P.strictLimitsClosureStep J).isoClosure = P.limitsClosureStep J := by + simp [limitsClosureStep, strictLimitsClosureStep, isoClosure_sup, isoClosure_iSup] @[simp] -lemma limitClosureStep_isoClosure : - P.isoClosure.limitClosureStep J = P.limitClosureStep J := by - refine le_antisymm ?_ (limitClosureStep_monotone _ (P.le_isoClosure)) - simp [limitClosureStep, isoClosure_eq_self] +lemma limitsClosureStep_isoClosure : + P.isoClosure.limitsClosureStep J = P.limitsClosureStep J := by + refine le_antisymm ?_ (limitsClosureStep_monotone _ (P.le_isoClosure)) + simp [limitsClosureStep, isoClosure_eq_self] section @@ -83,54 +83,55 @@ abbrev strictLimitsClosureIter (b : β) : ObjectProperty C := transfiniteIterate (φ := fun Q ↦ Q.strictLimitsClosureStep J) b P /-- Given `P : ObjectProperty C`, a family of categories `J a`, this -is the transfinite iteration of `Q ↦ Q.limitClosureStep J`. -/ -abbrev limitClosureIter (b : β) : ObjectProperty C := - transfiniteIterate (φ := fun Q ↦ Q.limitClosureStep J) b P.isoClosure +is the transfinite iteration of `Q ↦ Q.limitsClosureStep J`. -/ +abbrev limitsClosureIter (b : β) : ObjectProperty C := + transfiniteIterate (φ := fun Q ↦ Q.limitsClosureStep J) b P.isoClosure @[simp] lemma isoClosure_strictLimitsClosureIter (b : β) : - (P.strictLimitsClosureIter J b).isoClosure = P.limitClosureIter J b := by + (P.strictLimitsClosureIter J b).isoClosure = P.limitsClosureIter J b := by induction b using SuccOrder.limitRecOn with | isMin b hb => obtain rfl := hb.eq_bot simp | succ b hb hb' => - dsimp [strictLimitsClosureIter, limitClosureIter] at hb' ⊢ + dsimp [strictLimitsClosureIter, limitsClosureIter] at hb' ⊢ rw [transfiniteIterate_succ _ _ _ hb, transfiniteIterate_succ _ _ _ hb, ← hb', - isoClosure_strictLimitsClosureStep, limitClosureStep_isoClosure] + isoClosure_strictLimitsClosureStep, limitsClosureStep_isoClosure] | isSuccLimit b hb hb' => - dsimp [strictLimitsClosureIter, limitClosureIter] at hb' ⊢ + dsimp [strictLimitsClosureIter, limitsClosureIter] at hb' ⊢ rw [transfiniteIterate_limit _ _ _ hb, transfiniteIterate_limit _ _ _ hb, isoClosure_iSup] congr ext ⟨c, hc⟩ : 1 exact hb' c hc -instance (b : β) : (P.limitClosureIter J b).IsClosedUnderIsomorphisms := by +instance (b : β) : (P.limitsClosureIter J b).IsClosedUnderIsomorphisms := by rw [← isoClosure_strictLimitsClosureIter] infer_instance end --- TODO: remove the variable `b` and keep only `κ` -lemma strictLimitsClosureStep_strictLimitsClosureIter_eq_self - (b : Ordinal.{u'}) (κ : Cardinal.{u'}) (hκ : κ.IsRegular) - (hb : κ ≤ b.cof) (h : ∀ (a : α), HasCardinalLT (J a) κ) : - (P.strictLimitsClosureIter J b).strictLimitsClosureStep J = - (P.strictLimitsClosureIter J b) := by - have hb' : Order.IsSuccLimit b := Ordinal.aleph0_le_cof.1 ((hκ.aleph0_le).trans hb) - refine le_antisymm ?_ (le_of_le_of_eq (monotone_transfiniteIterate _ _ - (fun Q ↦ Q.le_strictLimitsClosureStep J) (Order.le_succ b)) - (transfiniteIterate_succ _ _ _ (by simp))) - intro X hX +section + +variable (κ : Cardinal.{u'}) [Fact κ.IsRegular] (h : ∀ (a : α), HasCardinalLT (J a) κ) + +include h + +lemma strictLimitsClosureStep_strictLimitsClosureIter_eq_self : + (P.strictLimitsClosureIter J κ.ord).strictLimitsClosureStep J = + (P.strictLimitsClosureIter J κ.ord) := by + have hκ : κ.IsRegular := Fact.out + refine le_antisymm (fun X hX ↦ ?_) (le_strictLimitsClosureStep _ _) simp only [strictLimitsClosureStep, prop_sup_iff, prop_iSup_iff] at hX obtain (hX | ⟨a, F, hF⟩) := hX · exact hX - · simp only [strictLimitsClosureIter, transfiniteIterate_limit _ _ _ hb', - prop_iSup_iff, Subtype.exists, Set.mem_Iio, exists_prop] at hF + · simp only [strictLimitsClosureIter, transfiniteIterate_limit _ _ _ + (Cardinal.isSuccLimit_ord hκ.aleph0_le), prop_iSup_iff, + Subtype.exists, Set.mem_Iio, exists_prop] at hF choose o ho ho' using hF - obtain ⟨m, hm, hm'⟩ : ∃ (m : Ordinal.{u'}) (hm : m < b), ∀ (j : J a), o j ≤ m := + obtain ⟨m, hm, hm'⟩ : ∃ (m : Ordinal.{u'}) (hm : m < κ.ord), ∀ (j : J a), o j ≤ m := ⟨⨆ j, o j, Ordinal.iSup_lt_ord - (lt_of_lt_of_le ((hasCardinalLT_iff_cardinal_mk_lt _ _).1 (h a)) hb) ho, + (lt_of_lt_of_eq ((hasCardinalLT_iff_cardinal_mk_lt _ _).1 (h a)) hκ.cof_eq.symm) ho, le_ciSup (Ordinal.bddAbove_range _)⟩ refine monotone_transfiniteIterate _ _ (fun (Q : ObjectProperty C) ↦ Q.le_strictLimitsClosureStep J) (Order.succ_le_iff.2 hm) _ ?_ @@ -140,4 +141,15 @@ lemma strictLimitsClosureStep_strictLimitsClosureIter_eq_self exact Or.inr ⟨a, ⟨_, fun j ↦ monotone_transfiniteIterate _ _ (fun (Q : ObjectProperty C) ↦ Q.le_strictLimitsClosureStep J) (hm' j) _ (ho' j)⟩⟩ +lemma limitsClosureStep_limitsClosureIter_eq_self : + (P.limitsClosureIter J κ.ord).limitsClosureStep J = + (P.limitsClosureIter J κ.ord) := by + refine le_antisymm ?_ (le_limitsClosureStep _ _) + conv_rhs => rw [← isoClosure_strictLimitsClosureIter, + ← P.strictLimitsClosureStep_strictLimitsClosureIter_eq_self J κ h] + rw [isoClosure_strictLimitsClosureStep, ← isoClosure_strictLimitsClosureIter, + limitsClosureStep_isoClosure] + +end + end CategoryTheory.ObjectProperty From 54e8d017ea2bf82a38cddc041ddbd453d72b9a5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Mon, 22 Sep 2025 06:56:26 +0200 Subject: [PATCH 14/69] wip --- .../ObjectProperty/LimitsClosure.lean | 119 +++++++++--------- 1 file changed, 56 insertions(+), 63 deletions(-) diff --git a/Mathlib/CategoryTheory/ObjectProperty/LimitsClosure.lean b/Mathlib/CategoryTheory/ObjectProperty/LimitsClosure.lean index 203f83645788bc..67b2d8b1cc39c7 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/LimitsClosure.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/LimitsClosure.lean @@ -20,6 +20,37 @@ open Limits variable {C : Type u} [Category.{v} C] (P : ObjectProperty C) {α : Type t} (J : α → Type u') [∀ a, Category.{v'} (J a)] +/-- The closure of property of objects of a category under limits of +shape `J a` for a family of categories `J`. -/ +inductive limitsClosure : ObjectProperty C + | of_mem (X : C) (hX : P X) : limitsClosure X + | of_isoClosure {X Y : C} (e : X ≅ Y) (hX : limitsClosure X) : limitsClosure Y + | of_limitPresentation {X : C} {a : α} (pres : LimitPresentation (J a) X) + (h : ∀ j, limitsClosure (pres.diag.obj j)) : limitsClosure X + +@[simp] +lemma le_limitsClosure : P ≤ P.limitsClosure J := + fun X hX ↦ .of_mem X hX + +instance : (P.limitsClosure J).IsClosedUnderIsomorphisms where + of_iso e hX := .of_isoClosure e hX + +lemma limitsOfShape_limitsClosure (a : α) : + (P.limitsClosure J).limitsOfShape (J a) ≤ P.limitsClosure J := by + rintro X ⟨hX⟩ + exact .of_limitPresentation hX.toLimitPresentation hX.prop_diag_obj + +variable {P J} in +lemma limitsClosure_le {Q : ObjectProperty C} [Q.IsClosedUnderIsomorphisms] + (h₁ : P ≤ Q) (h₂ : ∀ (a : α), Q.limitsOfShape (J a) ≤ Q) : + P.limitsClosure J ≤ Q := by + intro X hX + induction hX with + | of_mem X hX => exact h₁ _ hX + | of_isoClosure e hX hX' => exact Q.prop_of_iso e hX' + | of_limitPresentation pres h h' => + exact h₂ _ _ ⟨{ toLimitPresentation := pres, prop_diag_obj := h' }⟩ + /-- Given `P : ObjectProperty C` and a family of categories `J : α → Type _`, this property objects contains `P` and all objects that are equal to `lim F` for some functor `F : J a ⥤ C` such that `F.obj j` satisfies `P` for any `j`. -/ @@ -37,42 +68,6 @@ lemma strictLimitsClosureStep_monotone {Q : ObjectProperty C} (h : P ≤ Q) : exact ⟨h.trans le_sup_left, fun a ↦ (strictLimitsOfShape_monotone (J a) h).trans (le_trans (by rfl) ((le_iSup _ a).trans le_sup_right))⟩ -/-- Given `P : ObjectProperty C` and a family of categories `J : α → Type _`, -this property objects contains `P.isoClosure` and all objects that are isomorphic to `lim F` -for some functor `F : J a ⥤ C` such that `F.obj j` satisfies `P` for any `j`. -/ -def limitsClosureStep : ObjectProperty C := - P.isoClosure ⊔ (⨆ (a : α), P.limitsOfShape (J a)) - -@[simp] -lemma isoClosure_le_limitsClosureStep : P.isoClosure ≤ P.limitsClosureStep J := le_sup_left - -@[simp] -lemma le_limitsClosureStep : P ≤ P.limitsClosureStep J := - (le_isoClosure P).trans (P.isoClosure_le_limitsClosureStep J) - -variable {P} in -lemma limitsClosureStep_monotone {Q : ObjectProperty C} (h : P ≤ Q) : - P.limitsClosureStep J ≤ Q.limitsClosureStep J := by - dsimp [limitsClosureStep] - simp only [sup_le_iff, iSup_le_iff] - exact ⟨(monotone_isoClosure h).trans le_sup_left, fun a ↦ (limitsOfShape_monotone (J a) h).trans - (le_trans (by rfl) ((le_iSup _ a).trans le_sup_right))⟩ - -instance : (P.limitsClosureStep J).IsClosedUnderIsomorphisms := by - dsimp [limitsClosureStep] - infer_instance - -@[simp] -lemma isoClosure_strictLimitsClosureStep : - (P.strictLimitsClosureStep J).isoClosure = P.limitsClosureStep J := by - simp [limitsClosureStep, strictLimitsClosureStep, isoClosure_sup, isoClosure_iSup] - -@[simp] -lemma limitsClosureStep_isoClosure : - P.isoClosure.limitsClosureStep J = P.limitsClosureStep J := by - refine le_antisymm ?_ (limitsClosureStep_monotone _ (P.le_isoClosure)) - simp [limitsClosureStep, isoClosure_eq_self] - section variable {β : Type w} [LinearOrder β] [OrderBot β] [SuccOrder β] [WellFoundedLT β] @@ -82,32 +77,27 @@ is the transfinite iteration of `Q ↦ Q.strictLimitsClosureStep J`. -/ abbrev strictLimitsClosureIter (b : β) : ObjectProperty C := transfiniteIterate (φ := fun Q ↦ Q.strictLimitsClosureStep J) b P -/-- Given `P : ObjectProperty C`, a family of categories `J a`, this -is the transfinite iteration of `Q ↦ Q.limitsClosureStep J`. -/ -abbrev limitsClosureIter (b : β) : ObjectProperty C := - transfiniteIterate (φ := fun Q ↦ Q.limitsClosureStep J) b P.isoClosure +lemma le_strictLimitsClosureIter (b : β) : + P ≤ P.strictLimitsClosureIter J b := + le_of_eq_of_le (transfiniteIterate_bot _ _).symm + (monotone_transfiniteIterate _ _ (fun _ ↦ le_strictLimitsClosureStep _ _) bot_le) -@[simp] -lemma isoClosure_strictLimitsClosureIter (b : β) : - (P.strictLimitsClosureIter J b).isoClosure = P.limitsClosureIter J b := by +lemma strictLimitsClosureIter_le_limitsClosure (b : β) : + P.strictLimitsClosureIter J b ≤ P.limitsClosure J := by induction b using SuccOrder.limitRecOn with | isMin b hb => obtain rfl := hb.eq_bot simp | succ b hb hb' => - dsimp [strictLimitsClosureIter, limitsClosureIter] at hb' ⊢ - rw [transfiniteIterate_succ _ _ _ hb, transfiniteIterate_succ _ _ _ hb, ← hb', - isoClosure_strictLimitsClosureStep, limitsClosureStep_isoClosure] + rw [strictLimitsClosureIter, transfiniteIterate_succ _ _ _ hb, + strictLimitsClosureStep, sup_le_iff, iSup_le_iff] + exact ⟨hb', fun a ↦ ((strictLimitsOfShape_le_limitsOfShape _ _).trans + (limitsOfShape_monotone _ hb')).trans (P.limitsOfShape_limitsClosure J a)⟩ | isSuccLimit b hb hb' => - dsimp [strictLimitsClosureIter, limitsClosureIter] at hb' ⊢ - rw [transfiniteIterate_limit _ _ _ hb, transfiniteIterate_limit _ _ _ hb, isoClosure_iSup] - congr - ext ⟨c, hc⟩ : 1 - exact hb' c hc - -instance (b : β) : (P.limitsClosureIter J b).IsClosedUnderIsomorphisms := by - rw [← isoClosure_strictLimitsClosureIter] - infer_instance + simp only [transfiniteIterate_limit _ _ _ hb, + iSup_le_iff, Subtype.forall, Set.mem_Iio] + intro c hc + exact hb' _ hc end @@ -141,14 +131,17 @@ lemma strictLimitsClosureStep_strictLimitsClosureIter_eq_self : exact Or.inr ⟨a, ⟨_, fun j ↦ monotone_transfiniteIterate _ _ (fun (Q : ObjectProperty C) ↦ Q.le_strictLimitsClosureStep J) (hm' j) _ (ho' j)⟩⟩ -lemma limitsClosureStep_limitsClosureIter_eq_self : - (P.limitsClosureIter J κ.ord).limitsClosureStep J = - (P.limitsClosureIter J κ.ord) := by - refine le_antisymm ?_ (le_limitsClosureStep _ _) - conv_rhs => rw [← isoClosure_strictLimitsClosureIter, - ← P.strictLimitsClosureStep_strictLimitsClosureIter_eq_self J κ h] - rw [isoClosure_strictLimitsClosureStep, ← isoClosure_strictLimitsClosureIter, - limitsClosureStep_isoClosure] +lemma isoClosure_strictLimitsClosureIter_eq_limitsClosure : + (P.strictLimitsClosureIter J κ.ord).isoClosure = P.limitsClosure J := by + refine le_antisymm ?_ ?_ + · rw [isoClosure_le_iff] + exact P.strictLimitsClosureIter_le_limitsClosure J κ.ord + · refine limitsClosure_le + ((P.le_strictLimitsClosureIter J κ.ord).trans (le_isoClosure _)) (fun a ↦ ?_) + conv_rhs => rw [← P.strictLimitsClosureStep_strictLimitsClosureIter_eq_self J κ h] + rw [limitsOfShape_isoClosure, ← isoClosure_strictLimitsOfShape, + strictLimitsClosureStep] + exact monotone_isoClosure ((le_trans (by rfl) (le_iSup _ a)).trans le_sup_right) end From 796f4b0c620eeb181fc3bce4c69b49aaa0116b8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Mon, 22 Sep 2025 07:21:20 +0200 Subject: [PATCH 15/69] wip --- .../ObjectProperty/LimitsOfShape.lean | 5 +++ .../CategoryTheory/ObjectProperty/Small.lean | 38 +++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/Mathlib/CategoryTheory/ObjectProperty/LimitsOfShape.lean b/Mathlib/CategoryTheory/ObjectProperty/LimitsOfShape.lean index 2aa869edfeca3e..76deda06c54406 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/LimitsOfShape.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/LimitsOfShape.lean @@ -142,4 +142,9 @@ instance [ObjectProperty.Small.{w} P] [LocallySmall.{w} C] [Small.{w} J] [Locall rintro ⟨_, ⟨F, hF⟩⟩ exact ⟨⟨P.lift F hF, by assumption⟩, rfl⟩ +instance [ObjectProperty.Small.{w} P] [LocallySmall.{w} C] [Small.{w} J] [LocallySmall.{w} J] : + ObjectProperty.EssentiallySmall.{w} (P.limitsOfShape J) := by + rw [← isoClosure_strictLimitsOfShape] + infer_instance + end CategoryTheory.ObjectProperty diff --git a/Mathlib/CategoryTheory/ObjectProperty/Small.lean b/Mathlib/CategoryTheory/ObjectProperty/Small.lean index cc03da79e5e803..2f920000504d84 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/Small.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/Small.lean @@ -4,6 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.CategoryTheory.ObjectProperty.FullSubcategory +import Mathlib.CategoryTheory.ObjectProperty.CompleteLattice import Mathlib.Logic.Small.Basic /-! @@ -25,4 +26,41 @@ instance (P : ObjectProperty C) [ObjectProperty.Small.{w} P] : Small.{w} P.FullSubcategory := small_of_surjective (f := fun (x : Subtype P) ↦ ⟨x.1, x.2⟩) (fun x ↦ ⟨⟨x.1, x.2⟩, rfl⟩) +lemma small_of_le {P Q : ObjectProperty C} [ObjectProperty.Small.{w} Q] (h : P ≤ Q) : + ObjectProperty.Small.{w} P := + small_of_injective (Subtype.map_injective h Function.injective_id) + +instance {P Q : ObjectProperty C} [ObjectProperty.Small.{w} Q] : + ObjectProperty.Small.{w} (P ⊓ Q) := + small_of_le inf_le_right + +instance {P Q : ObjectProperty C} [ObjectProperty.Small.{w} P] : + ObjectProperty.Small.{w} (P ⊓ Q) := + small_of_le inf_le_left + +protected class EssentiallySmall (P : ObjectProperty C) : Prop where + exists_small_le (P) : ∃ (Q : ObjectProperty C) (_ : ObjectProperty.Small.{w} Q), + P ≤ Q.isoClosure + +instance (P : ObjectProperty C) [ObjectProperty.Small.{w} P] : + ObjectProperty.EssentiallySmall.{w} P where + exists_small_le := ⟨P, inferInstance, le_isoClosure P⟩ + +instance (P : ObjectProperty C) [ObjectProperty.Small.{w} P] : + ObjectProperty.EssentiallySmall.{w} P.isoClosure where + exists_small_le := ⟨P, inferInstance, by rfl⟩ + +lemma EssentiallySmall.exists_small (P : ObjectProperty C) [P.IsClosedUnderIsomorphisms] + [ObjectProperty.EssentiallySmall.{w} P] : + ∃ (P₀ : ObjectProperty C) (_ : ObjectProperty.Small.{w} P₀), P = P₀.isoClosure := by + obtain ⟨Q, _, hQ⟩ := exists_small_le P + refine ⟨Q ⊓ P, inferInstance, le_antisymm ?_ ?_⟩ + · intro X hX + obtain ⟨Y, hY, ⟨e⟩⟩ := hQ _ hX + refine ⟨Y, ?_, ⟨e⟩⟩ + simp only [prop_inf_iff] + exact ⟨hY, P.prop_of_iso e hX⟩ + · conv_rhs => rw [← P.isoClosure_eq_self] + exact monotone_isoClosure inf_le_right + end CategoryTheory.ObjectProperty From d912563651685250215c0362e34a9b625eda2488 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Mon, 22 Sep 2025 11:48:21 +0200 Subject: [PATCH 16/69] wip --- .../ObjectProperty/LimitsClosure.lean | 55 ++++++++++++- .../CategoryTheory/ObjectProperty/Small.lean | 79 ++++++++++++++++--- 2 files changed, 120 insertions(+), 14 deletions(-) diff --git a/Mathlib/CategoryTheory/ObjectProperty/LimitsClosure.lean b/Mathlib/CategoryTheory/ObjectProperty/LimitsClosure.lean index 67b2d8b1cc39c7..3c3758663181d9 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/LimitsClosure.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/LimitsClosure.lean @@ -11,7 +11,7 @@ import Mathlib.Order.TransfiniteIteration # Closure of a property of objects under limits of certain shapes -/ -universe w t v' u' v u +universe w w' t v' u' v u namespace CategoryTheory.ObjectProperty @@ -51,6 +51,20 @@ lemma limitsClosure_le {Q : ObjectProperty C} [Q.IsClosedUnderIsomorphisms] | of_limitPresentation pres h h' => exact h₂ _ _ ⟨{ toLimitPresentation := pres, prop_diag_obj := h' }⟩ +variable {P} in +lemma limitsClosure_monotone {Q : ObjectProperty C} (h : P ≤ Q) : + P.limitsClosure J ≤ Q.limitsClosure J := + limitsClosure_le (h.trans (Q.le_limitsClosure J)) + (fun _ ↦ limitsOfShape_limitsClosure _ _ _) + +lemma limitsClosure_isoClosure : + P.isoClosure.limitsClosure J = P.limitsClosure J := by + refine le_antisymm + (limitsClosure_le ?_ (fun _ ↦ limitsOfShape_limitsClosure _ _ _)) + (limitsClosure_monotone _ P.le_isoClosure) + rw [isoClosure_le_iff] + exact le_limitsClosure P J + /-- Given `P : ObjectProperty C` and a family of categories `J : α → Type _`, this property objects contains `P` and all objects that are equal to `lim F` for some functor `F : J a ⥤ C` such that `F.obj j` satisfies `P` for any `j`. -/ @@ -70,7 +84,7 @@ lemma strictLimitsClosureStep_monotone {Q : ObjectProperty C} (h : P ≤ Q) : section -variable {β : Type w} [LinearOrder β] [OrderBot β] [SuccOrder β] [WellFoundedLT β] +variable {β : Type w'} [LinearOrder β] [OrderBot β] [SuccOrder β] [WellFoundedLT β] /-- Given `P : ObjectProperty C`, a family of categories `J a`, this is the transfinite iteration of `Q ↦ Q.strictLimitsClosureStep J`. -/ @@ -99,10 +113,36 @@ lemma strictLimitsClosureIter_le_limitsClosure (b : β) : intro c hc exact hb' _ hc +instance [ObjectProperty.Small.{w} P] [LocallySmall.{w} C] [Small.{w} α] + [∀ a, Small.{w} (J a)] [∀ a, LocallySmall.{w} (J a)] (b : β) + [hb₀ : Small.{w} (Set.Iio b)] : + ObjectProperty.Small.{w} (P.strictLimitsClosureIter J b) := by + have H {b c : β} (hbc : b ≤ c) [Small.{w} (Set.Iio c)] : Small.{w} (Set.Iio b) := + small_of_injective (f := fun x ↦ (⟨x.1, lt_of_lt_of_le x.2 hbc⟩ : Set.Iio c)) + (fun _ _ _ ↦ by aesop) + induction b using SuccOrder.limitRecOn generalizing hb₀ with + | isMin b hb => + obtain rfl := hb.eq_bot + simp only [transfiniteIterate_bot] + infer_instance + | succ b hb hb' => + have := H (Order.le_succ b) + rw [strictLimitsClosureIter, transfiniteIterate_succ _ _ _ hb, + strictLimitsClosureStep] + infer_instance + | isSuccLimit b hb hb' => + simp only [transfiniteIterate_limit _ _ _ hb] + have (c : Set.Iio b) : ObjectProperty.Small.{w} + (transfiniteIterate (fun Q ↦ Q.strictLimitsClosureStep J) c.1 P) := by + have := H c.2.le + exact hb' c.1 c.2 + infer_instance + end section +-- TODO: improve this so that `u'` is replaced by any `w` variable (κ : Cardinal.{u'}) [Fact κ.IsRegular] (h : ∀ (a : α), HasCardinalLT (J a) κ) include h @@ -143,6 +183,17 @@ lemma isoClosure_strictLimitsClosureIter_eq_limitsClosure : strictLimitsClosureStep] exact monotone_isoClosure ((le_trans (by rfl) (le_iSup _ a)).trans le_sup_right) +lemma isEssentiallySmall_limitsClosure + [ObjectProperty.EssentiallySmall.{u'} P] [LocallySmall.{u'} C] [Small.{u'} α] + [∀ a, Small.{u'} (J a)] [∀ a, LocallySmall.{u'} (J a)] : + ObjectProperty.EssentiallySmall.{u'} (P.limitsClosure J) := by + obtain ⟨Q, hQ, hQ₁, hQ₂⟩ := EssentiallySmall.exists_small_le.{u'} P + have : ObjectProperty.EssentiallySmall.{u'} (Q.isoClosure.limitsClosure J) := by + rw [limitsClosure_isoClosure, + ← Q.isoClosure_strictLimitsClosureIter_eq_limitsClosure J κ h] + infer_instance + exact essentiallySmall_of_le (limitsClosure_monotone J hQ₂) + end end CategoryTheory.ObjectProperty diff --git a/Mathlib/CategoryTheory/ObjectProperty/Small.lean b/Mathlib/CategoryTheory/ObjectProperty/Small.lean index 2f920000504d84..f241dda47ea8de 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/Small.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/Small.lean @@ -38,29 +38,84 @@ instance {P Q : ObjectProperty C} [ObjectProperty.Small.{w} P] : ObjectProperty.Small.{w} (P ⊓ Q) := small_of_le inf_le_left +instance {P Q : ObjectProperty C} [ObjectProperty.Small.{w} P] [ObjectProperty.Small.{w} Q] : + ObjectProperty.Small.{w} (P ⊔ Q) := + small_of_surjective (f := fun (x : Subtype P ⊕ Subtype Q) ↦ match x with + | .inl x => ⟨x.1, Or.inl x.2⟩ + | .inr x => ⟨x.1, Or.inr x.2⟩) + (by rintro ⟨x, hx | hx⟩ <;> aesop) + +instance {α : Type*} (P : α → ObjectProperty C) + [∀ a, ObjectProperty.Small.{w} (P a)] [Small.{w} α] : + ObjectProperty.Small.{w} (⨆ a, P a) := + small_of_surjective (f := fun (x : Σ a, Subtype (P a)) ↦ ⟨x.2.1, by aesop⟩) + (fun ⟨x, hx⟩ ↦ by aesop) + protected class EssentiallySmall (P : ObjectProperty C) : Prop where - exists_small_le (P) : ∃ (Q : ObjectProperty C) (_ : ObjectProperty.Small.{w} Q), + exists_small_le' (P) : ∃ (Q : ObjectProperty C) (_ : ObjectProperty.Small.{w} Q), P ≤ Q.isoClosure +lemma EssentiallySmall.exists_small_le (P : ObjectProperty C) + [ObjectProperty.EssentiallySmall.{w} P] : + ∃ (Q : ObjectProperty C) (_ : ObjectProperty.Small.{w} Q), Q ≤ P ∧ P ≤ Q.isoClosure := by + obtain ⟨Q, _, hQ⟩ := exists_small_le' P + let P' := Q ⊓ P.isoClosure + have h (X' : Subtype P') : ∃ (X : Subtype P), Nonempty (X'.1 ≅ X.1) := + ⟨⟨X'.2.2.choose, X'.2.2.choose_spec.choose⟩, X'.2.2.choose_spec.choose_spec⟩ + choose φ hφ using h + refine ⟨fun X ↦ X ∈ Set.range (Subtype.val ∘ φ), ?_, ?_, ?_⟩ + · exact small_of_surjective (f := fun X ↦ ⟨(φ X).1, by tauto⟩) + (by rintro ⟨_, Z, rfl⟩; exact ⟨Z, rfl⟩) + · intro X hX + simp only [Set.mem_range, Function.comp_apply, Subtype.exists] at hX + obtain ⟨Y, hY, rfl⟩ := hX + exact (φ ⟨Y, hY⟩).2 + · intro X hX + obtain ⟨Y, hY, ⟨e⟩⟩ := hQ _ hX + let Z : Subtype P' := ⟨Y, hY, ⟨X, hX, ⟨e.symm⟩⟩⟩ + exact ⟨_, ⟨Z, rfl⟩, ⟨e ≪≫ (hφ Z).some⟩⟩ + instance (P : ObjectProperty C) [ObjectProperty.Small.{w} P] : ObjectProperty.EssentiallySmall.{w} P where - exists_small_le := ⟨P, inferInstance, le_isoClosure P⟩ + exists_small_le' := ⟨P, inferInstance, le_isoClosure P⟩ instance (P : ObjectProperty C) [ObjectProperty.Small.{w} P] : ObjectProperty.EssentiallySmall.{w} P.isoClosure where - exists_small_le := ⟨P, inferInstance, by rfl⟩ + exists_small_le' := ⟨P, inferInstance, by rfl⟩ lemma EssentiallySmall.exists_small (P : ObjectProperty C) [P.IsClosedUnderIsomorphisms] [ObjectProperty.EssentiallySmall.{w} P] : ∃ (P₀ : ObjectProperty C) (_ : ObjectProperty.Small.{w} P₀), P = P₀.isoClosure := by - obtain ⟨Q, _, hQ⟩ := exists_small_le P - refine ⟨Q ⊓ P, inferInstance, le_antisymm ?_ ?_⟩ - · intro X hX - obtain ⟨Y, hY, ⟨e⟩⟩ := hQ _ hX - refine ⟨Y, ?_, ⟨e⟩⟩ - simp only [prop_inf_iff] - exact ⟨hY, P.prop_of_iso e hX⟩ - · conv_rhs => rw [← P.isoClosure_eq_self] - exact monotone_isoClosure inf_le_right + obtain ⟨Q, _, hQ₁, hQ₂⟩ := exists_small_le P + exact ⟨Q, inferInstance, le_antisymm hQ₂ (by rwa [isoClosure_le_iff])⟩ + +lemma essentiallySmall_of_le {P Q : ObjectProperty C} + [ObjectProperty.EssentiallySmall.{w} Q] (h : P ≤ Q) : + ObjectProperty.EssentiallySmall.{w} P where + exists_small_le' := by + obtain ⟨R, _, hR⟩ := EssentiallySmall.exists_small_le' Q + exact ⟨R, inferInstance, h.trans hR⟩ + +instance {P Q : ObjectProperty C} + [ObjectProperty.EssentiallySmall.{w} P] [ObjectProperty.EssentiallySmall.{w} Q] : + ObjectProperty.EssentiallySmall.{w} (P ⊔ Q) := by + obtain ⟨P', _, hP'⟩ := EssentiallySmall.exists_small_le' P + obtain ⟨Q', _, hQ'⟩ := EssentiallySmall.exists_small_le' Q + refine ⟨P' ⊔ Q', inferInstance, ?_⟩ + simp only [sup_le_iff] + constructor + · exact hP'.trans (monotone_isoClosure le_sup_left) + · exact hQ'.trans (monotone_isoClosure le_sup_right) + +instance {α : Type*} (P : α → ObjectProperty C) + [∀ a, ObjectProperty.EssentiallySmall.{w} (P a)] [Small.{w} α] : + ObjectProperty.EssentiallySmall.{w} (⨆ a, P a) where + exists_small_le' := by + have h (a : α) := EssentiallySmall.exists_small_le' (P a) + choose Q _ hQ using h + refine ⟨⨆ a, Q a, inferInstance, ?_⟩ + simp only [iSup_le_iff] + intro a + exact (hQ a).trans (monotone_isoClosure (le_iSup Q a)) end CategoryTheory.ObjectProperty From 71eea38a3f5ac9ad3ce7b085d4672142e6dc7d3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Mon, 22 Sep 2025 11:51:20 +0200 Subject: [PATCH 17/69] wip --- Mathlib/CategoryTheory/ObjectProperty/LimitsClosure.lean | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Mathlib/CategoryTheory/ObjectProperty/LimitsClosure.lean b/Mathlib/CategoryTheory/ObjectProperty/LimitsClosure.lean index 3c3758663181d9..21d8fd1fc74146 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/LimitsClosure.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/LimitsClosure.lean @@ -10,6 +10,11 @@ import Mathlib.Order.TransfiniteIteration /-! # Closure of a property of objects under limits of certain shapes +In this file, given a property `P` of objects in a category `C` and +family of categories `J : α → Type _`, we introduce the closure +`P.limitsClosure J` of `P` under limits of shapes `J a` for all `a : α`, +and under certain small circumstances, we show that its essentially small. + -/ universe w w' t v' u' v u From 01df6fa58f30db2d5cde8742d594387caead988d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Mon, 22 Sep 2025 12:21:03 +0200 Subject: [PATCH 18/69] generalising universes --- .../ObjectProperty/LimitsClosure.lean | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/Mathlib/CategoryTheory/ObjectProperty/LimitsClosure.lean b/Mathlib/CategoryTheory/ObjectProperty/LimitsClosure.lean index 21d8fd1fc74146..87e5915ceaf041 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/LimitsClosure.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/LimitsClosure.lean @@ -147,8 +147,7 @@ end section --- TODO: improve this so that `u'` is replaced by any `w` -variable (κ : Cardinal.{u'}) [Fact κ.IsRegular] (h : ∀ (a : α), HasCardinalLT (J a) κ) +variable (κ : Cardinal.{w}) [Fact κ.IsRegular] (h : ∀ (a : α), HasCardinalLT (J a) κ) include h @@ -156,6 +155,7 @@ lemma strictLimitsClosureStep_strictLimitsClosureIter_eq_self : (P.strictLimitsClosureIter J κ.ord).strictLimitsClosureStep J = (P.strictLimitsClosureIter J κ.ord) := by have hκ : κ.IsRegular := Fact.out + have (a : α) := (h a).small refine le_antisymm (fun X hX ↦ ?_) (le_strictLimitsClosureStep _ _) simp only [strictLimitsClosureStep, prop_sup_iff, prop_iSup_iff] at hX obtain (hX | ⟨a, F, hF⟩) := hX @@ -164,10 +164,14 @@ lemma strictLimitsClosureStep_strictLimitsClosureIter_eq_self : (Cardinal.isSuccLimit_ord hκ.aleph0_le), prop_iSup_iff, Subtype.exists, Set.mem_Iio, exists_prop] at hF choose o ho ho' using hF - obtain ⟨m, hm, hm'⟩ : ∃ (m : Ordinal.{u'}) (hm : m < κ.ord), ∀ (j : J a), o j ≤ m := - ⟨⨆ j, o j, Ordinal.iSup_lt_ord - (lt_of_lt_of_eq ((hasCardinalLT_iff_cardinal_mk_lt _ _).1 (h a)) hκ.cof_eq.symm) ho, - le_ciSup (Ordinal.bddAbove_range _)⟩ + obtain ⟨m, hm, hm'⟩ : ∃ (m : Ordinal.{w}) (hm : m < κ.ord), ∀ (j : J a), o j ≤ m := by + refine ⟨⨆ j, o ((equivShrink.{w} (J a)).symm j), + Ordinal.iSup_lt_ord ?_ (fun _ ↦ ho _), fun j ↦ ?_⟩ + · rw [hκ.cof_eq, ← hasCardinalLT_iff_cardinal_mk_lt _ κ, + ← hasCardinalLT_iff_of_equiv (equivShrink.{w} (J a))] + exact h a + · obtain ⟨j, rfl⟩ := (equivShrink.{w} (J a)).symm.surjective j + exact le_ciSup (Ordinal.bddAbove_range _) _ refine monotone_transfiniteIterate _ _ (fun (Q : ObjectProperty C) ↦ Q.le_strictLimitsClosureStep J) (Order.succ_le_iff.2 hm) _ ?_ dsimp @@ -189,11 +193,11 @@ lemma isoClosure_strictLimitsClosureIter_eq_limitsClosure : exact monotone_isoClosure ((le_trans (by rfl) (le_iSup _ a)).trans le_sup_right) lemma isEssentiallySmall_limitsClosure - [ObjectProperty.EssentiallySmall.{u'} P] [LocallySmall.{u'} C] [Small.{u'} α] - [∀ a, Small.{u'} (J a)] [∀ a, LocallySmall.{u'} (J a)] : - ObjectProperty.EssentiallySmall.{u'} (P.limitsClosure J) := by - obtain ⟨Q, hQ, hQ₁, hQ₂⟩ := EssentiallySmall.exists_small_le.{u'} P - have : ObjectProperty.EssentiallySmall.{u'} (Q.isoClosure.limitsClosure J) := by + [ObjectProperty.EssentiallySmall.{w} P] [LocallySmall.{w} C] [Small.{w} α] + [∀ a, Small.{w} (J a)] [∀ a, LocallySmall.{w} (J a)] : + ObjectProperty.EssentiallySmall.{w} (P.limitsClosure J) := by + obtain ⟨Q, hQ, hQ₁, hQ₂⟩ := EssentiallySmall.exists_small_le.{w} P + have : ObjectProperty.EssentiallySmall.{w} (Q.isoClosure.limitsClosure J) := by rw [limitsClosure_isoClosure, ← Q.isoClosure_strictLimitsClosureIter_eq_limitsClosure J κ h] infer_instance From d328e580d26593d19405028354b693e2062d8bb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Mon, 22 Sep 2025 16:05:11 +0200 Subject: [PATCH 19/69] wip --- .../Limits/FullSubcategory.lean | 110 ++++++------------ .../Limits/MorphismProperty.lean | 12 +- .../ObjectProperty/ColimitsOfShape.lean | 53 ++++++++- .../ObjectProperty/LimitsOfShape.lean | 52 ++++++++- 4 files changed, 146 insertions(+), 81 deletions(-) diff --git a/Mathlib/CategoryTheory/Limits/FullSubcategory.lean b/Mathlib/CategoryTheory/Limits/FullSubcategory.lean index c4a51fd5288501..fb5226eff1080e 100644 --- a/Mathlib/CategoryTheory/Limits/FullSubcategory.lean +++ b/Mathlib/CategoryTheory/Limits/FullSubcategory.lean @@ -3,14 +3,14 @@ Copyright (c) 2022 Markus Himmel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Markus Himmel -/ -import Mathlib.CategoryTheory.Limits.Creates -import Mathlib.CategoryTheory.ObjectProperty.ClosedUnderIsomorphisms +import Mathlib.CategoryTheory.ObjectProperty.LimitsOfShape +import Mathlib.CategoryTheory.ObjectProperty.ColimitsOfShape /-! # Limits in full subcategories -We introduce the notion of a property closed under taking limits and show that if `P` is closed -under taking limits, then limits in `FullSubcategory P` can be constructed from limits in `C`. +If a property of objects `P` is closed under taking limits, +then limits in `FullSubcategory P` can be constructed from limits in `C`. More precisely, the inclusion creates such limits. -/ @@ -24,46 +24,6 @@ open CategoryTheory namespace CategoryTheory.Limits -/-- We say that a property is closed under limits of shape `J` if whenever all objects in a - `J`-shaped diagram have the property, any limit of this diagram also has the property. -/ -def ClosedUnderLimitsOfShape {C : Type u} [Category.{v} C] (J : Type w) [Category.{w'} J] - (P : ObjectProperty C) : Prop := - ∀ ⦃F : J ⥤ C⦄ ⦃c : Cone F⦄ (_hc : IsLimit c), (∀ j, P (F.obj j)) → P c.pt - -/-- We say that a property is closed under colimits of shape `J` if whenever all objects in a - `J`-shaped diagram have the property, any colimit of this diagram also has the property. -/ -def ClosedUnderColimitsOfShape {C : Type u} [Category.{v} C] (J : Type w) [Category.{w'} J] - (P : ObjectProperty C) : Prop := - ∀ ⦃F : J ⥤ C⦄ ⦃c : Cocone F⦄ (_hc : IsColimit c), (∀ j, P (F.obj j)) → P c.pt - -section - -variable {C : Type u} [Category.{v} C] {J : Type w} [Category.{w'} J] {P : ObjectProperty C} - -theorem closedUnderLimitsOfShape_of_limit [P.IsClosedUnderIsomorphisms] - (h : ∀ {F : J ⥤ C} [HasLimit F], (∀ j, P (F.obj j)) → P (limit F)) : - ClosedUnderLimitsOfShape J P := by - intro F c hc hF - have : HasLimit F := ⟨_, hc⟩ - exact P.prop_of_iso ((limit.isLimit _).conePointUniqueUpToIso hc) (h hF) - -theorem closedUnderColimitsOfShape_of_colimit [P.IsClosedUnderIsomorphisms] - (h : ∀ {F : J ⥤ C} [HasColimit F], (∀ j, P (F.obj j)) → P (colimit F)) : - ClosedUnderColimitsOfShape J P := by - intro F c hc hF - have : HasColimit F := ⟨_, hc⟩ - exact P.prop_of_iso ((colimit.isColimit _).coconePointUniqueUpToIso hc) (h hF) - -protected lemma ClosedUnderLimitsOfShape.limit (h : ClosedUnderLimitsOfShape J P) {F : J ⥤ C} - [HasLimit F] : (∀ j, P (F.obj j)) → P (limit F) := - h (limit.isLimit _) - -protected lemma ClosedUnderColimitsOfShape.colimit (h : ClosedUnderColimitsOfShape J P) {F : J ⥤ C} - [HasColimit F] : (∀ j, P (F.obj j)) → P (colimit F) := - h (colimit.isColimit _) - -end - section variable {J : Type w} [Category.{w'} J] {C : Type u} [Category.{v} C] {P : ObjectProperty C} @@ -97,47 +57,49 @@ def createsColimitFullSubcategoryInclusion (F : J ⥤ P.FullSubcategory) CreatesColimit F P.ι := createsColimitFullSubcategoryInclusion' F (colimit.isColimit _) h +variable (P J) + /-- If `P` is closed under limits of shape `J`, then the inclusion creates such limits. -/ -def createsLimitFullSubcategoryInclusionOfClosed (h : ClosedUnderLimitsOfShape J P) +def createsLimitFullSubcategoryInclusionOfClosed [P.IsClosedUnderLimitsOfShape J] (F : J ⥤ P.FullSubcategory) [HasLimit (F ⋙ P.ι)] : CreatesLimit F P.ι := - createsLimitFullSubcategoryInclusion F (h.limit fun j => (F.obj j).property) + createsLimitFullSubcategoryInclusion F (P.prop_limit _ fun j => (F.obj j).property) /-- If `P` is closed under limits of shape `J`, then the inclusion creates such limits. -/ -def createsLimitsOfShapeFullSubcategoryInclusion (h : ClosedUnderLimitsOfShape J P) +def createsLimitsOfShapeFullSubcategoryInclusion [P.IsClosedUnderLimitsOfShape J] [HasLimitsOfShape J C] : CreatesLimitsOfShape J P.ι where - CreatesLimit := @fun F => createsLimitFullSubcategoryInclusionOfClosed h F + CreatesLimit := @fun F => createsLimitFullSubcategoryInclusionOfClosed J P F -theorem hasLimit_of_closedUnderLimits (h : ClosedUnderLimitsOfShape J P) +theorem hasLimit_of_closedUnderLimits [P.IsClosedUnderLimitsOfShape J] (F : J ⥤ P.FullSubcategory) [HasLimit (F ⋙ P.ι)] : HasLimit F := have : CreatesLimit F P.ι := - createsLimitFullSubcategoryInclusionOfClosed h F + createsLimitFullSubcategoryInclusionOfClosed J P F hasLimit_of_created F P.ι -theorem hasLimitsOfShape_of_closedUnderLimits (h : ClosedUnderLimitsOfShape J P) +theorem hasLimitsOfShape_of_closedUnderLimits [P.IsClosedUnderLimitsOfShape J] [HasLimitsOfShape J C] : HasLimitsOfShape J P.FullSubcategory := - { has_limit := fun F => hasLimit_of_closedUnderLimits h F } + { has_limit := fun F => hasLimit_of_closedUnderLimits J P F } /-- If `P` is closed under colimits of shape `J`, then the inclusion creates such colimits. -/ -def createsColimitFullSubcategoryInclusionOfClosed (h : ClosedUnderColimitsOfShape J P) +def createsColimitFullSubcategoryInclusionOfClosed [P.IsClosedUnderColimitsOfShape J] (F : J ⥤ P.FullSubcategory) [HasColimit (F ⋙ P.ι)] : CreatesColimit F P.ι := - createsColimitFullSubcategoryInclusion F (h.colimit fun j => (F.obj j).property) + createsColimitFullSubcategoryInclusion F (P.prop_colimit _ fun j => (F.obj j).property) /-- If `P` is closed under colimits of shape `J`, then the inclusion creates such colimits. -/ -def createsColimitsOfShapeFullSubcategoryInclusion (h : ClosedUnderColimitsOfShape J P) +def createsColimitsOfShapeFullSubcategoryInclusion [P.IsClosedUnderColimitsOfShape J] [HasColimitsOfShape J C] : CreatesColimitsOfShape J P.ι where - CreatesColimit := @fun F => createsColimitFullSubcategoryInclusionOfClosed h F + CreatesColimit := @fun F => createsColimitFullSubcategoryInclusionOfClosed J P F -theorem hasColimit_of_closedUnderColimits (h : ClosedUnderColimitsOfShape J P) +theorem hasColimit_of_closedUnderColimits [P.IsClosedUnderColimitsOfShape J] (F : J ⥤ P.FullSubcategory) [HasColimit (F ⋙ P.ι)] : HasColimit F := have : CreatesColimit F P.ι := - createsColimitFullSubcategoryInclusionOfClosed h F + createsColimitFullSubcategoryInclusionOfClosed J P F hasColimit_of_created F P.ι -theorem hasColimitsOfShape_of_closedUnderColimits (h : ClosedUnderColimitsOfShape J P) +theorem hasColimitsOfShape_of_closedUnderColimits [P.IsClosedUnderColimitsOfShape J] [HasColimitsOfShape J C] : HasColimitsOfShape J P.FullSubcategory := - { has_colimit := fun F => hasColimit_of_closedUnderColimits h F } + { has_colimit := fun F => hasColimit_of_closedUnderColimits J P F } end @@ -147,19 +109,23 @@ variable {D : Type u₂} [Category.{v₂} D] variable (F : C ⥤ D) /-- The essential image of a functor is closed under the limits it preserves. -/ -protected lemma ClosedUnderLimitsOfShape.essImage [HasLimitsOfShape J C] - [PreservesLimitsOfShape J F] [F.Full] [F.Faithful] : - ClosedUnderLimitsOfShape J F.essImage := fun G _c hc hG ↦ - ⟨limit (Functor.essImage.liftFunctor G F hG), - ⟨IsLimit.conePointsIsoOfNatIso (isLimitOfPreserves F (limit.isLimit _)) hc - (Functor.essImage.liftFunctorCompIso _ _ _)⟩⟩ +instance [HasLimitsOfShape J C] [PreservesLimitsOfShape J F] [F.Full] [F.Faithful] : + F.essImage.IsClosedUnderLimitsOfShape J := + .mk' (by + rintro _ ⟨G, hG⟩ + exact ⟨limit (Functor.essImage.liftFunctor G F hG), + ⟨IsLimit.conePointsIsoOfNatIso + (isLimitOfPreserves F (limit.isLimit _)) (limit.isLimit _) + (Functor.essImage.liftFunctorCompIso _ _ _)⟩⟩) /-- The essential image of a functor is closed under the colimits it preserves. -/ -protected lemma ClosedUnderColimitsOfShape.essImage [HasColimitsOfShape J C] - [PreservesColimitsOfShape J F] [F.Full] [F.Faithful] : - ClosedUnderColimitsOfShape J F.essImage := fun G _c hc hG ↦ - ⟨colimit (Functor.essImage.liftFunctor G F hG), - ⟨IsColimit.coconePointsIsoOfNatIso (isColimitOfPreserves F (colimit.isColimit _)) hc - (Functor.essImage.liftFunctorCompIso _ _ _)⟩⟩ +instance [HasColimitsOfShape J C] [PreservesColimitsOfShape J F] [F.Full] [F.Faithful] : + F.essImage.IsClosedUnderColimitsOfShape J := + .mk' (by + rintro _ ⟨G, hG⟩ + exact ⟨colimit (Functor.essImage.liftFunctor G F hG), + ⟨IsColimit.coconePointsIsoOfNatIso + (isColimitOfPreserves F (colimit.isColimit _)) (colimit.isColimit _) + (Functor.essImage.liftFunctorCompIso _ _ _)⟩⟩) end CategoryTheory.Limits diff --git a/Mathlib/CategoryTheory/Limits/MorphismProperty.lean b/Mathlib/CategoryTheory/Limits/MorphismProperty.lean index 49260c03f407d4..4d582a05e23d5e 100644 --- a/Mathlib/CategoryTheory/Limits/MorphismProperty.lean +++ b/Mathlib/CategoryTheory/Limits/MorphismProperty.lean @@ -8,6 +8,7 @@ import Mathlib.CategoryTheory.Limits.Constructions.Over.Basic import Mathlib.CategoryTheory.Limits.FullSubcategory import Mathlib.CategoryTheory.MorphismProperty.Comma import Mathlib.CategoryTheory.MorphismProperty.Limits +import Mathlib.CategoryTheory.ObjectProperty.LimitsOfShape /-! # (Co)limits in subcategories of comma categories defined by morphism properties @@ -28,22 +29,23 @@ variable (D : J ⥤ P.Comma L R ⊤ ⊤) /-- If `P` is closed under limits of shape `J` in `Comma L R`, then when `D` has a limit in `Comma L R`, the forgetful functor creates this limit. -/ noncomputable def forgetCreatesLimitOfClosed - (h : ClosedUnderLimitsOfShape J (fun f : Comma L R ↦ P f.hom)) + (h : ObjectProperty.IsClosedUnderLimitsOfShape (fun f : Comma L R ↦ P f.hom) J) [HasLimit (D ⋙ forget L R P ⊤ ⊤)] : CreatesLimit D (forget L R P ⊤ ⊤) := createsLimitOfFullyFaithfulOfIso - (⟨limit (D ⋙ forget L R P ⊤ ⊤), h.limit fun j ↦ (D.obj j).prop⟩) - (Iso.refl _) + (⟨limit (D ⋙ forget L R P ⊤ ⊤), + ObjectProperty.prop_limit (fun f : Comma L R ↦ P f.hom) _ + fun j ↦ (D.obj j).prop⟩) (Iso.refl _) /-- If `Comma L R` has limits of shape `J` and `Comma L R` is closed under limits of shape `J`, then `forget L R P ⊤ ⊤` creates limits of shape `J`. -/ noncomputable def forgetCreatesLimitsOfShapeOfClosed [HasLimitsOfShape J (Comma L R)] - (h : ClosedUnderLimitsOfShape J (fun f : Comma L R ↦ P f.hom)) : + (h : ObjectProperty.IsClosedUnderLimitsOfShape (fun f : Comma L R ↦ P f.hom) J) : CreatesLimitsOfShape J (forget L R P ⊤ ⊤) where CreatesLimit := forgetCreatesLimitOfClosed _ _ h lemma hasLimit_of_closedUnderLimitsOfShape - (h : ClosedUnderLimitsOfShape J (fun f : Comma L R ↦ P f.hom)) + (h : ObjectProperty.IsClosedUnderLimitsOfShape (fun f : Comma L R ↦ P f.hom) J) [HasLimit (D ⋙ forget L R P ⊤ ⊤)] : HasLimit D := haveI : CreatesLimit D (forget L R P ⊤ ⊤) := forgetCreatesLimitOfClosed _ D h diff --git a/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean b/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean index a95bdd7d1705b9..544f52597f56cf 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean @@ -22,10 +22,11 @@ Under certain circumstances, the type of objects satisfying introduced is to deduce that the full subcategory of `P.colimitsOfShape J` is essentially small. +By requiring `P.colimitsOfShape J ≤ P`, we introduce a typeclass +`P.IsClosedUnderColimitsOfShape J`. + ## TODO -* refactor `ClosedUnderColimitsOfShape J P` to make it a typeclass which -would say that `P.colimitsOfShape J ≤ J`. * refactor `ObjectProperty.ind` by saying that it is the supremum of `P.colimitsOfShape J` for a filtered category `J` (generalize also to `κ`-filtered categories?) @@ -143,4 +144,50 @@ instance [ObjectProperty.Small.{w} P] [LocallySmall.{w} C] [Small.{w} J] [Locall rintro ⟨_, ⟨F, hF⟩⟩ exact ⟨⟨P.lift F hF, by assumption⟩, rfl⟩ -end CategoryTheory.ObjectProperty +/-- A property of objects satisfies `P.IsClosedUnderColimitsOfShape J` if it +is stable by colimits of shape `J`. -/ +@[mk_iff] +class IsClosedUnderColimitsOfShape (P : ObjectProperty C) (J : Type u') [Category.{v'} J] where + colimitsOfShape_le (P J) : P.colimitsOfShape J ≤ P + +variable {P J} in +lemma IsClosedUnderColimitsOfShape.mk' [P.IsClosedUnderIsomorphisms] + (h : P.strictColimitsOfShape J ≤ P) : + P.IsClosedUnderColimitsOfShape J where + colimitsOfShape_le := by + conv_rhs => rw [← P.isoClosure_eq_self] + rw [← isoClosure_strictColimitsOfShape] + exact monotone_isoClosure h + +export IsClosedUnderColimitsOfShape (colimitsOfShape_le) + +section + +variable {J} [P.IsClosedUnderColimitsOfShape J] + +variable {P} in +lemma ColimitOfShape.prop {X : C} (h : P.ColimitOfShape J X) : P X := + P.colimitsOfShape_le J _ ⟨h⟩ + +lemma prop_of_isColimit {F : J ⥤ C} {c : Cocone F} (hc : IsColimit c) + (hF : ∀ (j : J), P (F.obj j)) : P c.pt := + P.colimitsOfShape_le J _ ⟨{ diag := _, ι := _, isColimit := hc, prop_diag_obj := hF }⟩ + +lemma prop_colimit (F : J ⥤ C) [HasColimit F] (hF : ∀ (j : J), P (F.obj j)) : + P (colimit F) := + P.prop_of_isColimit (colimit.isColimit F) hF + +end + +end ObjectProperty + +namespace Limits + +@[deprecated (since := "2025-09-22")] alias ClosedUnderColimitsOfShape := + ObjectProperty.IsClosedUnderColimitsOfShape +@[deprecated (since := "2025-09-22")] alias closedUnderColimitsOfShape_of_colimit := + ObjectProperty.IsClosedUnderColimitsOfShape.mk' +@[deprecated (since := "2025-09-22")] alias ClosedUnderColimitsOfShape.colimit := + ObjectProperty.prop_colimit + +end CategoryTheory.Limits diff --git a/Mathlib/CategoryTheory/ObjectProperty/LimitsOfShape.lean b/Mathlib/CategoryTheory/ObjectProperty/LimitsOfShape.lean index 2aa869edfeca3e..80a920c6a12099 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/LimitsOfShape.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/LimitsOfShape.lean @@ -22,6 +22,10 @@ Under certain circumstances, the type of objects satisfying introduced is to deduce that the full subcategory of `P.limitsOfShape J` is essentially small. +By requiring `P.limitsOfShape J ≤ P`, we introduce a typeclass +`P.IsClosedUnderLimitsOfShape J`. + + ## TODO * formalize the closure of `P` under finite limits (which require @@ -142,4 +146,50 @@ instance [ObjectProperty.Small.{w} P] [LocallySmall.{w} C] [Small.{w} J] [Locall rintro ⟨_, ⟨F, hF⟩⟩ exact ⟨⟨P.lift F hF, by assumption⟩, rfl⟩ -end CategoryTheory.ObjectProperty +/-- A property of objects satisfies `P.IsClosedUnderLimitsOfShape J` if it +is stable by limits of shape `J`. -/ +@[mk_iff] +class IsClosedUnderLimitsOfShape (P : ObjectProperty C) (J : Type u') [Category.{v'} J] where + limitsOfShape_le (P J) : P.limitsOfShape J ≤ P + +variable {P J} in +lemma IsClosedUnderLimitsOfShape.mk' [P.IsClosedUnderIsomorphisms] + (h : P.strictLimitsOfShape J ≤ P) : + P.IsClosedUnderLimitsOfShape J where + limitsOfShape_le := by + conv_rhs => rw [← P.isoClosure_eq_self] + rw [← isoClosure_strictLimitsOfShape] + exact monotone_isoClosure h + +export IsClosedUnderLimitsOfShape (limitsOfShape_le) + +section + +variable {J} [P.IsClosedUnderLimitsOfShape J] + +variable {P} in +lemma LimitOfShape.prop {X : C} (h : P.LimitOfShape J X) : P X := + P.limitsOfShape_le J _ ⟨h⟩ + +lemma prop_of_isLimit {F : J ⥤ C} {c : Cone F} (hc : IsLimit c) + (hF : ∀ (j : J), P (F.obj j)) : P c.pt := + P.limitsOfShape_le J _ ⟨{ diag := _, π := _, isLimit := hc, prop_diag_obj := hF }⟩ + +lemma prop_limit (F : J ⥤ C) [HasLimit F] (hF : ∀ (j : J), P (F.obj j)) : + P (limit F) := + P.prop_of_isLimit (limit.isLimit F) hF + +end + +end ObjectProperty + +namespace Limits + +@[deprecated (since := "2025-09-22")] alias ClosedUnderLimitsOfShape := + ObjectProperty.IsClosedUnderLimitsOfShape +@[deprecated (since := "2025-09-22")] alias closedUnderLimitsOfShape_of_limit := + ObjectProperty.IsClosedUnderLimitsOfShape.mk' +@[deprecated (since := "2025-09-22")] alias ClosedUnderLimitsOfShape.limit := + ObjectProperty.prop_limit + +end CategoryTheory.Limits From f7f1478d223b68d64006dc97c8aec5fbfa525c88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Mon, 22 Sep 2025 17:10:50 +0200 Subject: [PATCH 20/69] fixing the build --- .../Limits/MorphismProperty.lean | 41 ++++++++++--------- .../Monoidal/Cartesian/Basic.lean | 14 +++++-- 2 files changed, 32 insertions(+), 23 deletions(-) diff --git a/Mathlib/CategoryTheory/Limits/MorphismProperty.lean b/Mathlib/CategoryTheory/Limits/MorphismProperty.lean index 4d582a05e23d5e..32343198f599f8 100644 --- a/Mathlib/CategoryTheory/Limits/MorphismProperty.lean +++ b/Mathlib/CategoryTheory/Limits/MorphismProperty.lean @@ -52,7 +52,7 @@ lemma hasLimit_of_closedUnderLimitsOfShape hasLimit_of_created D (forget L R P ⊤ ⊤) lemma hasLimitsOfShape_of_closedUnderLimitsOfShape [HasLimitsOfShape J (Comma L R)] - (h : ClosedUnderLimitsOfShape J (fun f : Comma L R ↦ P f.hom)) : + (h : ObjectProperty.IsClosedUnderLimitsOfShape (fun f : Comma L R ↦ P f.hom) J) : HasLimitsOfShape J (P.Comma L R ⊤ ⊤) where has_limit _ := hasLimit_of_closedUnderLimitsOfShape _ _ h @@ -64,15 +64,15 @@ variable {A : Type*} [Category A] {L : A ⥤ T} lemma CostructuredArrow.closedUnderLimitsOfShape_discrete_empty [L.Faithful] [L.Full] {Y : A} [P.ContainsIdentities] [P.RespectsIso] : - ClosedUnderLimitsOfShape (Discrete PEmpty.{1}) - (fun f : CostructuredArrow L (L.obj Y) ↦ P f.hom) := by - rintro D c hc - - have : D = Functor.empty _ := Functor.empty_ext' _ _ - subst this - let e : c.pt ≅ CostructuredArrow.mk (𝟙 (L.obj Y)) := - hc.conePointUniqueUpToIso CostructuredArrow.mkIdTerminal - rw [P.costructuredArrow_iso_iff e] - simpa using P.id_mem (L.obj Y) + ObjectProperty.IsClosedUnderLimitsOfShape (fun f : CostructuredArrow L (L.obj Y) ↦ P f.hom) + (Discrete PEmpty.{1}) where + limitsOfShape_le := by + rintro X ⟨p⟩ + let e : X ≅ CostructuredArrow.mk (𝟙 (L.obj Y)) := + p.isLimit.conePointUniqueUpToIso ((IsLimit.postcomposeInvEquiv + (Functor.emptyExt _ _) _).2 CostructuredArrow.mkIdTerminal) + rw [P.costructuredArrow_iso_iff e] + simpa using P.id_mem (L.obj Y) end @@ -81,7 +81,7 @@ section variable {X : T} lemma Over.closedUnderLimitsOfShape_discrete_empty [P.ContainsIdentities] [P.RespectsIso] : - ClosedUnderLimitsOfShape (Discrete PEmpty.{1}) (fun f : Over X ↦ P f.hom) := + ObjectProperty.IsClosedUnderLimitsOfShape (fun f : Over X ↦ P f.hom) (Discrete PEmpty.{1}) := CostructuredArrow.closedUnderLimitsOfShape_discrete_empty P /-- Let `P` be stable under composition and base change. If `P` satisfies cancellation on the right, @@ -91,14 +91,17 @@ Without the cancellation property, this does not in general. Consider for exampl `P = Function.Surjective` on `Type`. -/ lemma Over.closedUnderLimitsOfShape_pullback [HasPullbacks T] [P.IsStableUnderComposition] [P.IsStableUnderBaseChange] [P.HasOfPostcompProperty P] : - ClosedUnderLimitsOfShape WalkingCospan (fun f : Over X ↦ P f.hom) := by - intro D c hc hf - have h : IsPullback (c.π.app .left).left (c.π.app .right).left (D.map WalkingCospan.Hom.inl).left - (D.map WalkingCospan.Hom.inr).left := IsPullback.of_isLimit_cone <| - Limits.isLimitOfPreserves (CategoryTheory.Over.forget X) hc - rw [show c.pt.hom = (c.π.app .left).left ≫ (D.obj .left).hom by simp] - apply P.comp_mem _ _ (P.of_isPullback h.flip ?_) (hf _) - exact P.of_postcomp _ (D.obj WalkingCospan.one).hom (hf .one) (by simpa using hf .right) + ObjectProperty.IsClosedUnderLimitsOfShape (fun f : Over X ↦ P f.hom) WalkingCospan where + limitsOfShape_le := by + rintro Y ⟨p⟩ + have ip := p.π.app .left + have h := IsPullback.of_isLimit_cone <| + Limits.isLimitOfPreserves (CategoryTheory.Over.forget X) p.isLimit + dsimp at h + rw [show Y.hom = (p.π.app .left).left ≫ (p.diag.obj .left).hom by simp] + apply P.comp_mem _ _ (P.of_isPullback h.flip ?_) (p.prop_diag_obj _) + exact P.of_postcomp _ (p.diag.obj WalkingCospan.one).hom (p.prop_diag_obj .one) + (by simpa using p.prop_diag_obj .right) end diff --git a/Mathlib/CategoryTheory/Monoidal/Cartesian/Basic.lean b/Mathlib/CategoryTheory/Monoidal/Cartesian/Basic.lean index 698ce096ed8ac2..ec013a3c6d00c8 100644 --- a/Mathlib/CategoryTheory/Monoidal/Cartesian/Basic.lean +++ b/Mathlib/CategoryTheory/Monoidal/Cartesian/Basic.lean @@ -776,11 +776,14 @@ variable {P : ObjectProperty C} -- TODO: Introduce `ClosedUnderFiniteProducts`? /-- The restriction of a Cartesian-monoidal category along an object property that's closed under finite products is Cartesian-monoidal. -/ -noncomputable def fullSubcategory (hP₀ : ClosedUnderLimitsOfShape (Discrete PEmpty) P) - (hP₂ : ClosedUnderLimitsOfShape (Discrete WalkingPair) P) : +instance fullSubcategoryOfIsClosedUnderLimitsOfShape + [P.IsClosedUnderLimitsOfShape (Discrete PEmpty)] + [P.IsClosedUnderLimitsOfShape (Discrete WalkingPair)] : CartesianMonoidalCategory P.FullSubcategory where - __ := MonoidalCategory.fullSubcategory P (hP₀ isTerminalTensorUnit <| by simp) - fun X Y hX hY ↦ hP₂ (tensorProductIsBinaryProduct X Y) (by rintro ⟨_ | _⟩ <;> simp [hX, hY]) + __ := MonoidalCategory.fullSubcategory P + (P.prop_of_isLimit isTerminalTensorUnit (by simp)) + (fun X Y hX hY ↦ P.prop_of_isLimit (tensorProductIsBinaryProduct X Y) + (by rintro ( _ | _) <;> assumption)) isTerminalTensorUnit := .ofUniqueHom (fun X ↦ toUnit X.1) fun _ _ ↦ by ext fst X Y := fst X.1 Y.1 snd X Y := snd X.1 Y.1 @@ -790,6 +793,9 @@ noncomputable def fullSubcategory (hP₀ : ClosedUnderLimitsOfShape (Discrete PE fst_def X Y := fst_def X.1 Y.1 snd_def X Y := snd_def X.1 Y.1 +@[deprecated (since := "2025-09-22")] alias fullSubcategory := + fullSubcategoryOfIsClosedUnderLimitsOfShape + end CartesianMonoidalCategory open MonoidalCategory CartesianMonoidalCategory From 2b7b1ce265b7bb1bb7abc02bb82e4cd236098423 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Mon, 22 Sep 2025 17:26:52 +0200 Subject: [PATCH 21/69] fix --- .../Limits/Indization/Equalizers.lean | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/Mathlib/CategoryTheory/Limits/Indization/Equalizers.lean b/Mathlib/CategoryTheory/Limits/Indization/Equalizers.lean index d5f9779e7698b5..fe8cf0c30e86ca 100644 --- a/Mathlib/CategoryTheory/Limits/Indization/Equalizers.lean +++ b/Mathlib/CategoryTheory/Limits/Indization/Equalizers.lean @@ -63,17 +63,21 @@ end This is Proposition 6.1.17(i) in [Kashiwara2006]. -/ -theorem closedUnderLimitsOfShape_walkingParallelPair_isIndObject [HasEqualizers C] : - ClosedUnderLimitsOfShape WalkingParallelPair (IsIndObject (C := C)) := by - apply closedUnderLimitsOfShape_of_limit - intro F hF h - obtain ⟨P⟩ := nonempty_indParallelPairPresentation (h WalkingParallelPair.zero) - (h WalkingParallelPair.one) (F.map WalkingParallelPairHom.left) - (F.map WalkingParallelPairHom.right) - exact IsIndObject.map - (HasLimit.isoOfNatIso (P.parallelPairIsoParallelPairCompYoneda.symm ≪≫ - (diagramIsoParallelPair _).symm)).hom - (isIndObject_limit_comp_yoneda_comp_colim (parallelPair P.φ P.ψ) - (fun i => isIndObject_limit_comp_yoneda _)) +instance isClosedUnderLimitsOfShape_isIndObject_walkingParallelPair [HasEqualizers C] : + ObjectProperty.IsClosedUnderLimitsOfShape (IsIndObject (C := C)) WalkingParallelPair := + .mk' (by + rintro _ ⟨F, h⟩ + obtain ⟨P⟩ := nonempty_indParallelPairPresentation (h WalkingParallelPair.zero) + (h WalkingParallelPair.one) (F.map WalkingParallelPairHom.left) + (F.map WalkingParallelPairHom.right) + exact IsIndObject.map + (HasLimit.isoOfNatIso (P.parallelPairIsoParallelPairCompYoneda.symm ≪≫ + (diagramIsoParallelPair _).symm)).hom + (isIndObject_limit_comp_yoneda_comp_colim (parallelPair P.φ P.ψ) + (fun i => isIndObject_limit_comp_yoneda _))) + +@[deprecated (since := "2025-09-22")] +alias closedUnderLimitsOfShape_walkingParallelPair_isIndObject := + isClosedUnderLimitsOfShape_isIndObject_walkingParallelPair end CategoryTheory.Limits From d3c4a13dbf15834b3735b980f70ef046c485477c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 23 Sep 2025 09:50:50 +0200 Subject: [PATCH 22/69] fixing the build --- .../Limits/FullSubcategory.lean | 8 +++---- .../Limits/Indization/Category.lean | 23 +++++++++++-------- .../Monoidal/Cartesian/Basic.lean | 10 +++----- 3 files changed, 20 insertions(+), 21 deletions(-) diff --git a/Mathlib/CategoryTheory/Limits/FullSubcategory.lean b/Mathlib/CategoryTheory/Limits/FullSubcategory.lean index fb5226eff1080e..ea9bde3a8f25e9 100644 --- a/Mathlib/CategoryTheory/Limits/FullSubcategory.lean +++ b/Mathlib/CategoryTheory/Limits/FullSubcategory.lean @@ -66,7 +66,7 @@ def createsLimitFullSubcategoryInclusionOfClosed [P.IsClosedUnderLimitsOfShape J createsLimitFullSubcategoryInclusion F (P.prop_limit _ fun j => (F.obj j).property) /-- If `P` is closed under limits of shape `J`, then the inclusion creates such limits. -/ -def createsLimitsOfShapeFullSubcategoryInclusion [P.IsClosedUnderLimitsOfShape J] +instance createsLimitsOfShapeFullSubcategoryInclusion [P.IsClosedUnderLimitsOfShape J] [HasLimitsOfShape J C] : CreatesLimitsOfShape J P.ι where CreatesLimit := @fun F => createsLimitFullSubcategoryInclusionOfClosed J P F @@ -76,7 +76,7 @@ theorem hasLimit_of_closedUnderLimits [P.IsClosedUnderLimitsOfShape J] createsLimitFullSubcategoryInclusionOfClosed J P F hasLimit_of_created F P.ι -theorem hasLimitsOfShape_of_closedUnderLimits [P.IsClosedUnderLimitsOfShape J] +instance hasLimitsOfShape_of_closedUnderLimits [P.IsClosedUnderLimitsOfShape J] [HasLimitsOfShape J C] : HasLimitsOfShape J P.FullSubcategory := { has_limit := fun F => hasLimit_of_closedUnderLimits J P F } @@ -87,7 +87,7 @@ def createsColimitFullSubcategoryInclusionOfClosed [P.IsClosedUnderColimitsOfSha createsColimitFullSubcategoryInclusion F (P.prop_colimit _ fun j => (F.obj j).property) /-- If `P` is closed under colimits of shape `J`, then the inclusion creates such colimits. -/ -def createsColimitsOfShapeFullSubcategoryInclusion [P.IsClosedUnderColimitsOfShape J] +instance createsColimitsOfShapeFullSubcategoryInclusion [P.IsClosedUnderColimitsOfShape J] [HasColimitsOfShape J C] : CreatesColimitsOfShape J P.ι where CreatesColimit := @fun F => createsColimitFullSubcategoryInclusionOfClosed J P F @@ -97,7 +97,7 @@ theorem hasColimit_of_closedUnderColimits [P.IsClosedUnderColimitsOfShape J] createsColimitFullSubcategoryInclusionOfClosed J P F hasColimit_of_created F P.ι -theorem hasColimitsOfShape_of_closedUnderColimits [P.IsClosedUnderColimitsOfShape J] +instance hasColimitsOfShape_of_closedUnderColimits [P.IsClosedUnderColimitsOfShape J] [HasColimitsOfShape J C] : HasColimitsOfShape J P.FullSubcategory := { has_colimit := fun F => hasColimit_of_closedUnderColimits J P F } diff --git a/Mathlib/CategoryTheory/Limits/Indization/Category.lean b/Mathlib/CategoryTheory/Limits/Indization/Category.lean index 152a70024708ad..0722ceac4259a0 100644 --- a/Mathlib/CategoryTheory/Limits/Indization/Category.lean +++ b/Mathlib/CategoryTheory/Limits/Indization/Category.lean @@ -113,11 +113,14 @@ noncomputable def Ind.yonedaCompInclusion : Ind.yoneda ⋙ Ind.inclusion C ≅ C isoWhiskerLeft (ObjectProperty.lift _ _ _) (isoWhiskerRight (Ind.equivalence C).counitIso (ObjectProperty.ι _)) +noncomputable instance {J : Type v} [SmallCategory J] [IsFiltered J] : + ObjectProperty.IsClosedUnderColimitsOfShape (IsIndObject (C := C)) J := + .mk' (by + rintro _ ⟨F, hF⟩ + exact isIndObject_colimit _ _ hF) + noncomputable instance {J : Type v} [SmallCategory J] [IsFiltered J] : CreatesColimitsOfShape J (Ind.inclusion C) := - letI _ : CreatesColimitsOfShape J (ObjectProperty.ι (IsIndObject (C := C))) := - createsColimitsOfShapeFullSubcategoryInclusion (closedUnderColimitsOfShape_of_colimit - (isIndObject_colimit _ _)) inferInstanceAs <| CreatesColimitsOfShape J ((Ind.equivalence C).functor ⋙ ObjectProperty.ι _) @@ -125,11 +128,15 @@ instance : HasFilteredColimits (Ind C) where HasColimitsOfShape _ _ _ := hasColimitsOfShape_of_hasColimitsOfShape_createsColimitsOfShape (Ind.inclusion C) +noncomputable instance {J : Type v} [HasLimitsOfShape (Discrete J) C] : + ObjectProperty.IsClosedUnderLimitsOfShape (IsIndObject (C := C)) (Discrete J) := + .mk' (by + rintro _ ⟨F, hF⟩ + exact isIndObject_limit_of_discrete_of_hasLimitsOfShape _ hF) + + noncomputable instance {J : Type v} [HasLimitsOfShape (Discrete J) C] : CreatesLimitsOfShape (Discrete J) (Ind.inclusion C) := - letI _ : CreatesLimitsOfShape (Discrete J) (ObjectProperty.ι (IsIndObject (C := C))) := - createsLimitsOfShapeFullSubcategoryInclusion (closedUnderLimitsOfShape_of_limit - (isIndObject_limit_of_discrete_of_hasLimitsOfShape _)) inferInstanceAs <| CreatesLimitsOfShape (Discrete J) ((Ind.equivalence C).functor ⋙ ObjectProperty.ι _) @@ -139,10 +146,6 @@ instance {J : Type v} [HasLimitsOfShape (Discrete J) C] : noncomputable instance [HasLimitsOfShape WalkingParallelPair C] : CreatesLimitsOfShape WalkingParallelPair (Ind.inclusion C) := - letI _ : CreatesLimitsOfShape WalkingParallelPair - (ObjectProperty.ι (IsIndObject (C := C))) := - createsLimitsOfShapeFullSubcategoryInclusion - (closedUnderLimitsOfShape_walkingParallelPair_isIndObject) inferInstanceAs <| CreatesLimitsOfShape WalkingParallelPair ((Ind.equivalence C).functor ⋙ ObjectProperty.ι _) diff --git a/Mathlib/CategoryTheory/Monoidal/Cartesian/Basic.lean b/Mathlib/CategoryTheory/Monoidal/Cartesian/Basic.lean index ec013a3c6d00c8..58ccc7838c973b 100644 --- a/Mathlib/CategoryTheory/Monoidal/Cartesian/Basic.lean +++ b/Mathlib/CategoryTheory/Monoidal/Cartesian/Basic.lean @@ -776,7 +776,8 @@ variable {P : ObjectProperty C} -- TODO: Introduce `ClosedUnderFiniteProducts`? /-- The restriction of a Cartesian-monoidal category along an object property that's closed under finite products is Cartesian-monoidal. -/ -instance fullSubcategoryOfIsClosedUnderLimitsOfShape +@[simps!] +instance fullSubcategory' [P.IsClosedUnderLimitsOfShape (Discrete PEmpty)] [P.IsClosedUnderLimitsOfShape (Discrete WalkingPair)] : CartesianMonoidalCategory P.FullSubcategory where @@ -794,7 +795,7 @@ instance fullSubcategoryOfIsClosedUnderLimitsOfShape snd_def X Y := snd_def X.1 Y.1 @[deprecated (since := "2025-09-22")] alias fullSubcategory := - fullSubcategoryOfIsClosedUnderLimitsOfShape + fullSubcategory' end CartesianMonoidalCategory @@ -964,11 +965,6 @@ alias braidedOfChosenFiniteProducts := Braided.ofChosenFiniteProducts namespace EssImageSubcategory variable [F.Full] [F.Faithful] [PreservesFiniteProducts F] {T X Y Z : F.EssImageSubcategory} -@[simps!] -noncomputable instance instCartesianMonoidalCategory : - CartesianMonoidalCategory F.EssImageSubcategory := - .fullSubcategory (.essImage _) (.essImage _) - lemma tensor_obj (X Y : F.EssImageSubcategory) : (X ⊗ Y).obj = X.obj ⊗ Y.obj := rfl lemma lift_def (f : T ⟶ X) (g : T ⟶ Y) : lift f g = lift (T := T.1) f g := rfl From 57c64000da239961d1784900b07f8fd1023c6454 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 23 Sep 2025 10:01:13 +0200 Subject: [PATCH 23/69] chore(CategoryTheory): split Limits.Presentation --- Mathlib.lean | 1 + .../CategoryTheory/Limits/Presentation.lean | 132 ---------------- .../Presentable/Presentation.lean | 149 ++++++++++++++++++ 3 files changed, 150 insertions(+), 132 deletions(-) create mode 100644 Mathlib/CategoryTheory/Presentable/Presentation.lean diff --git a/Mathlib.lean b/Mathlib.lean index a631fa85bfe1e2..3dc3a101b1e50e 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -2684,6 +2684,7 @@ import Mathlib.CategoryTheory.Presentable.Finite import Mathlib.CategoryTheory.Presentable.IsCardinalFiltered import Mathlib.CategoryTheory.Presentable.Limits import Mathlib.CategoryTheory.Presentable.LocallyPresentable +import Mathlib.CategoryTheory.Presentable.Presentation import Mathlib.CategoryTheory.Products.Associator import Mathlib.CategoryTheory.Products.Basic import Mathlib.CategoryTheory.Products.Bifunctor diff --git a/Mathlib/CategoryTheory/Limits/Presentation.lean b/Mathlib/CategoryTheory/Limits/Presentation.lean index cbf8d56a9b2c25..c780f2820eb747 100644 --- a/Mathlib/CategoryTheory/Limits/Presentation.lean +++ b/Mathlib/CategoryTheory/Limits/Presentation.lean @@ -5,7 +5,6 @@ Authors: Christian Merten -/ import Mathlib.CategoryTheory.Limits.Connected import Mathlib.CategoryTheory.Limits.Final -import Mathlib.CategoryTheory.Presentable.Finite /-! # (Co)limit presentations @@ -17,8 +16,6 @@ the data of objects `Dⱼ` and natural maps `sⱼ : Dⱼ ⟶ X` that make `X` th - `CategoryTheory.Limits.ColimitPresentation`: A colimit presentation of `X` over `J` is a diagram `{Dᵢ}` in `C` and natural maps `sᵢ : Dᵢ ⟶ X` making `X` into the colimit of the `Dᵢ`. -- `CategoryTheory.Limits.ColimitPresentation.bind`: Given a colimit presentation of `X` and - colimit presentations of the components, this is the colimit presentation over the sigma type. - `CategoryTheory.Limits.LimitPresentation`: A limit presentation of `X` over `J` is a diagram `{Dᵢ}` in `C` and natural maps `sᵢ : X ⟶ Dᵢ` making `X` into the limit of the `Dᵢ`. @@ -99,135 +96,6 @@ def reindex (P : ColimitPresentation J X) {J' : Type*} [Category J'] (F : J' ⥤ ι := F.whiskerLeft P.ι isColimit := (Functor.Final.isColimitWhiskerEquiv F _).symm P.isColimit -section - -variable {J : Type*} {I : J → Type*} [Category J] [∀ j, Category (I j)] - {D : J ⥤ C} {P : ∀ j, ColimitPresentation (I j) (D.obj j)} - -set_option linter.unusedVariables false in -/-- The type underlying the category used in the construction of the composition -of colimit presentations. This is simply `Σ j, I j` but with a different category structure. -/ -@[nolint unusedArguments] -def Total (P : ∀ j, ColimitPresentation (I j) (D.obj j)) : Type _ := - Σ j, I j - -variable (P) in -/-- Constructor for `Total` to guide type checking. -/ -abbrev Total.mk (i : J) (k : I i) : Total P := ⟨i, k⟩ - -/-- Morphisms in the `Total` category. -/ -@[ext] -structure Total.Hom (k l : Total P) where - /-- The underlying morphism in the first component. -/ - base : k.1 ⟶ l.1 - /-- A morphism in `C`. -/ - hom : (P k.1).diag.obj k.2 ⟶ (P l.1).diag.obj l.2 - w : (P k.1).ι.app k.2 ≫ D.map base = hom ≫ (P l.1).ι.app l.2 := by cat_disch - -attribute [reassoc] Total.Hom.w - -/-- Composition of morphisms in the `Total` category. -/ -@[simps] -def Total.Hom.comp {k l m : Total P} (f : k.Hom l) (g : l.Hom m) : k.Hom m where - base := f.base ≫ g.base - hom := f.hom ≫ g.hom - w := by - simp only [Functor.const_obj_obj, Functor.map_comp, Category.assoc] - rw [f.w_assoc, g.w] - -@[simps! id_base id_hom comp_base comp_hom] -instance : Category (Total P) where - Hom := Total.Hom - id _ := { base := 𝟙 _, hom := 𝟙 _ } - comp := Total.Hom.comp - -instance [LocallySmall.{w} C] [LocallySmall.{w} J] : LocallySmall.{w} (Total P) where - hom_small k l := - let f (x : k ⟶ l) : (k.1 ⟶ l.1) × ((P k.1).diag.obj k.2 ⟶ (P l.1).diag.obj l.2) := - (x.base, x.hom) - small_of_injective (f := f) (by grind [Function.Injective, Total.Hom.ext]) - -section Small - -variable {J : Type w} {I : J → Type w} [SmallCategory J] [∀ j, SmallCategory (I j)] - {D : J ⥤ C} {P : ∀ j, ColimitPresentation (I j) (D.obj j)} - -lemma Total.exists_hom_of_hom {j j' : J} (i : I j) (u : j ⟶ j') - [IsFiltered (I j')] [IsFinitelyPresentable.{w} ((P j).diag.obj i)] : - ∃ (i' : I j') (f : Total.mk P j i ⟶ Total.mk P j' i'), f.base = u := by - obtain ⟨i', q, hq⟩ := IsFinitelyPresentable.exists_hom_of_isColimit (P j').isColimit - ((P j).ι.app i ≫ D.map u) - use i', { base := u, hom := q, w := by simp [← hq] } - -instance [IsFiltered J] [∀ j, IsFiltered (I j)] : Nonempty (Total P) := by - obtain ⟨j⟩ : Nonempty J := IsFiltered.nonempty - obtain ⟨i⟩ : Nonempty (I j) := IsFiltered.nonempty - exact ⟨⟨j, i⟩⟩ - -instance [IsFiltered J] [∀ j, IsFiltered (I j)] - [∀ j i, IsFinitelyPresentable.{w} ((P j).diag.obj i)] : - IsFiltered (Total P) where - cocone_objs k l := by - let a := IsFiltered.max k.1 l.1 - obtain ⟨a', f, hf⟩ := Total.exists_hom_of_hom (P := P) k.2 (IsFiltered.leftToMax k.1 l.1) - obtain ⟨b', g, hg⟩ := Total.exists_hom_of_hom (P := P) l.2 (IsFiltered.rightToMax k.1 l.1) - refine ⟨⟨a, IsFiltered.max a' b'⟩, ?_, ?_, trivial⟩ - · exact f ≫ { base := 𝟙 _, hom := (P _).diag.map (IsFiltered.leftToMax _ _) } - · exact g ≫ { base := 𝟙 _, hom := (P _).diag.map (IsFiltered.rightToMax _ _) } - cocone_maps {k l} f g := by - let a := IsFiltered.coeq f.base g.base - obtain ⟨a', u, hu⟩ := Total.exists_hom_of_hom (P := P) l.2 (IsFiltered.coeqHom f.base g.base) - have : (f.hom ≫ u.hom) ≫ (P _).ι.app _ = (g.hom ≫ u.hom) ≫ (P _).ι.app _ := by - simp only [Category.assoc, Functor.const_obj_obj, ← u.w, ← f.w_assoc, ← g.w_assoc] - rw [← Functor.map_comp, hu, IsFiltered.coeq_condition f.base g.base] - simp - obtain ⟨j, p, q, hpq⟩ := IsFinitelyPresentable.exists_eq_of_isColimit (P _).isColimit _ _ this - dsimp at p q - refine ⟨⟨a, IsFiltered.coeq p q⟩, - u ≫ { base := 𝟙 _, hom := (P _).diag.map (p ≫ IsFiltered.coeqHom p q) }, ?_⟩ - apply Total.Hom.ext - · simp [hu, IsFiltered.coeq_condition f.base g.base] - · rw [Category.assoc] at hpq - simp only [Functor.map_comp, comp_hom, reassoc_of% hpq] - simp [← Functor.map_comp, ← IsFiltered.coeq_condition] - -/-- If `P` is a colimit presentation over `J` of `X` and for every `j` we are given a colimit -presentation `Qⱼ` over `I j` of the `P.diag.obj j`, this is the refined colimit presentation of `X` -over `Total Q`. -/ -@[simps] -def bind {X : C} (P : ColimitPresentation J X) (Q : ∀ j, ColimitPresentation (I j) (P.diag.obj j)) - [∀ j, IsFiltered (I j)] [∀ j i, IsFinitelyPresentable.{w} ((Q j).diag.obj i)] : - ColimitPresentation (Total Q) X where - diag.obj k := (Q k.1).diag.obj k.2 - diag.map {k l} f := f.hom - ι.app k := (Q k.1).ι.app k.2 ≫ P.ι.app k.1 - ι.naturality {k l} u := by simp [← u.w_assoc] - isColimit.desc c := P.isColimit.desc - { pt := c.pt - ι.app j := (Q j).isColimit.desc - { pt := c.pt - ι.app i := c.ι.app ⟨j, i⟩ - ι.naturality {i i'} u := by - let v : Total.mk Q j i ⟶ .mk _ j i' := { base := 𝟙 _, hom := (Q _).diag.map u } - simpa using c.ι.naturality v } - ι.naturality {j j'} u := by - refine (Q j).isColimit.hom_ext fun i ↦ ?_ - simp only [Functor.const_obj_obj, Functor.const_obj_map, Category.comp_id, - (Q j).isColimit.fac] - obtain ⟨i', hom, rfl⟩ := Total.exists_hom_of_hom (P := Q) i u - rw [reassoc_of% hom.w, (Q j').isColimit.fac] - simpa using c.ι.naturality hom } - isColimit.fac := fun c ⟨j, i⟩ ↦ by simp [P.isColimit.fac, (Q j).isColimit.fac] - isColimit.uniq c m hm := by - refine P.isColimit.hom_ext fun j ↦ ?_ - simp only [Functor.const_obj_obj, P.isColimit.fac] - refine (Q j).isColimit.hom_ext fun i ↦ ?_ - simpa [(Q j).isColimit.fac] using hm (.mk _ j i) - -end Small - -end - end ColimitPresentation /-- A limit presentation of `X` over `J` is a diagram `{Dᵢ}` in `C` and natural maps diff --git a/Mathlib/CategoryTheory/Presentable/Presentation.lean b/Mathlib/CategoryTheory/Presentable/Presentation.lean new file mode 100644 index 00000000000000..f3559bc3fea8dd --- /dev/null +++ b/Mathlib/CategoryTheory/Presentable/Presentation.lean @@ -0,0 +1,149 @@ +/- +Copyright (c) 2025 Christian Merten. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Christian Merten +-/ +import Mathlib.CategoryTheory.Limits.Presentation +import Mathlib.CategoryTheory.Presentable.Finite + +/-! +# Presentation of a colimit of objects equipped with a presentation + +## Main definition: +- `CategoryTheory.Limits.ColimitPresentation.bind`: Given a colimit presentation of `X` and + colimit presentations of the components, this is the colimit presentation over the sigma type. + +-/ + +universe s t w v u + +namespace CategoryTheory.Limits.Presentation + +variable {C : Type u} [Category.{v} C] + +variable {J : Type*} {I : J → Type*} [Category J] [∀ j, Category (I j)] + {D : J ⥤ C} {P : ∀ j, ColimitPresentation (I j) (D.obj j)} + +set_option linter.unusedVariables false in +/-- The type underlying the category used in the construction of the composition +of colimit presentations. This is simply `Σ j, I j` but with a different category structure. -/ +@[nolint unusedArguments] +def Total (P : ∀ j, ColimitPresentation (I j) (D.obj j)) : Type _ := + Σ j, I j + +variable (P) in +/-- Constructor for `Total` to guide type checking. -/ +abbrev Total.mk (i : J) (k : I i) : Total P := ⟨i, k⟩ + +/-- Morphisms in the `Total` category. -/ +@[ext] +structure Total.Hom (k l : Total P) where + /-- The underlying morphism in the first component. -/ + base : k.1 ⟶ l.1 + /-- A morphism in `C`. -/ + hom : (P k.1).diag.obj k.2 ⟶ (P l.1).diag.obj l.2 + w : (P k.1).ι.app k.2 ≫ D.map base = hom ≫ (P l.1).ι.app l.2 := by cat_disch + +attribute [reassoc] Total.Hom.w + +/-- Composition of morphisms in the `Total` category. -/ +@[simps] +def Total.Hom.comp {k l m : Total P} (f : k.Hom l) (g : l.Hom m) : k.Hom m where + base := f.base ≫ g.base + hom := f.hom ≫ g.hom + w := by + simp only [Functor.const_obj_obj, Functor.map_comp, Category.assoc] + rw [f.w_assoc, g.w] + +@[simps! id_base id_hom comp_base comp_hom] +instance : Category (Total P) where + Hom := Total.Hom + id _ := { base := 𝟙 _, hom := 𝟙 _ } + comp := Total.Hom.comp + +instance [LocallySmall.{w} C] [LocallySmall.{w} J] : LocallySmall.{w} (Total P) where + hom_small k l := + let f (x : k ⟶ l) : (k.1 ⟶ l.1) × ((P k.1).diag.obj k.2 ⟶ (P l.1).diag.obj l.2) := + (x.base, x.hom) + small_of_injective (f := f) (by grind [Function.Injective, Total.Hom.ext]) + +section Small + +variable {J : Type w} {I : J → Type w} [SmallCategory J] [∀ j, SmallCategory (I j)] + {D : J ⥤ C} {P : ∀ j, ColimitPresentation (I j) (D.obj j)} + +lemma Total.exists_hom_of_hom {j j' : J} (i : I j) (u : j ⟶ j') + [IsFiltered (I j')] [IsFinitelyPresentable.{w} ((P j).diag.obj i)] : + ∃ (i' : I j') (f : Total.mk P j i ⟶ Total.mk P j' i'), f.base = u := by + obtain ⟨i', q, hq⟩ := IsFinitelyPresentable.exists_hom_of_isColimit (P j').isColimit + ((P j).ι.app i ≫ D.map u) + use i', { base := u, hom := q, w := by simp [← hq] } + +instance [IsFiltered J] [∀ j, IsFiltered (I j)] : Nonempty (Total P) := by + obtain ⟨j⟩ : Nonempty J := IsFiltered.nonempty + obtain ⟨i⟩ : Nonempty (I j) := IsFiltered.nonempty + exact ⟨⟨j, i⟩⟩ + +instance [IsFiltered J] [∀ j, IsFiltered (I j)] + [∀ j i, IsFinitelyPresentable.{w} ((P j).diag.obj i)] : + IsFiltered (Total P) where + cocone_objs k l := by + let a := IsFiltered.max k.1 l.1 + obtain ⟨a', f, hf⟩ := Total.exists_hom_of_hom (P := P) k.2 (IsFiltered.leftToMax k.1 l.1) + obtain ⟨b', g, hg⟩ := Total.exists_hom_of_hom (P := P) l.2 (IsFiltered.rightToMax k.1 l.1) + refine ⟨⟨a, IsFiltered.max a' b'⟩, ?_, ?_, trivial⟩ + · exact f ≫ { base := 𝟙 _, hom := (P _).diag.map (IsFiltered.leftToMax _ _) } + · exact g ≫ { base := 𝟙 _, hom := (P _).diag.map (IsFiltered.rightToMax _ _) } + cocone_maps {k l} f g := by + let a := IsFiltered.coeq f.base g.base + obtain ⟨a', u, hu⟩ := Total.exists_hom_of_hom (P := P) l.2 (IsFiltered.coeqHom f.base g.base) + have : (f.hom ≫ u.hom) ≫ (P _).ι.app _ = (g.hom ≫ u.hom) ≫ (P _).ι.app _ := by + simp only [Category.assoc, Functor.const_obj_obj, ← u.w, ← f.w_assoc, ← g.w_assoc] + rw [← Functor.map_comp, hu, IsFiltered.coeq_condition f.base g.base] + simp + obtain ⟨j, p, q, hpq⟩ := IsFinitelyPresentable.exists_eq_of_isColimit (P _).isColimit _ _ this + dsimp at p q + refine ⟨⟨a, IsFiltered.coeq p q⟩, + u ≫ { base := 𝟙 _, hom := (P _).diag.map (p ≫ IsFiltered.coeqHom p q) }, ?_⟩ + apply Total.Hom.ext + · simp [hu, IsFiltered.coeq_condition f.base g.base] + · rw [Category.assoc] at hpq + simp only [Functor.map_comp, comp_hom, reassoc_of% hpq] + simp [← Functor.map_comp, ← IsFiltered.coeq_condition] + +/-- If `P` is a colimit presentation over `J` of `X` and for every `j` we are given a colimit +presentation `Qⱼ` over `I j` of the `P.diag.obj j`, this is the refined colimit presentation of `X` +over `Total Q`. -/ +@[simps] +def bind {X : C} (P : ColimitPresentation J X) (Q : ∀ j, ColimitPresentation (I j) (P.diag.obj j)) + [∀ j, IsFiltered (I j)] [∀ j i, IsFinitelyPresentable.{w} ((Q j).diag.obj i)] : + ColimitPresentation (Total Q) X where + diag.obj k := (Q k.1).diag.obj k.2 + diag.map {k l} f := f.hom + ι.app k := (Q k.1).ι.app k.2 ≫ P.ι.app k.1 + ι.naturality {k l} u := by simp [← u.w_assoc] + isColimit.desc c := P.isColimit.desc + { pt := c.pt + ι.app j := (Q j).isColimit.desc + { pt := c.pt + ι.app i := c.ι.app ⟨j, i⟩ + ι.naturality {i i'} u := by + let v : Total.mk Q j i ⟶ .mk _ j i' := { base := 𝟙 _, hom := (Q _).diag.map u } + simpa using c.ι.naturality v } + ι.naturality {j j'} u := by + refine (Q j).isColimit.hom_ext fun i ↦ ?_ + simp only [Functor.const_obj_obj, Functor.const_obj_map, Category.comp_id, + (Q j).isColimit.fac] + obtain ⟨i', hom, rfl⟩ := Total.exists_hom_of_hom (P := Q) i u + rw [reassoc_of% hom.w, (Q j').isColimit.fac] + simpa using c.ι.naturality hom } + isColimit.fac := fun c ⟨j, i⟩ ↦ by simp [P.isColimit.fac, (Q j).isColimit.fac] + isColimit.uniq c m hm := by + refine P.isColimit.hom_ext fun j ↦ ?_ + simp only [Functor.const_obj_obj, P.isColimit.fac] + refine (Q j).isColimit.hom_ext fun i ↦ ?_ + simpa [(Q j).isColimit.fac] using hm (.mk _ j i) + +end Small + +end CategoryTheory.Limits.Presentation From 14ca7ef5b4619be3e524c5e5d23037b126037cb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 23 Sep 2025 10:04:59 +0200 Subject: [PATCH 24/69] added comment --- Mathlib/CategoryTheory/Limits/Presentation.lean | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Mathlib/CategoryTheory/Limits/Presentation.lean b/Mathlib/CategoryTheory/Limits/Presentation.lean index c780f2820eb747..58805b27d56fac 100644 --- a/Mathlib/CategoryTheory/Limits/Presentation.lean +++ b/Mathlib/CategoryTheory/Limits/Presentation.lean @@ -12,6 +12,9 @@ import Mathlib.CategoryTheory.Limits.Final Let `J` and `C` be categories and `X : C`. We define type `ColimitPresentation J X` that contains the data of objects `Dⱼ` and natural maps `sⱼ : Dⱼ ⟶ X` that make `X` the colimit of the `Dⱼ`. +(See `CategoryTheory.Presentable.Presentation` for the construction of a presentation +of a colimit of objects that are equipped with presentations.) + ## Main definitions: - `CategoryTheory.Limits.ColimitPresentation`: A colimit presentation of `X` over `J` is a diagram From 43c5d3b0d35b3f5ef25a6a2923f8f5ee5be58ebe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 23 Sep 2025 10:09:48 +0200 Subject: [PATCH 25/69] fix --- Mathlib/CategoryTheory/Limits/Presentation.lean | 2 +- Mathlib/CategoryTheory/ObjectProperty/Ind.lean | 2 +- .../{Presentation.lean => ColimitPresentation.lean} | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) rename Mathlib/CategoryTheory/Presentable/{Presentation.lean => ColimitPresentation.lean} (98%) diff --git a/Mathlib/CategoryTheory/Limits/Presentation.lean b/Mathlib/CategoryTheory/Limits/Presentation.lean index 58805b27d56fac..07f8228ee0ed34 100644 --- a/Mathlib/CategoryTheory/Limits/Presentation.lean +++ b/Mathlib/CategoryTheory/Limits/Presentation.lean @@ -12,7 +12,7 @@ import Mathlib.CategoryTheory.Limits.Final Let `J` and `C` be categories and `X : C`. We define type `ColimitPresentation J X` that contains the data of objects `Dⱼ` and natural maps `sⱼ : Dⱼ ⟶ X` that make `X` the colimit of the `Dⱼ`. -(See `CategoryTheory.Presentable.Presentation` for the construction of a presentation +(See `CategoryTheory.Presentable.ColimitPresentation` for the construction of a presentation of a colimit of objects that are equipped with presentations.) ## Main definitions: diff --git a/Mathlib/CategoryTheory/ObjectProperty/Ind.lean b/Mathlib/CategoryTheory/ObjectProperty/Ind.lean index a75990f41975a2..0a4d5efc16050e 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/Ind.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/Ind.lean @@ -3,7 +3,7 @@ Copyright (c) 2025 Christian Merten. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Christian Merten -/ -import Mathlib.CategoryTheory.Limits.Presentation +import Mathlib.CategoryTheory.Presentable.ColimitPresentation /-! # Ind and pro-properties diff --git a/Mathlib/CategoryTheory/Presentable/Presentation.lean b/Mathlib/CategoryTheory/Presentable/ColimitPresentation.lean similarity index 98% rename from Mathlib/CategoryTheory/Presentable/Presentation.lean rename to Mathlib/CategoryTheory/Presentable/ColimitPresentation.lean index f3559bc3fea8dd..078c4c992b3b2f 100644 --- a/Mathlib/CategoryTheory/Presentable/Presentation.lean +++ b/Mathlib/CategoryTheory/Presentable/ColimitPresentation.lean @@ -17,7 +17,7 @@ import Mathlib.CategoryTheory.Presentable.Finite universe s t w v u -namespace CategoryTheory.Limits.Presentation +namespace CategoryTheory.Limits.ColimitPresentation variable {C : Type u} [Category.{v} C] @@ -146,4 +146,4 @@ def bind {X : C} (P : ColimitPresentation J X) (Q : ∀ j, ColimitPresentation ( end Small -end CategoryTheory.Limits.Presentation +end CategoryTheory.Limits.ColimitPresentation From d8abddaa130d0d7eded565ff7ebdeecf44e63ffc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 23 Sep 2025 10:09:55 +0200 Subject: [PATCH 26/69] updated Mathlib.lean --- Mathlib.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib.lean b/Mathlib.lean index 3dc3a101b1e50e..b8657ebff497b7 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -2680,11 +2680,11 @@ import Mathlib.CategoryTheory.Preadditive.Yoneda.Limits import Mathlib.CategoryTheory.Preadditive.Yoneda.Projective import Mathlib.CategoryTheory.Presentable.Basic import Mathlib.CategoryTheory.Presentable.CardinalFilteredPresentation +import Mathlib.CategoryTheory.Presentable.ColimitPresentation import Mathlib.CategoryTheory.Presentable.Finite import Mathlib.CategoryTheory.Presentable.IsCardinalFiltered import Mathlib.CategoryTheory.Presentable.Limits import Mathlib.CategoryTheory.Presentable.LocallyPresentable -import Mathlib.CategoryTheory.Presentable.Presentation import Mathlib.CategoryTheory.Products.Associator import Mathlib.CategoryTheory.Products.Basic import Mathlib.CategoryTheory.Products.Bifunctor From 4a167544549fc4bb0e6de8750972701e681e1b78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 23 Sep 2025 10:25:38 +0200 Subject: [PATCH 27/69] wip --- .../CategoryTheory/Comma/CardinalArrow.lean | 21 ------------------- Mathlib/CategoryTheory/EssentiallySmall.lean | 21 +++++++++++++++++++ 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Mathlib/CategoryTheory/Comma/CardinalArrow.lean b/Mathlib/CategoryTheory/Comma/CardinalArrow.lean index 37e402c8ff1b49..4d0290c5aaf0ce 100644 --- a/Mathlib/CategoryTheory/Comma/CardinalArrow.lean +++ b/Mathlib/CategoryTheory/Comma/CardinalArrow.lean @@ -105,25 +105,4 @@ lemma hasCardinalLT_of_hasCardinalLT_arrow HasCardinalLT C κ := h.of_injective (fun X ↦ Arrow.mk (𝟙 X)) (fun _ _ h ↦ congr_arg Comma.left h) -instance {C : Type u} [Category.{v} C] [Small.{w} C] [LocallySmall.{w} C] : - Small.{w} (Arrow C) := by - let φ (f : Arrow C) : Σ (s t : C), s ⟶ t := ⟨_, _, f.hom⟩ - refine small_of_injective (f := φ) ?_ - rintro ⟨s, t, f⟩ ⟨s', t', f'⟩ h - obtain rfl : s = s' := congr_arg Sigma.fst h - simp only [Functor.id_obj, Sigma.mk.injEq, heq_eq_eq, true_and, φ] at h - obtain rfl : t = t' := h.1 - obtain rfl : f = f' := by simpa using h - rfl - -instance {C : Type u} [Category.{v} C] [Small.{w} C] [LocallySmall.{w} C] - {D : Type u'} [Category.{v'} D] [Small.{w} D] [LocallySmall.{w} D] : - Small.{w} (C ⥤ D) := by - refine small_of_injective (f := fun F (f : Arrow C) ↦ Arrow.mk (F.map f.hom)) - (fun F G h ↦ Functor.ext (fun X ↦ ?_) (fun X Y f ↦ ?_)) - · exact congr_arg Comma.left (congr_fun h (Arrow.mk (𝟙 X))) - · have : Arrow.mk (F.map f) = Arrow.mk (G.map f) := congr_fun h (Arrow.mk f) - rw [Arrow.mk_eq_mk_iff] at this - tauto - end CategoryTheory diff --git a/Mathlib/CategoryTheory/EssentiallySmall.lean b/Mathlib/CategoryTheory/EssentiallySmall.lean index 89ceec80664724..5f45b254ec9817 100644 --- a/Mathlib/CategoryTheory/EssentiallySmall.lean +++ b/Mathlib/CategoryTheory/EssentiallySmall.lean @@ -6,6 +6,7 @@ Authors: Kim Morrison import Mathlib.CategoryTheory.Category.ULift import Mathlib.CategoryTheory.EqToHom import Mathlib.CategoryTheory.Skeletal +import Mathlib.CategoryTheory.Comma.Arrow import Mathlib.Logic.UnivLE import Mathlib.Logic.Small.Basic @@ -267,4 +268,24 @@ theorem essentiallySmall_iff_of_thin {C : Type u} [Category.{v} C] [Quiver.IsThi instance [Small.{w} C] : Small.{w} (Discrete C) := small_map discreteEquiv +instance [Small.{w} C] [LocallySmall.{w} C] : Small.{w} (Arrow C) := by + let φ (f : Arrow C) : Σ (s t : C), s ⟶ t := ⟨_, _, f.hom⟩ + refine small_of_injective (f := φ) ?_ + rintro ⟨s, t, f⟩ ⟨s', t', f'⟩ h + obtain rfl : s = s' := congr_arg Sigma.fst h + simp only [Functor.id_obj, Sigma.mk.injEq, heq_eq_eq, true_and, φ] at h + obtain rfl : t = t' := h.1 + obtain rfl : f = f' := by simpa using h + rfl + +instance [Small.{w} C] [LocallySmall.{w} C] + {D : Type u'} [Category.{v'} D] [Small.{w} D] [LocallySmall.{w} D] : + Small.{w} (C ⥤ D) := by + refine small_of_injective (f := fun F (f : Arrow C) ↦ Arrow.mk (F.map f.hom)) + (fun F G h ↦ Functor.ext (fun X ↦ ?_) (fun X Y f ↦ ?_)) + · exact congr_arg Comma.left (congr_fun h (Arrow.mk (𝟙 X))) + · have : Arrow.mk (F.map f) = Arrow.mk (G.map f) := congr_fun h (Arrow.mk f) + rw [Arrow.mk_eq_mk_iff] at this + tauto + end CategoryTheory From 98b8c689728c0cc69cc25b531eac1361867ec0a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= <37772949+joelriou@users.noreply.github.com> Date: Tue, 23 Sep 2025 13:58:08 +0200 Subject: [PATCH 28/69] Update Mathlib/CategoryTheory/Limits/Presentation.lean Co-authored-by: Christian Merten <136261474+chrisflav@users.noreply.github.com> --- Mathlib/CategoryTheory/Limits/Presentation.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Limits/Presentation.lean b/Mathlib/CategoryTheory/Limits/Presentation.lean index cbf8d56a9b2c25..40e5f6d6293ca4 100644 --- a/Mathlib/CategoryTheory/Limits/Presentation.lean +++ b/Mathlib/CategoryTheory/Limits/Presentation.lean @@ -237,7 +237,7 @@ structure LimitPresentation (J : Type w) [Category.{t} J] (X : C) where diag : J ⥤ C /-- The natural maps `sᵢ : X ⟶ Dᵢ`. -/ π : (Functor.const J).obj X ⟶ diag - /-- `X` is the colimit of the `Dᵢ` via `sᵢ`. -/ + /-- `X` is the limit of the `Dᵢ` via `sᵢ`. -/ isLimit : IsLimit (Cone.mk _ π) variable {J : Type w} [Category.{t} J] {X : C} From 733dbd9d7604f16ac0f4d7131fcedd74566102b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= <37772949+joelriou@users.noreply.github.com> Date: Tue, 23 Sep 2025 13:58:20 +0200 Subject: [PATCH 29/69] Update Mathlib/CategoryTheory/Limits/Presentation.lean Co-authored-by: Christian Merten <136261474+chrisflav@users.noreply.github.com> --- Mathlib/CategoryTheory/Limits/Presentation.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Limits/Presentation.lean b/Mathlib/CategoryTheory/Limits/Presentation.lean index 40e5f6d6293ca4..1688b0d5cde987 100644 --- a/Mathlib/CategoryTheory/Limits/Presentation.lean +++ b/Mathlib/CategoryTheory/Limits/Presentation.lean @@ -77,7 +77,7 @@ def map (P : ColimitPresentation J X) {D : Type*} [Category D] (F : C ⥤ D) /-- If `P` is a colimit presentation of `X`, it is possible to define another colimit presentation of `X` where `P.diag` is replaced by an isomorphic functor. -/ @[simps] -def chgDiag (P : ColimitPresentation J X) {F : J ⥤ C} (e : F ≅ P.diag) : +def changeDiag (P : ColimitPresentation J X) {F : J ⥤ C} (e : F ≅ P.diag) : ColimitPresentation J X where diag := F ι := e.hom ≫ P.ι From 3c9f5e8261d9582504510e5a8351165ce10d71fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= <37772949+joelriou@users.noreply.github.com> Date: Tue, 23 Sep 2025 13:58:27 +0200 Subject: [PATCH 30/69] Update Mathlib/CategoryTheory/Limits/Presentation.lean Co-authored-by: Christian Merten <136261474+chrisflav@users.noreply.github.com> --- Mathlib/CategoryTheory/Limits/Presentation.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Limits/Presentation.lean b/Mathlib/CategoryTheory/Limits/Presentation.lean index 1688b0d5cde987..1dcd6dd964bfac 100644 --- a/Mathlib/CategoryTheory/Limits/Presentation.lean +++ b/Mathlib/CategoryTheory/Limits/Presentation.lean @@ -274,7 +274,7 @@ def map (P : LimitPresentation J X) {D : Type*} [Category D] (F : C ⥤ D) /-- If `P` is a limit presentation of `X`, it is possible to define another limit presentation of `X` where `P.diag` is replaced by an isomorphic functor. -/ @[simps] -def chgDiag (P : LimitPresentation J X) {F : J ⥤ C} (e : F ≅ P.diag) : +def changeDiag (P : LimitPresentation J X) {F : J ⥤ C} (e : F ≅ P.diag) : LimitPresentation J X where diag := F π := P.π ≫ e.inv From cfa51399571968c75f925f3171e08b2bb6fddb6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= <37772949+joelriou@users.noreply.github.com> Date: Tue, 23 Sep 2025 15:07:30 +0200 Subject: [PATCH 31/69] Update Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean Co-authored-by: Christian Merten <136261474+chrisflav@users.noreply.github.com> --- Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean b/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean index 208eedb4fedf75..8b3d20c31914dc 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean @@ -69,7 +69,7 @@ variable {P J} /-- If `F : J ⥤ C` is a functor that has a colimit and is such that for all `j`, `F.obj j` satisfies a property `P`, then this structure expresses that `colimit F` -is indeed a colimits of objects satisfying `P`. -/ +is indeed a colimit of objects satisfying `P`. -/ noncomputable def colimit (F : J ⥤ C) [HasColimit F] (hF : ∀ j, P (F.obj j)) : P.ColimitOfShape J (colimit F) where diag := F From 579a4cc77177c9ff0cb079687f396714cb774d79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 23 Sep 2025 15:08:54 +0200 Subject: [PATCH 32/69] removed unnecessary universe --- Mathlib/CategoryTheory/ObjectProperty/FullSubcategory.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/ObjectProperty/FullSubcategory.lean b/Mathlib/CategoryTheory/ObjectProperty/FullSubcategory.lean index 6b1ca7ff95c27b..b0e74c7e4521ce 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/FullSubcategory.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/FullSubcategory.lean @@ -15,7 +15,7 @@ of objects in `C` satisfying `P`. -/ -universe w v v' u u' +universe v v' u u' namespace CategoryTheory From 6e01466ff8df32c1eb0a7df9be04ad84e13eb80d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 23 Sep 2025 15:17:51 +0200 Subject: [PATCH 33/69] suggestions by chrisflav --- Mathlib/CategoryTheory/Limits/Presentation.lean | 16 ++++++++++++++++ .../ObjectProperty/ColimitsOfShape.lean | 7 +++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/Mathlib/CategoryTheory/Limits/Presentation.lean b/Mathlib/CategoryTheory/Limits/Presentation.lean index 1dcd6dd964bfac..0ffaeabc9a4cbc 100644 --- a/Mathlib/CategoryTheory/Limits/Presentation.lean +++ b/Mathlib/CategoryTheory/Limits/Presentation.lean @@ -64,6 +64,14 @@ def self (X : C) : ColimitPresentation PUnit.{s + 1} X where ι := 𝟙 _ isColimit := isColimitConstCocone _ _ +/-- If `F : J ⥤ C` is a functor that has a colimit, then this is the obvious +colimit presentation of `colimit F`. -/ +noncomputable def colimit (F : J ⥤ C) [HasColimit F] : + ColimitPresentation J (colimit F) where + diag := F + ι := _ + isColimit := colimit.isColimit _ + /-- If `F` preserves colimits of shape `J`, it maps colimit presentations of `X` to colimit presentations of `F(X)`. -/ @[simps] @@ -261,6 +269,14 @@ def self (X : C) : LimitPresentation PUnit.{s + 1} X where π := 𝟙 _ isLimit := isLimitConstCone _ _ +/-- If `F : J ⥤ C` is a functor that has a limit, then this is the obvious +limit presentation of `limit F`. -/ +noncomputable def limit (F : J ⥤ C) [HasLimit F] : + LimitPresentation J (limit F) where + diag := F + π := _ + isLimit := limit.isLimit _ + /-- If `F` preserves limits of shape `J`, it maps limit presentations of `X` to limit presentations of `F(X)`. -/ @[simps] diff --git a/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean b/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean index 8b3d20c31914dc..f9980eb8d979f2 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean @@ -70,11 +70,10 @@ variable {P J} /-- If `F : J ⥤ C` is a functor that has a colimit and is such that for all `j`, `F.obj j` satisfies a property `P`, then this structure expresses that `colimit F` is indeed a colimit of objects satisfying `P`. -/ +@[simps toColimitPresentation] noncomputable def colimit (F : J ⥤ C) [HasColimit F] (hF : ∀ j, P (F.obj j)) : P.ColimitOfShape J (colimit F) where - diag := F - ι := _ - isColimit := colimit.isColimit _ + toColimitPresentation := .colimit F prop_diag_obj := hF /-- If `X` is a colimit indexed by `J` of objects satisfying a property `P`, then @@ -137,7 +136,7 @@ lemma colimitsOfShape_isoClosure : intro X ⟨h⟩ choose obj h₁ h₂ using h.prop_diag_obj exact - ⟨{ toColimitPresentation := h.chgDiag (h.diag.isoCopyObj obj (fun j ↦ (h₂ j).some)).symm + ⟨{ toColimitPresentation := h.changeDiag (h.diag.isoCopyObj obj (fun j ↦ (h₂ j).some)).symm prop_diag_obj := h₁ }⟩ instance [ObjectProperty.Small.{w} P] [LocallySmall.{w} C] [Small.{w} J] [LocallySmall.{w} J] : From e55e768aebc08f267fd5ecbb394186e50548a1b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 23 Sep 2025 15:20:06 +0200 Subject: [PATCH 34/69] move definitions to a file with fewer imports --- .../CategoryTheory/Comma/CardinalArrow.lean | 23 +------------------ Mathlib/CategoryTheory/EssentiallySmall.lean | 22 ++++++++++++++++++ 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/Mathlib/CategoryTheory/Comma/CardinalArrow.lean b/Mathlib/CategoryTheory/Comma/CardinalArrow.lean index 37e402c8ff1b49..0d4e57798f5bd5 100644 --- a/Mathlib/CategoryTheory/Comma/CardinalArrow.lean +++ b/Mathlib/CategoryTheory/Comma/CardinalArrow.lean @@ -18,7 +18,7 @@ If `A` is a (small) category, `Arrow C` is finite iff `FinCategory C` holds. -/ -universe w w' v' u' v u +universe w w' v u namespace CategoryTheory @@ -105,25 +105,4 @@ lemma hasCardinalLT_of_hasCardinalLT_arrow HasCardinalLT C κ := h.of_injective (fun X ↦ Arrow.mk (𝟙 X)) (fun _ _ h ↦ congr_arg Comma.left h) -instance {C : Type u} [Category.{v} C] [Small.{w} C] [LocallySmall.{w} C] : - Small.{w} (Arrow C) := by - let φ (f : Arrow C) : Σ (s t : C), s ⟶ t := ⟨_, _, f.hom⟩ - refine small_of_injective (f := φ) ?_ - rintro ⟨s, t, f⟩ ⟨s', t', f'⟩ h - obtain rfl : s = s' := congr_arg Sigma.fst h - simp only [Functor.id_obj, Sigma.mk.injEq, heq_eq_eq, true_and, φ] at h - obtain rfl : t = t' := h.1 - obtain rfl : f = f' := by simpa using h - rfl - -instance {C : Type u} [Category.{v} C] [Small.{w} C] [LocallySmall.{w} C] - {D : Type u'} [Category.{v'} D] [Small.{w} D] [LocallySmall.{w} D] : - Small.{w} (C ⥤ D) := by - refine small_of_injective (f := fun F (f : Arrow C) ↦ Arrow.mk (F.map f.hom)) - (fun F G h ↦ Functor.ext (fun X ↦ ?_) (fun X Y f ↦ ?_)) - · exact congr_arg Comma.left (congr_fun h (Arrow.mk (𝟙 X))) - · have : Arrow.mk (F.map f) = Arrow.mk (G.map f) := congr_fun h (Arrow.mk f) - rw [Arrow.mk_eq_mk_iff] at this - tauto - end CategoryTheory diff --git a/Mathlib/CategoryTheory/EssentiallySmall.lean b/Mathlib/CategoryTheory/EssentiallySmall.lean index 89ceec80664724..92244a42c6797d 100644 --- a/Mathlib/CategoryTheory/EssentiallySmall.lean +++ b/Mathlib/CategoryTheory/EssentiallySmall.lean @@ -6,6 +6,7 @@ Authors: Kim Morrison import Mathlib.CategoryTheory.Category.ULift import Mathlib.CategoryTheory.EqToHom import Mathlib.CategoryTheory.Skeletal +import Mathlib.CategoryTheory.Comma.Arrow import Mathlib.Logic.UnivLE import Mathlib.Logic.Small.Basic @@ -267,4 +268,25 @@ theorem essentiallySmall_iff_of_thin {C : Type u} [Category.{v} C] [Quiver.IsThi instance [Small.{w} C] : Small.{w} (Discrete C) := small_map discreteEquiv +instance [Small.{w} C] [LocallySmall.{w} C] : + Small.{w} (Arrow C) := by + let φ (f : Arrow C) : Σ (s t : C), s ⟶ t := ⟨_, _, f.hom⟩ + refine small_of_injective (f := φ) ?_ + rintro ⟨s, t, f⟩ ⟨s', t', f'⟩ h + obtain rfl : s = s' := congr_arg Sigma.fst h + simp only [Functor.id_obj, Sigma.mk.injEq, heq_eq_eq, true_and, φ] at h + obtain rfl : t = t' := h.1 + obtain rfl : f = f' := by simpa using h + rfl + +instance [Small.{w} C] [LocallySmall.{w} C] + {D : Type u'} [Category.{v'} D] [Small.{w} D] [LocallySmall.{w} D] : + Small.{w} (C ⥤ D) := by + refine small_of_injective (f := fun F (f : Arrow C) ↦ Arrow.mk (F.map f.hom)) + (fun F G h ↦ Functor.ext (fun X ↦ ?_) (fun X Y f ↦ ?_)) + · exact congr_arg Comma.left (congr_fun h (Arrow.mk (𝟙 X))) + · have : Arrow.mk (F.map f) = Arrow.mk (G.map f) := congr_fun h (Arrow.mk f) + rw [Arrow.mk_eq_mk_iff] at this + tauto + end CategoryTheory From 97379ae5c2fe55c8a1e05b4d2eb450041497e31c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= <37772949+joelriou@users.noreply.github.com> Date: Sun, 28 Sep 2025 08:03:33 +0200 Subject: [PATCH 35/69] Update Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean Co-authored-by: Christian Merten <136261474+chrisflav@users.noreply.github.com> --- Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean b/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean index f9980eb8d979f2..5d1de1d23c456d 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean @@ -59,7 +59,7 @@ lemma strictColimitsOfShape_monotone {Q : ObjectProperty C} (h : P ≤ Q) : exact ⟨F, fun j ↦ h _ (hF j)⟩ /-- A structure expressing that `X : C` is the colimit of a functor -`diag : J ⥤ C` such that `P (diag.obj j)` hold for all `j`. -/ +`diag : J ⥤ C` such that `P (diag.obj j)` holds for all `j`. -/ structure ColimitOfShape (X : C) extends ColimitPresentation J X where prop_diag_obj (j : J) : P (diag.obj j) From 1d4d02b24bcb1a032b3b53387ba9597c8ba74c5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= <37772949+joelriou@users.noreply.github.com> Date: Sun, 28 Sep 2025 08:03:44 +0200 Subject: [PATCH 36/69] Update Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean Co-authored-by: Christian Merten <136261474+chrisflav@users.noreply.github.com> --- Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean b/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean index 5d1de1d23c456d..073b04318a0048 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean @@ -85,7 +85,7 @@ def ofIso {X : C} (h : P.ColimitOfShape J X) {Y : C} (e : X ≅ Y) : prop_diag_obj := h.prop_diag_obj /-- If `X` is a colimit indexed by `J` of objects satisfying a property `P`, -it is also a colimit indexed by `J` of objects satisfyind `Q` if `P ≤ Q`. -/ +it is also a colimit indexed by `J` of objects satisfying `Q` if `P ≤ Q`. -/ @[simps toColimitPresentation] def ofLE {X : C} (h : P.ColimitOfShape J X) {Q : ObjectProperty C} (hPQ : P ≤ Q) : Q.ColimitOfShape J X where From b0c3cb9d4f41262b1ad1b983d4fe6c3858d7be32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sun, 28 Sep 2025 08:33:19 +0200 Subject: [PATCH 37/69] Small.of_le --- Mathlib/CategoryTheory/ObjectProperty/Basic.lean | 2 +- Mathlib/CategoryTheory/ObjectProperty/Small.lean | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/ObjectProperty/Basic.lean b/Mathlib/CategoryTheory/ObjectProperty/Basic.lean index 7ba505f5b7ef31..7cf7a47eb945ba 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/Basic.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/Basic.lean @@ -23,7 +23,7 @@ for predicates `C → Prop`. -/ -universe w v v' u u' +universe v v' u u' namespace CategoryTheory diff --git a/Mathlib/CategoryTheory/ObjectProperty/Small.lean b/Mathlib/CategoryTheory/ObjectProperty/Small.lean index cc03da79e5e803..8a6d51a297e453 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/Small.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/Small.lean @@ -25,4 +25,8 @@ instance (P : ObjectProperty C) [ObjectProperty.Small.{w} P] : Small.{w} P.FullSubcategory := small_of_surjective (f := fun (x : Subtype P) ↦ ⟨x.1, x.2⟩) (fun x ↦ ⟨⟨x.1, x.2⟩, rfl⟩) +lemma Small.of_le {P Q : ObjectProperty C} [ObjectProperty.Small.{w} Q] (h : P ≤ Q) : + ObjectProperty.Small.{w} P := + small_of_injective (Subtype.map_injective h Function.injective_id) + end CategoryTheory.ObjectProperty From 87ad9d89648d8feee5aa0aace14384eab6e6e470 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sun, 28 Sep 2025 11:43:42 +0200 Subject: [PATCH 38/69] added docstring --- Mathlib/CategoryTheory/ObjectProperty/Small.lean | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Mathlib/CategoryTheory/ObjectProperty/Small.lean b/Mathlib/CategoryTheory/ObjectProperty/Small.lean index 8a6d51a297e453..219836199cabcb 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/Small.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/Small.lean @@ -9,6 +9,9 @@ import Mathlib.Logic.Small.Basic /-! # Smallness of a property of objects +In this file, given `P : ObjectProperty C`, we define +`ObjectProperty.Small.{w} P` as an abbreviation for `Small.{w} (Subtype P)`. + -/ universe w v u From 34e7f3860e5bfd5d1580ce69cce141b0fe022e4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sun, 28 Sep 2025 15:12:38 +0200 Subject: [PATCH 39/69] small fixes --- .../CategoryTheory/ObjectProperty/LimitsOfShape.lean | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Mathlib/CategoryTheory/ObjectProperty/LimitsOfShape.lean b/Mathlib/CategoryTheory/ObjectProperty/LimitsOfShape.lean index 2aa869edfeca3e..16a0461814b681 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/LimitsOfShape.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/LimitsOfShape.lean @@ -53,7 +53,7 @@ lemma strictLimitsOfShape_monotone {Q : ObjectProperty C} (h : P ≤ Q) : exact ⟨F, fun j ↦ h _ (hF j)⟩ /-- A structure expressing that `X : C` is the limit of a functor -`diag : J ⥤ C` such that `P (diag.obj j)` hold for all `j`. -/ +`diag : J ⥤ C` such that `P (diag.obj j)` holds for all `j`. -/ structure LimitOfShape (X : C) extends LimitPresentation J X where prop_diag_obj (j : J) : P (diag.obj j) @@ -63,12 +63,10 @@ variable {P J} /-- If `F : J ⥤ C` is a functor that has a limit and is such that for all `j`, `F.obj j` satisfies a property `P`, then this structure expresses that `limit F` -is indeed a limits of objects satisfying `P`. -/ +is indeed a limit of objects satisfying `P`. -/ noncomputable def limit (F : J ⥤ C) [HasLimit F] (hF : ∀ j, P (F.obj j)) : P.LimitOfShape J (limit F) where - diag := F - π := _ - isLimit := limit.isLimit _ + toLimitPresentation := .limit F prop_diag_obj := hF /-- If `X` is a limit indexed by `J` of objects satisfying a property `P`, then @@ -80,7 +78,7 @@ def ofIso {X : C} (h : P.LimitOfShape J X) {Y : C} (e : X ≅ Y) : prop_diag_obj := h.prop_diag_obj /-- If `X` is a limit indexed by `J` of objects satisfying a property `P`, -it is also a limit indexed by `J` of objects satisfyind `Q` if `P ≤ Q`. -/ +it is also a limit indexed by `J` of objects satisfying `Q` if `P ≤ Q`. -/ @[simps toLimitPresentation] def ofLE {X : C} (h : P.LimitOfShape J X) {Q : ObjectProperty C} (hPQ : P ≤ Q) : Q.LimitOfShape J X where @@ -131,7 +129,7 @@ lemma limitsOfShape_isoClosure : intro X ⟨h⟩ choose obj h₁ h₂ using h.prop_diag_obj exact - ⟨{ toLimitPresentation := h.chgDiag (h.diag.isoCopyObj obj (fun j ↦ (h₂ j).some)).symm + ⟨{ toLimitPresentation := h.changeDiag (h.diag.isoCopyObj obj (fun j ↦ (h₂ j).some)).symm prop_diag_obj := h₁ }⟩ instance [ObjectProperty.Small.{w} P] [LocallySmall.{w} C] [Small.{w} J] [LocallySmall.{w} J] : From db206120e5f393368abd0d0ff987d7120cf15912 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 2 Oct 2025 17:35:01 +0200 Subject: [PATCH 40/69] fix --- .../CategoryTheory/Subobject/MonoOver.lean | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/Mathlib/CategoryTheory/Subobject/MonoOver.lean b/Mathlib/CategoryTheory/Subobject/MonoOver.lean index d9bf1092ebc376..cfeff57fb102ca 100644 --- a/Mathlib/CategoryTheory/Subobject/MonoOver.lean +++ b/Mathlib/CategoryTheory/Subobject/MonoOver.lean @@ -212,28 +212,25 @@ section Limits variable {J : Type u₃} [Category.{v₃} J] (X : C) -lemma closedUnderLimitsOfShape_isMono : - ClosedUnderLimitsOfShape J (Over.isMono X) := by - refine fun F _ hc p ↦ ⟨fun g h e ↦ ?_⟩ - apply IsLimit.hom_ext <| WithTerminal.isLimitEquiv.invFun hc - intro j; cases j with - | of j => have := p j; rw [← cancel_mono ((F.obj j).hom)]; simpa - | star => exact e +instance : (Over.isMono X).IsClosedUnderLimitsOfShape J where + limitsOfShape_le := fun F ⟨p, hp⟩ ↦ ⟨fun g h e ↦ by + refine (WithTerminal.isLimitEquiv.invFun p.isLimit).hom_ext (fun j ↦ ?_) + cases j with + | of j => have := hp j; rw [← cancel_mono ((p.diag.obj j).hom)]; simpa + | star => exact e⟩ instance hasLimit (F : J ⥤ MonoOver X) [HasLimit (F ⋙ (Over.isMono X).ι)] : - HasLimit F := by - apply hasLimit_of_closedUnderLimits (closedUnderLimitsOfShape_isMono X) + HasLimit F := + hasLimit_of_closedUnderLimits _ _ _ instance hasLimitsOfShape [HasLimitsOfShape J (Over X)] : - HasLimitsOfShape J (MonoOver X) := by - apply hasLimitsOfShape_of_closedUnderLimits (closedUnderLimitsOfShape_isMono X) + HasLimitsOfShape J (MonoOver X) where instance hasFiniteLimits [HasFiniteLimits (Over X)] : HasFiniteLimits (MonoOver X) where - out _ _ _ := by apply hasLimitsOfShape X + out _ _ _ := inferInstance instance hasLimitsOfSize [HasLimitsOfSize.{w, w'} (Over X)] : HasLimitsOfSize.{w, w'} (MonoOver X) where - has_limits_of_shape _ _ := by apply hasLimitsOfShape X end Limits From 36bfb71457e860f202bd8d7cd6ddd4d68e9af177 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 2 Oct 2025 21:07:58 +0200 Subject: [PATCH 41/69] fixing imports --- Mathlib/CategoryTheory/Limits/Indization/Equalizers.lean | 2 +- Mathlib/CategoryTheory/Limits/MorphismProperty.lean | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Mathlib/CategoryTheory/Limits/Indization/Equalizers.lean b/Mathlib/CategoryTheory/Limits/Indization/Equalizers.lean index fe8cf0c30e86ca..4647cfef2ec690 100644 --- a/Mathlib/CategoryTheory/Limits/Indization/Equalizers.lean +++ b/Mathlib/CategoryTheory/Limits/Indization/Equalizers.lean @@ -4,8 +4,8 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Markus Himmel -/ import Mathlib.CategoryTheory.Limits.Indization.FilteredColimits -import Mathlib.CategoryTheory.Limits.FullSubcategory import Mathlib.CategoryTheory.Limits.Indization.ParallelPair +import Mathlib.CategoryTheory.ObjectProperty.LimitsOfShape /-! # Equalizers of ind-objects diff --git a/Mathlib/CategoryTheory/Limits/MorphismProperty.lean b/Mathlib/CategoryTheory/Limits/MorphismProperty.lean index 87f5457db08ff5..7439ed81bdc010 100644 --- a/Mathlib/CategoryTheory/Limits/MorphismProperty.lean +++ b/Mathlib/CategoryTheory/Limits/MorphismProperty.lean @@ -5,9 +5,9 @@ Authors: Christian Merten -/ import Mathlib.CategoryTheory.Limits.Comma import Mathlib.CategoryTheory.Limits.Constructions.Over.Basic -import Mathlib.CategoryTheory.Limits.FullSubcategory import Mathlib.CategoryTheory.MorphismProperty.Comma import Mathlib.CategoryTheory.MorphismProperty.Limits +import Mathlib.CategoryTheory.ObjectProperty.ColimitsOfShape import Mathlib.CategoryTheory.ObjectProperty.LimitsOfShape /-! From df36a4c3b0c80216366efba7a482ffcef3fd742e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 3 Oct 2025 13:34:54 +0200 Subject: [PATCH 42/69] feat(CategoryTheory/ObjectProperty): closure under colimits --- Mathlib.lean | 2 + .../ObjectProperty/ColimitsClosure.lean | 91 ++++++++++ .../ObjectProperty/ColimitsOfShape.lean | 167 +++++++++++++++++- .../ObjectProperty/CompleteLattice.lean | 14 +- .../ObjectProperty/LimitsClosure.lean | 1 + .../ObjectProperty/LimitsOfShape.lean | 33 +++- .../ObjectProperty/Opposite.lean | 76 ++++++++ .../CategoryTheory/ObjectProperty/Small.lean | 46 +++++ 8 files changed, 427 insertions(+), 3 deletions(-) create mode 100644 Mathlib/CategoryTheory/ObjectProperty/ColimitsClosure.lean create mode 100644 Mathlib/CategoryTheory/ObjectProperty/Opposite.lean diff --git a/Mathlib.lean b/Mathlib.lean index 10541426b4a12d..2e648924c3f692 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -2653,6 +2653,7 @@ import Mathlib.CategoryTheory.NatTrans import Mathlib.CategoryTheory.Noetherian import Mathlib.CategoryTheory.ObjectProperty.Basic import Mathlib.CategoryTheory.ObjectProperty.ClosedUnderIsomorphisms +import Mathlib.CategoryTheory.ObjectProperty.ColimitsClosure import Mathlib.CategoryTheory.ObjectProperty.ColimitsOfShape import Mathlib.CategoryTheory.ObjectProperty.CompleteLattice import Mathlib.CategoryTheory.ObjectProperty.ContainsZero @@ -2662,6 +2663,7 @@ import Mathlib.CategoryTheory.ObjectProperty.FullSubcategory import Mathlib.CategoryTheory.ObjectProperty.Ind import Mathlib.CategoryTheory.ObjectProperty.LimitsClosure import Mathlib.CategoryTheory.ObjectProperty.LimitsOfShape +import Mathlib.CategoryTheory.ObjectProperty.Opposite import Mathlib.CategoryTheory.ObjectProperty.Retract import Mathlib.CategoryTheory.ObjectProperty.Shift import Mathlib.CategoryTheory.ObjectProperty.Small diff --git a/Mathlib/CategoryTheory/ObjectProperty/ColimitsClosure.lean b/Mathlib/CategoryTheory/ObjectProperty/ColimitsClosure.lean new file mode 100644 index 00000000000000..536531fbd63fb0 --- /dev/null +++ b/Mathlib/CategoryTheory/ObjectProperty/ColimitsClosure.lean @@ -0,0 +1,91 @@ +/- +Copyright (c) 2025 Joël Riou. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Joël Riou +-/ +import Mathlib.CategoryTheory.ObjectProperty.LimitsClosure +import Mathlib.CategoryTheory.ObjectProperty.ColimitsOfShape + +/-! +# Closure of a property of objects under colimits of certain shapes + +In this file, given a property `P` of objects in a category `C` and +family of categories `J : α → Type _`, we introduce the closure +`P.colimitsClosure J` of `P` under colimits of shapes `J a` for all `a : α`, +and under certain smallness assumptions, we show that its essentially small. + +(We deduce these results about the closure under colimits by dualising the +results in the file `ObjectProperty.LimitsClosure`.) + +-/ + +universe w w' t v' u' v u + +namespace CategoryTheory.ObjectProperty + +open Limits + +variable {C : Type u} [Category.{v} C] (P : ObjectProperty C) + {α : Type t} (J : α → Type u') [∀ a, Category.{v'} (J a)] + +/-- The closure of property of objects of a category under colimits of +shape `J a` for a family of categories `J`. -/ +inductive colimitsClosure : ObjectProperty C + | of_mem (X : C) (hX : P X) : colimitsClosure X + | of_isoClosure {X Y : C} (e : X ≅ Y) (hX : colimitsClosure X) : colimitsClosure Y + | of_colimitPresentation {X : C} {a : α} (pres : ColimitPresentation (J a) X) + (h : ∀ j, colimitsClosure (pres.diag.obj j)) : colimitsClosure X + +@[simp] +lemma le_colimitsClosure : P ≤ P.colimitsClosure J := + fun X hX ↦ .of_mem X hX + +instance : (P.colimitsClosure J).IsClosedUnderIsomorphisms where + of_iso e hX := .of_isoClosure e hX + +instance (a : α) : (P.colimitsClosure J).IsClosedUnderColimitsOfShape (J a) where + colimitsOfShape_le := by + rintro X ⟨hX⟩ + exact .of_colimitPresentation hX.toColimitPresentation hX.prop_diag_obj + +variable {P J} in +lemma colimitsClosure_le {Q : ObjectProperty C} [Q.IsClosedUnderIsomorphisms] + [∀ (a : α), Q.IsClosedUnderColimitsOfShape (J a)] (h : P ≤ Q) : + P.colimitsClosure J ≤ Q := by + intro X hX + induction hX with + | of_mem X hX => exact h _ hX + | of_isoClosure e hX hX' => exact Q.prop_of_iso e hX' + | of_colimitPresentation pres h h' => exact Q.prop_of_isColimit pres.isColimit h' + +variable {P} in +lemma colimitsClosure_monotone {Q : ObjectProperty C} (h : P ≤ Q) : + P.colimitsClosure J ≤ Q.colimitsClosure J := + colimitsClosure_le (h.trans (Q.le_colimitsClosure J)) + +lemma colimitsClosure_isoClosure : + P.isoClosure.colimitsClosure J = P.colimitsClosure J := by + refine le_antisymm (colimitsClosure_le ?_) + (colimitsClosure_monotone _ P.le_isoClosure) + rw [isoClosure_le_iff] + exact le_colimitsClosure P J + +lemma colimitsClosure_eq_unop_limitsClosure : + P.colimitsClosure J = (P.op.limitsClosure (fun a ↦ (J a)ᵒᵖ)).unop := by + refine le_antisymm ?_ ?_ + · apply colimitsClosure_le + rw [← op_le_op_iff, op_unop] + apply le_limitsClosure + · rw [← op_le_op_iff, op_unop] + apply limitsClosure_le + rw [op_le_op_iff] + apply le_colimitsClosure + +instance [ObjectProperty.EssentiallySmall.{w} P] [LocallySmall.{w} C] [Small.{w} α] + [∀ a, Small.{w} (J a)] [∀ a, LocallySmall.{w} (J a)] : + ObjectProperty.EssentiallySmall.{w} (P.colimitsClosure J) := by + rw [colimitsClosure_eq_unop_limitsClosure] + have (a : α) : Small.{w} (J a)ᵒᵖ := Opposite.small + infer_instance + +end CategoryTheory.ObjectProperty diff --git a/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean b/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean index 50c9e730eb2eb6..23b4372f9d369f 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean @@ -4,6 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.CategoryTheory.ObjectProperty.Small +import Mathlib.CategoryTheory.ObjectProperty.LimitsOfShape import Mathlib.CategoryTheory.Limits.Presentation /-! @@ -25,6 +26,9 @@ is essentially small. By requiring `P.colimitsOfShape J ≤ P`, we introduce a typeclass `P.IsClosedUnderColimitsOfShape J`. +We also show that `colimitsOfShape` in a category `C` is related +to `limitsOfShape` in the opposite category `Cᵒᵖ` and vice versa. + ## TODO * refactor `ObjectProperty.ind` by saying that it is the supremum @@ -37,7 +41,7 @@ that is bounded by a certain regular cardinal (@joelriou) -/ -universe w v' u' v u +universe w v'' v' u'' u' v u namespace CategoryTheory.ObjectProperty @@ -45,6 +49,7 @@ open Limits variable {C : Type*} [Category C] (P : ObjectProperty C) (J : Type u') [Category.{v'} J] + {J' : Type u''} [Category.{v''} J'] /-- The property of objects that are *equal* to `colimit F` for some functor `F : J ⥤ C` where all `F.obj j` satisfy `P`. -/ @@ -92,6 +97,13 @@ def ofLE {X : C} (h : P.ColimitOfShape J X) {Q : ObjectProperty C} (hPQ : P ≤ toColimitPresentation := h.toColimitPresentation prop_diag_obj j := hPQ _ (h.prop_diag_obj j) +/-- Change the index category for `ObjectProperty.ColimitOfShape`. -/ +@[simps toColimitPresentation] +noncomputable def reindex {X : C} (h : P.ColimitOfShape J X) (G : J' ⥤ J) [G.Final] : + P.ColimitOfShape J' X where + toColimitPresentation := h.toColimitPresentation.reindex G + prop_diag_obj _ := h.prop_diag_obj _ + end ColimitOfShape /-- The property of objects that are the point of a colimit cocone for a @@ -182,6 +194,159 @@ lemma prop_colimit (F : J ⥤ C) [HasColimit F] (hF : ∀ (j : J), P (F.obj j)) end +variable {J} in +lemma colimitsOfShape_le_of_final (G : J ⥤ J') [G.Final] : + P.colimitsOfShape J' ≤ P.colimitsOfShape J := + fun _h ⟨h⟩ ↦ ⟨h.reindex G⟩ + +variable {J} in +lemma colimitsOfShape_congr (e : J ≌ J') : + P.colimitsOfShape J = P.colimitsOfShape J' := + le_antisymm (P.colimitsOfShape_le_of_final e.inverse) + (P.colimitsOfShape_le_of_final e.functor) + +variable {J} in +lemma isClosedUnderColimitsOfShape_iff_of_equivalence (e : J ≌ J') : + P.IsClosedUnderColimitsOfShape J ↔ + P.IsClosedUnderColimitsOfShape J' := by + simp only [isClosedUnderColimitsOfShape_iff, P.colimitsOfShape_congr e] + +variable {P J} in +lemma IsClosedUnderColimitsOfShape.of_equivalence (e : J ≌ J') + [P.IsClosedUnderColimitsOfShape J] : + P.IsClosedUnderColimitsOfShape J' := by + rwa [← P.isClosedUnderColimitsOfShape_iff_of_equivalence e] + +lemma colimitsOfShape_eq_unop_limitsOfShape : + P.colimitsOfShape J = (P.op.limitsOfShape Jᵒᵖ).unop := by + ext X + constructor + · rintro ⟨h⟩ + exact ⟨{ + diag := h.diag.op + π := NatTrans.op h.ι + isLimit := isLimitOfUnop h.isColimit + prop_diag_obj _ := h.prop_diag_obj _ + }⟩ + · rintro ⟨h⟩ + exact ⟨{ + diag := h.diag.unop + ι := NatTrans.unop h.π + isColimit := isColimitOfOp h.isLimit + prop_diag_obj _ := h.prop_diag_obj _ + }⟩ + +lemma limitsOfShape_eq_unop_colimitsOfShape : + P.limitsOfShape J = (P.op.colimitsOfShape Jᵒᵖ).unop := by + ext X + constructor + · rintro ⟨h⟩ + exact ⟨{ + diag := h.diag.op + ι := NatTrans.op h.π + isColimit := isColimitOfUnop h.isLimit + prop_diag_obj _ := h.prop_diag_obj _ + }⟩ + · rintro ⟨h⟩ + exact ⟨{ + diag := h.diag.unop + π := NatTrans.unop h.ι + isLimit := isLimitOfOp h.isColimit + prop_diag_obj _ := h.prop_diag_obj _ + }⟩ + +lemma limitsOfShape_op : + P.op.limitsOfShape J = (P.colimitsOfShape Jᵒᵖ).op := by + rw [colimitsOfShape_eq_unop_limitsOfShape, op_unop, + P.op.limitsOfShape_congr (opOpEquivalence J)] + +lemma colimitsOfShape_op : + P.op.colimitsOfShape J = (P.limitsOfShape Jᵒᵖ).op := by + rw [limitsOfShape_eq_unop_colimitsOfShape, op_unop, + P.op.colimitsOfShape_congr (opOpEquivalence J)] + +lemma isClosedUnderColimitsOfShape_iff_op : + P.IsClosedUnderColimitsOfShape J ↔ + P.op.IsClosedUnderLimitsOfShape Jᵒᵖ := by + rw [isClosedUnderColimitsOfShape_iff, isClosedUnderLimitsOfShape_iff, + colimitsOfShape_eq_unop_limitsOfShape, ← op_le_op_iff, op_unop] + +lemma isClosedUnderLimitsOfShape_iff_op : + P.IsClosedUnderLimitsOfShape J ↔ + P.op.IsClosedUnderColimitsOfShape Jᵒᵖ := by + rw [isClosedUnderColimitsOfShape_iff, isClosedUnderLimitsOfShape_iff, + limitsOfShape_eq_unop_colimitsOfShape, ← op_le_op_iff, op_unop] + +lemma isClosedUnderColimitsOfShape_op_iff_op : + P.IsClosedUnderColimitsOfShape Jᵒᵖ ↔ + P.op.IsClosedUnderLimitsOfShape J := by + rw [isClosedUnderColimitsOfShape_iff, isClosedUnderLimitsOfShape_iff, + limitsOfShape_op, op_le_op_iff] + +lemma isClosedUnderLimitsOfShape_op_iff_op : + P.IsClosedUnderLimitsOfShape Jᵒᵖ ↔ + P.op.IsClosedUnderColimitsOfShape J := by + rw [isClosedUnderColimitsOfShape_iff, isClosedUnderLimitsOfShape_iff, + colimitsOfShape_op, op_le_op_iff] + +instance [P.IsClosedUnderColimitsOfShape J] : + P.op.IsClosedUnderLimitsOfShape Jᵒᵖ := by + rwa [← isClosedUnderColimitsOfShape_iff_op] + +instance [P.IsClosedUnderLimitsOfShape J] : + P.op.IsClosedUnderColimitsOfShape Jᵒᵖ := by + rwa [← isClosedUnderLimitsOfShape_iff_op] + +instance [P.IsClosedUnderColimitsOfShape Jᵒᵖ] : + P.op.IsClosedUnderLimitsOfShape J := by + rwa [← isClosedUnderColimitsOfShape_op_iff_op] + +instance [P.IsClosedUnderLimitsOfShape Jᵒᵖ] : + P.op.IsClosedUnderColimitsOfShape J := by + rwa [← isClosedUnderLimitsOfShape_op_iff_op] + +section + +variable (Q : ObjectProperty Cᵒᵖ) + +lemma isClosedUnderColimitsOfShape_iff_unop : + Q.IsClosedUnderColimitsOfShape J ↔ + Q.unop.IsClosedUnderLimitsOfShape Jᵒᵖ := + (Q.unop.isClosedUnderLimitsOfShape_op_iff_op J).symm + +lemma isClosedUnderLimitsOfShape_iff_unop : + Q.IsClosedUnderLimitsOfShape J ↔ + Q.unop.IsClosedUnderColimitsOfShape Jᵒᵖ := + (Q.unop.isClosedUnderColimitsOfShape_op_iff_op J).symm + +lemma isClosedUnderColimitsOfShape_op_iff_unop : + Q.IsClosedUnderColimitsOfShape Jᵒᵖ ↔ + Q.unop.IsClosedUnderLimitsOfShape J := + (Q.unop.isClosedUnderLimitsOfShape_iff_op J).symm + +lemma isClosedUnderLimitsOfShape_op_iff_unop : + Q.IsClosedUnderLimitsOfShape Jᵒᵖ ↔ + Q.unop.IsClosedUnderColimitsOfShape J := + (Q.unop.isClosedUnderColimitsOfShape_iff_op J).symm + +instance [Q.IsClosedUnderColimitsOfShape J] : + Q.unop.IsClosedUnderLimitsOfShape Jᵒᵖ := by + rwa [← isClosedUnderColimitsOfShape_iff_unop] + +instance [Q.IsClosedUnderLimitsOfShape J] : + Q.unop.IsClosedUnderColimitsOfShape Jᵒᵖ := by + rwa [← isClosedUnderLimitsOfShape_iff_unop] + +instance [Q.IsClosedUnderColimitsOfShape Jᵒᵖ] : + Q.unop.IsClosedUnderLimitsOfShape J := by + rwa [← isClosedUnderColimitsOfShape_op_iff_unop] + +instance [Q.IsClosedUnderLimitsOfShape Jᵒᵖ] : + Q.unop.IsClosedUnderColimitsOfShape J := by + rwa [← isClosedUnderLimitsOfShape_op_iff_unop] + +end + end ObjectProperty namespace Limits diff --git a/Mathlib/CategoryTheory/ObjectProperty/CompleteLattice.lean b/Mathlib/CategoryTheory/ObjectProperty/CompleteLattice.lean index 4009739895be12..5c7d094da08f79 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/CompleteLattice.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/CompleteLattice.lean @@ -3,7 +3,7 @@ Copyright (c) 2025 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ -import Mathlib.CategoryTheory.ObjectProperty.ClosedUnderIsomorphisms +import Mathlib.CategoryTheory.ObjectProperty.Opposite import Mathlib.Order.CompleteLattice.Basic /-! @@ -72,4 +72,16 @@ instance [∀ a, (P a).IsClosedUnderIsomorphisms] : end +open Opposite + +@[simp] +lemma op_le_op_iff {P Q : ObjectProperty C} : + P.op ≤ Q.op ↔ P ≤ Q := + ⟨fun h X hX ↦ h (op X) hX, fun h X hX ↦ h X.unop hX⟩ + +@[simp] +lemma unop_le_unop_iff {P Q : ObjectProperty Cᵒᵖ} : + P.unop ≤ Q.unop ↔ P ≤ Q := + op_le_op_iff.symm + end CategoryTheory.ObjectProperty diff --git a/Mathlib/CategoryTheory/ObjectProperty/LimitsClosure.lean b/Mathlib/CategoryTheory/ObjectProperty/LimitsClosure.lean index 2e6fbc869a108e..83d6c75c69d7c3 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/LimitsClosure.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/LimitsClosure.lean @@ -17,6 +17,7 @@ family of categories `J : α → Type _`, we introduce the closure and under certain smallness assumptions, we show that its essentially small. -/ + universe w w' t v' u' v u namespace CategoryTheory.ObjectProperty diff --git a/Mathlib/CategoryTheory/ObjectProperty/LimitsOfShape.lean b/Mathlib/CategoryTheory/ObjectProperty/LimitsOfShape.lean index 3c09208c882317..ddc22febd461f0 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/LimitsOfShape.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/LimitsOfShape.lean @@ -35,7 +35,7 @@ that is bounded by a certain regular cardinal (@joelriou) -/ -universe w v' u' v u +universe w v'' v' u'' u' v u namespace CategoryTheory.ObjectProperty @@ -43,6 +43,7 @@ open Limits variable {C : Type*} [Category C] (P : ObjectProperty C) (J : Type u') [Category.{v'} J] + {J' : Type u''} [Category.{v''} J'] /-- The property of objects that are *equal* to `limit F` for some functor `F : J ⥤ C` where all `F.obj j` satisfy `P`. -/ @@ -89,6 +90,13 @@ def ofLE {X : C} (h : P.LimitOfShape J X) {Q : ObjectProperty C} (hPQ : P ≤ Q) toLimitPresentation := h.toLimitPresentation prop_diag_obj j := hPQ _ (h.prop_diag_obj j) +/-- Change the index category for `ObjectProperty.LimitOfShape`. -/ +@[simps toLimitPresentation] +noncomputable def reindex {X : C} (h : P.LimitOfShape J X) (G : J' ⥤ J) [G.Initial] : + P.LimitOfShape J' X where + toLimitPresentation := h.toLimitPresentation.reindex G + prop_diag_obj _ := h.prop_diag_obj _ + end LimitOfShape /-- The property of objects that are the point of a limit cone for a @@ -184,6 +192,29 @@ lemma prop_limit (F : J ⥤ C) [HasLimit F] (hF : ∀ (j : J), P (F.obj j)) : end +variable {J} in +lemma limitsOfShape_le_of_initial (G : J ⥤ J') [G.Initial] : + P.limitsOfShape J' ≤ P.limitsOfShape J := + fun _h ⟨h⟩ ↦ ⟨h.reindex G⟩ + +variable {J} in +lemma limitsOfShape_congr (e : J ≌ J') : + P.limitsOfShape J = P.limitsOfShape J' := + le_antisymm (P.limitsOfShape_le_of_initial e.inverse) + (P.limitsOfShape_le_of_initial e.functor) + +variable {J} in +lemma isClosedUnderLimitsOfShape_iff_of_equivalence (e : J ≌ J') : + P.IsClosedUnderLimitsOfShape J ↔ + P.IsClosedUnderLimitsOfShape J' := by + simp only [isClosedUnderLimitsOfShape_iff, P.limitsOfShape_congr e] + +variable {P J} in +lemma IsClosedUnderLimitsOfShape.of_equivalence (e : J ≌ J') + [P.IsClosedUnderLimitsOfShape J] : + P.IsClosedUnderLimitsOfShape J' := by + rwa [← P.isClosedUnderLimitsOfShape_iff_of_equivalence e] + end ObjectProperty namespace Limits diff --git a/Mathlib/CategoryTheory/ObjectProperty/Opposite.lean b/Mathlib/CategoryTheory/ObjectProperty/Opposite.lean new file mode 100644 index 00000000000000..a29ff32316363e --- /dev/null +++ b/Mathlib/CategoryTheory/ObjectProperty/Opposite.lean @@ -0,0 +1,76 @@ +/- +Copyright (c) 2025 Joël Riou. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Joël Riou +-/ +import Mathlib.CategoryTheory.ObjectProperty.ClosedUnderIsomorphisms +import Mathlib.CategoryTheory.Opposites + +/-! +# The opposite of a property of objects + +-/ + +universe v u + +namespace CategoryTheory.ObjectProperty + +open Opposite + +variable {C : Type u} [Category.{v} C] + +/-- The property of objects of `Cᵒᵖ` corresponding to `P : ObjectProperty C`. -/ +protected def op (P : ObjectProperty C) : ObjectProperty Cᵒᵖ := + fun X ↦ P X.unop + +/-- The property of objects of `C` corresponding to `P : ObjectProperty Cᵒᵖ`. -/ +protected def unop (P : ObjectProperty Cᵒᵖ) : ObjectProperty C := + fun X ↦ P (op X) + +@[simp] +lemma op_iff (P : ObjectProperty C) (X : Cᵒᵖ) : + P.op X ↔ P X.unop := Iff.rfl + +@[simp] +lemma unop_iff (P : ObjectProperty Cᵒᵖ) (X : C) : + P.unop X ↔ P (op X) := Iff.rfl + +@[simp] +lemma op_unop (P : ObjectProperty Cᵒᵖ) : P.unop.op = P := rfl + +@[simp] +lemma unop_op (P : ObjectProperty C) : P.op.unop = P := rfl + +lemma op_injective {P Q : ObjectProperty C} (h : P.op = Q.op) : P = Q := by + rw [← P.unop_op, ← Q.unop_op, h] + +lemma unop_injective {P Q : ObjectProperty Cᵒᵖ} (h : P.unop = Q.unop) : P = Q := by + rw [← P.op_unop, ← Q.op_unop, h] + +lemma op_injective_iff {P Q : ObjectProperty C} : + P.op = Q.op ↔ P = Q := + ⟨op_injective, by rintro rfl; rfl⟩ + +lemma unop_injective_iff {P Q : ObjectProperty Cᵒᵖ} : + P.unop = Q.unop ↔ P = Q := + ⟨unop_injective, by rintro rfl; rfl⟩ + +instance (P : ObjectProperty C) [P.IsClosedUnderIsomorphisms] : + P.op.IsClosedUnderIsomorphisms where + of_iso e hX := P.prop_of_iso e.symm.unop hX + +instance (P : ObjectProperty Cᵒᵖ) [P.IsClosedUnderIsomorphisms] : + P.unop.IsClosedUnderIsomorphisms where + of_iso e hX := P.prop_of_iso e.symm.op hX + +lemma isoClosure_op (P : ObjectProperty C) : + P.isoClosure.op = P.op.isoClosure := by + ext ⟨X⟩ + exact ⟨fun ⟨Y, h, ⟨e⟩⟩ ↦ ⟨op Y, h, ⟨e.op.symm⟩⟩, + fun ⟨Y, h, ⟨e⟩⟩ ↦ ⟨Y.unop, h, ⟨e.unop.symm⟩⟩⟩ + +lemma isoClosure_unop (P : ObjectProperty Cᵒᵖ) : + P.isoClosure.unop = P.unop.isoClosure := by + rw [← op_injective_iff, P.unop.isoClosure_op, op_unop, op_unop] + +end CategoryTheory.ObjectProperty diff --git a/Mathlib/CategoryTheory/ObjectProperty/Small.lean b/Mathlib/CategoryTheory/ObjectProperty/Small.lean index 7e8f4167204921..20fa4cff3efead 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/Small.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/Small.lean @@ -19,6 +19,8 @@ universe w v u namespace CategoryTheory.ObjectProperty +open Opposite + variable {C : Type u} [Category.{v} C] /-- A property of objects is small relative to a universe `w` @@ -55,6 +57,26 @@ instance {α : Type*} (P : α → ObjectProperty C) small_of_surjective (f := fun (x : Σ a, Subtype (P a)) ↦ ⟨x.2.1, by aesop⟩) (fun ⟨x, hx⟩ ↦ by aesop) +@[simp] +lemma small_op_iff (P : ObjectProperty C) : + ObjectProperty.Small.{w} P.op ↔ ObjectProperty.Small.{w} P := + small_congr + { toFun x := ⟨x.1.unop, x.2⟩ + invFun x := ⟨op x.1, x.2⟩} + +@[simp] +lemma small_unop_iff (P : ObjectProperty Cᵒᵖ) : + ObjectProperty.Small.{w} P.unop ↔ ObjectProperty.Small.{w} P := by + rw [← small_op_iff, op_unop] + +instance (P : ObjectProperty C) [ObjectProperty.Small.{w} P] : + ObjectProperty.Small.{w} P.op := by + simpa + +instance (P : ObjectProperty Cᵒᵖ) [ObjectProperty.Small.{w} P] : + ObjectProperty.Small.{w} P.unop := by + simpa + /-- A property of objects is essentially small relative to a universe `w` if it is contained in the closure by isomorphisms of a small property. -/ @[pp_with_univ] @@ -125,4 +147,28 @@ instance {α : Type*} (P : α → ObjectProperty C) intro a exact (hQ a).trans (monotone_isoClosure (le_iSup Q a)) +@[simp] +lemma essentiallySmall_op_iff (P : ObjectProperty C) : + ObjectProperty.EssentiallySmall.{w} P.op ↔ + ObjectProperty.EssentiallySmall.{w} P := by + refine ⟨fun _ ↦ ?_, fun _ ↦ ?_⟩ + · obtain ⟨Q, h₁, _, h₂⟩ := EssentiallySmall.exists_small_le P.op + exact ⟨Q.unop, inferInstance, by rwa [← isoClosure_unop, ← op_le_op_iff, op_unop]⟩ + · obtain ⟨Q, h₁, _, h₂⟩ := EssentiallySmall.exists_small_le P + exact ⟨Q.op, inferInstance, by rwa [← isoClosure_op, op_le_op_iff]⟩ + +@[simp] +lemma essentiallySmall_unop_iff (P : ObjectProperty Cᵒᵖ) : + ObjectProperty.EssentiallySmall.{w} P.unop ↔ + ObjectProperty.EssentiallySmall.{w} P := by + rw [← essentiallySmall_op_iff, op_unop] + +instance (P : ObjectProperty C) [ObjectProperty.EssentiallySmall.{w} P] : + ObjectProperty.EssentiallySmall.{w} P.op := by + simpa + +instance (P : ObjectProperty Cᵒᵖ) [ObjectProperty.EssentiallySmall.{w} P] : + ObjectProperty.EssentiallySmall.{w} P.unop := by + simpa + end CategoryTheory.ObjectProperty From 8ccc9161917ffd1497fa3b10f7c1322f5ee2b983 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 3 Oct 2025 16:02:45 +0200 Subject: [PATCH 43/69] typo --- Mathlib/CategoryTheory/ObjectProperty/ColimitsClosure.lean | 2 +- Mathlib/CategoryTheory/ObjectProperty/LimitsClosure.lean | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Mathlib/CategoryTheory/ObjectProperty/ColimitsClosure.lean b/Mathlib/CategoryTheory/ObjectProperty/ColimitsClosure.lean index 536531fbd63fb0..683f39ced134e4 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/ColimitsClosure.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/ColimitsClosure.lean @@ -28,7 +28,7 @@ open Limits variable {C : Type u} [Category.{v} C] (P : ObjectProperty C) {α : Type t} (J : α → Type u') [∀ a, Category.{v'} (J a)] -/-- The closure of property of objects of a category under colimits of +/-- The closure of a property of objects of a category under colimits of shape `J a` for a family of categories `J`. -/ inductive colimitsClosure : ObjectProperty C | of_mem (X : C) (hX : P X) : colimitsClosure X diff --git a/Mathlib/CategoryTheory/ObjectProperty/LimitsClosure.lean b/Mathlib/CategoryTheory/ObjectProperty/LimitsClosure.lean index 83d6c75c69d7c3..7b3d7259af95dc 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/LimitsClosure.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/LimitsClosure.lean @@ -27,7 +27,7 @@ open Limits variable {C : Type u} [Category.{v} C] (P : ObjectProperty C) {α : Type t} (J : α → Type u') [∀ a, Category.{v'} (J a)] -/-- The closure of property of objects of a category under limits of +/-- The closure of a property of objects of a category under limits of shape `J a` for a family of categories `J`. -/ inductive limitsClosure : ObjectProperty C | of_mem (X : C) (hX : P X) : limitsClosure X From bb4d4f733cfb322747b93dd18457cb9c427cc9fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 3 Oct 2025 18:14:45 +0200 Subject: [PATCH 44/69] wip --- Mathlib.lean | 1 + .../ColimitsCardinalClosure.lean | 53 ++++++++++++++ .../CategoryTheory/SmallRepresentatives.lean | 73 ++++++++++++++++++- 3 files changed, 125 insertions(+), 2 deletions(-) create mode 100644 Mathlib/CategoryTheory/ObjectProperty/ColimitsCardinalClosure.lean diff --git a/Mathlib.lean b/Mathlib.lean index 2e648924c3f692..494fc819faf540 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -2653,6 +2653,7 @@ import Mathlib.CategoryTheory.NatTrans import Mathlib.CategoryTheory.Noetherian import Mathlib.CategoryTheory.ObjectProperty.Basic import Mathlib.CategoryTheory.ObjectProperty.ClosedUnderIsomorphisms +import Mathlib.CategoryTheory.ObjectProperty.ColimitsCardinalClosure import Mathlib.CategoryTheory.ObjectProperty.ColimitsClosure import Mathlib.CategoryTheory.ObjectProperty.ColimitsOfShape import Mathlib.CategoryTheory.ObjectProperty.CompleteLattice diff --git a/Mathlib/CategoryTheory/ObjectProperty/ColimitsCardinalClosure.lean b/Mathlib/CategoryTheory/ObjectProperty/ColimitsCardinalClosure.lean new file mode 100644 index 00000000000000..5b14bec04ca54e --- /dev/null +++ b/Mathlib/CategoryTheory/ObjectProperty/ColimitsCardinalClosure.lean @@ -0,0 +1,53 @@ +/- +Copyright (c) 2025 Joël Riou. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Joël Riou +-/ +import Mathlib.CategoryTheory.ObjectProperty.ColimitsClosure +import Mathlib.CategoryTheory.SmallRepresentatives + +/-! +# Closure of a property of objects under colimits of bounded cardinality + +In this file, given `P : ObjectProperty C` and `κ : Cardinal.{w}`, +we introduce the closure `P.colimitsCardinalClosure κ` +of `P` under colimits of shapes given by categories `J` such +that `HasCardinalLT (Arrow J) κ` holds. + +If `C` is locally `w`-small and `P` is essentially `w`-small, +we show that this closure `P.colimitsCardinalClosure κ` is +also essentially `w`-small. + +-/ + +universe w v' v u' u + +namespace CategoryTheory.ObjectProperty + +variable {C : Type u} [Category.{v} C] (P : ObjectProperty C) (κ : Cardinal.{w}) + +/-- Given `P : ObjectProperty C` and `κ : Cardinal.{w}`, this is the closure +of `P` under colimits of shape given by categories `J` such that +`HasCardinalLT (Arrow J) κ` holds. -/ +def colimitsCardinalClosure : ObjectProperty C := + P.colimitsClosure (SmallCategoryCardinalLT.categoryFamily κ) + +instance [ObjectProperty.EssentiallySmall.{w} P] [LocallySmall.{w} C] : + ObjectProperty.EssentiallySmall.{w} (P.colimitsCardinalClosure κ) := by + dsimp [colimitsCardinalClosure] + infer_instance + +instance (S : SmallCategoryCardinalLT κ) : + (P.colimitsCardinalClosure κ).IsClosedUnderColimitsOfShape + (SmallCategoryCardinalLT.categoryFamily κ S) := by + dsimp [colimitsCardinalClosure] + infer_instance + +lemma isClosedUnderColimitsOfShape_colimitsCardinalClosure + (J : Type u') [Category.{v'} J] (hJ : HasCardinalLT (Arrow J) κ) : + (P.colimitsCardinalClosure κ).IsClosedUnderColimitsOfShape J := by + obtain ⟨S, ⟨e⟩⟩ := SmallCategoryCardinalLT.exists_equivalence κ J hJ + rw [isClosedUnderColimitsOfShape_iff_of_equivalence _ e.symm] + infer_instance + +end CategoryTheory.ObjectProperty diff --git a/Mathlib/CategoryTheory/SmallRepresentatives.lean b/Mathlib/CategoryTheory/SmallRepresentatives.lean index ab753163a30e4a..f9170c4ef199e1 100644 --- a/Mathlib/CategoryTheory/SmallRepresentatives.lean +++ b/Mathlib/CategoryTheory/SmallRepresentatives.lean @@ -3,8 +3,8 @@ Copyright (c) 2025 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ -import Mathlib.CategoryTheory.Equivalence -import Mathlib.SetTheory.Cardinal.Order +import Mathlib.CategoryTheory.Comma.Arrow +import Mathlib.SetTheory.Cardinal.HasCardinalLT /-! # Representatives of small categories @@ -19,6 +19,10 @@ which, up to equivalence, represents all categories such that types of objects and morphisms have cardinalities less than or equal to that of `Ω` (see `SmallCategoryOfSet.exists_equivalence`). +Given a cardinal `κ : Cardinal.{w}`, we also provide a small family of categories +`SmallCategoryCardinalLT.categoryFamily κ` which represents (up to isomorphism) +any category `C` such that `HasCardinalLT C κ`. + -/ universe w v u @@ -113,6 +117,23 @@ the obvious functor `h.smallCategoryOfSet.obj ⥤ C` is an equivalence. -/ noncomputable def equivalence : h.smallCategoryOfSet.obj ≌ C := h.functor.asEquivalence +/-- Given `h : CoreSmallCategoryOfSet Ω C`, the equivalence of categories +`h.smallCategoryOfSet.obj ≌ C` is actually an isomorphism: it induces +a bijection on the type of arrows. -/ +noncomputable def arrowEquiv : Arrow h.smallCategoryOfSet.obj ≃ Arrow C := + Equiv.ofBijective h.functor.mapArrow.obj (by + constructor + · rintro ⟨x, y, f⟩ ⟨x', y', g⟩ hfg + obtain rfl : x = x' := by simpa using congr_arg Arrow.leftFunc.obj hfg + obtain rfl : y = y' := by simpa using congr_arg Arrow.rightFunc.obj hfg + obtain rfl : f = g := by simpa [Arrow.mk_eq_mk_iff] using hfg + rfl + · rintro ⟨X, Y, f⟩ + obtain ⟨x, rfl⟩ := h.objEquiv.surjective X + obtain ⟨y, rfl⟩ := h.objEquiv.surjective Y + obtain ⟨f, rfl⟩ := h.homEquiv.surjective f + exact ⟨Arrow.mk f, rfl⟩) + end CoreSmallCategoryOfSet namespace SmallCategoryOfSet @@ -134,4 +155,52 @@ lemma exists_equivalence (C : Type u) [Category.{v} C] end SmallCategoryOfSet +/-- Index set of a representative set of all categories `C` which satisfy +`HasCardinalLT C κ`, see `SmallCategoryCardinalLT.categoryFamily`. -/ +def SmallCategoryCardinalLT (κ : Cardinal.{w}) : Type w := + { S : SmallCategoryOfSet κ.ord.toType // HasCardinalLT (Arrow S.obj) κ} + +namespace SmallCategoryCardinalLT + +variable (κ : Cardinal.{w}) + +/-- Given a cardinal `κ`, this is a representative family of all categories `C` +such that `HasCardinalLT C κ`. -/ +abbrev categoryFamily (S : SmallCategoryCardinalLT κ) : Type w := S.1.obj + +lemma hasCardinalLT (S : SmallCategoryCardinalLT κ) : + HasCardinalLT (Arrow (categoryFamily κ S)) κ := S.2 + +lemma exists_equivalence (C : Type u) [Category.{v} C] (hC : HasCardinalLT (Arrow C) κ) : + ∃ (S : SmallCategoryCardinalLT κ), + Nonempty (categoryFamily κ S ≌ C) := by + let Ω := κ.ord.toType + have ι : Arrow C ↪ Ω := Nonempty.some (by + rw [← Cardinal.lift_mk_le'] + simpa [Ω] using hC.le) + have h₁ : Cardinal.lift.{w} (Cardinal.mk C) ≤ + Cardinal.lift.{u} (Cardinal.mk Ω) := by + rw [Cardinal.lift_mk_le'] + refine ⟨Function.Embedding.trans { toFun X := Arrow.mk (𝟙 X), inj' := ?_ } ι⟩ + intro X Y h + exact congr_arg Arrow.leftFunc.obj h + have h₂ (X Y : C) : Cardinal.lift.{w} (Cardinal.mk (X ⟶ Y)) ≤ + Cardinal.lift.{v} (Cardinal.mk Ω) := by + rw [Cardinal.lift_mk_le'] + refine ⟨Function.Embedding.trans { toFun f := Arrow.mk f, inj' := ?_ } ι⟩ + intro f g h + simpa [Arrow.mk_eq_mk_iff] using h + let f₁ := (Cardinal.lift_mk_le'.1 h₁).some + let f₂ (X Y) := (Cardinal.lift_mk_le'.1 (h₂ X Y)).some + let e := Equiv.ofInjective _ f₁.injective + let h : CoreSmallCategoryOfSet Ω C := + { obj := Set.range f₁ + hom X Y := Set.range (f₂ (e.symm X) (e.symm Y)) + objEquiv := e.symm + homEquiv {_ _} := by simpa using (Equiv.ofInjective _ ((f₂ _ _).injective)).symm } + refine ⟨⟨h.smallCategoryOfSet, ?_⟩, ⟨h.equivalence⟩⟩ + rwa [hasCardinalLT_iff_of_equiv h.arrowEquiv] + +end SmallCategoryCardinalLT + end CategoryTheory From d7c12f5993e8cb1c8d4be3d806f213a592367aa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 3 Oct 2025 18:15:39 +0200 Subject: [PATCH 45/69] fix --- Mathlib/CategoryTheory/SmallRepresentatives.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/SmallRepresentatives.lean b/Mathlib/CategoryTheory/SmallRepresentatives.lean index f9170c4ef199e1..2389c820a81615 100644 --- a/Mathlib/CategoryTheory/SmallRepresentatives.lean +++ b/Mathlib/CategoryTheory/SmallRepresentatives.lean @@ -21,7 +21,7 @@ that of `Ω` (see `SmallCategoryOfSet.exists_equivalence`). Given a cardinal `κ : Cardinal.{w}`, we also provide a small family of categories `SmallCategoryCardinalLT.categoryFamily κ` which represents (up to isomorphism) -any category `C` such that `HasCardinalLT C κ`. +any category `C` such that `HasCardinalLT C κ` holds. -/ From 604b61f56d3889b8f7640c10d3cb52c55d614181 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sat, 11 Oct 2025 21:05:44 +0200 Subject: [PATCH 46/69] wip --- .../ObjectProperty/ColimitsClosure.lean | 6 +++--- .../ObjectProperty/ColimitsOfShape.lean | 8 ++++---- .../ObjectProperty/CompleteLattice.lean | 14 +------------- Mathlib/CategoryTheory/ObjectProperty/Small.lean | 4 ++-- 4 files changed, 10 insertions(+), 22 deletions(-) diff --git a/Mathlib/CategoryTheory/ObjectProperty/ColimitsClosure.lean b/Mathlib/CategoryTheory/ObjectProperty/ColimitsClosure.lean index 683f39ced134e4..f1f6eeefc70cc8 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/ColimitsClosure.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/ColimitsClosure.lean @@ -74,11 +74,11 @@ lemma colimitsClosure_eq_unop_limitsClosure : P.colimitsClosure J = (P.op.limitsClosure (fun a ↦ (J a)ᵒᵖ)).unop := by refine le_antisymm ?_ ?_ · apply colimitsClosure_le - rw [← op_le_op_iff, op_unop] + rw [← op_monotone_iff, op_unop] apply le_limitsClosure - · rw [← op_le_op_iff, op_unop] + · rw [← op_monotone_iff, op_unop] apply limitsClosure_le - rw [op_le_op_iff] + rw [op_monotone_iff] apply le_colimitsClosure instance [ObjectProperty.EssentiallySmall.{w} P] [LocallySmall.{w} C] [Small.{w} α] diff --git a/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean b/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean index 23b4372f9d369f..112e929e2cf1ad 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/ColimitsOfShape.lean @@ -269,25 +269,25 @@ lemma isClosedUnderColimitsOfShape_iff_op : P.IsClosedUnderColimitsOfShape J ↔ P.op.IsClosedUnderLimitsOfShape Jᵒᵖ := by rw [isClosedUnderColimitsOfShape_iff, isClosedUnderLimitsOfShape_iff, - colimitsOfShape_eq_unop_limitsOfShape, ← op_le_op_iff, op_unop] + colimitsOfShape_eq_unop_limitsOfShape, ← op_monotone_iff, op_unop] lemma isClosedUnderLimitsOfShape_iff_op : P.IsClosedUnderLimitsOfShape J ↔ P.op.IsClosedUnderColimitsOfShape Jᵒᵖ := by rw [isClosedUnderColimitsOfShape_iff, isClosedUnderLimitsOfShape_iff, - limitsOfShape_eq_unop_colimitsOfShape, ← op_le_op_iff, op_unop] + limitsOfShape_eq_unop_colimitsOfShape, ← op_monotone_iff, op_unop] lemma isClosedUnderColimitsOfShape_op_iff_op : P.IsClosedUnderColimitsOfShape Jᵒᵖ ↔ P.op.IsClosedUnderLimitsOfShape J := by rw [isClosedUnderColimitsOfShape_iff, isClosedUnderLimitsOfShape_iff, - limitsOfShape_op, op_le_op_iff] + limitsOfShape_op, op_monotone_iff] lemma isClosedUnderLimitsOfShape_op_iff_op : P.IsClosedUnderLimitsOfShape Jᵒᵖ ↔ P.op.IsClosedUnderColimitsOfShape J := by rw [isClosedUnderColimitsOfShape_iff, isClosedUnderLimitsOfShape_iff, - colimitsOfShape_op, op_le_op_iff] + colimitsOfShape_op, op_monotone_iff] instance [P.IsClosedUnderColimitsOfShape J] : P.op.IsClosedUnderLimitsOfShape Jᵒᵖ := by diff --git a/Mathlib/CategoryTheory/ObjectProperty/CompleteLattice.lean b/Mathlib/CategoryTheory/ObjectProperty/CompleteLattice.lean index 5c7d094da08f79..4009739895be12 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/CompleteLattice.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/CompleteLattice.lean @@ -3,7 +3,7 @@ Copyright (c) 2025 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ -import Mathlib.CategoryTheory.ObjectProperty.Opposite +import Mathlib.CategoryTheory.ObjectProperty.ClosedUnderIsomorphisms import Mathlib.Order.CompleteLattice.Basic /-! @@ -72,16 +72,4 @@ instance [∀ a, (P a).IsClosedUnderIsomorphisms] : end -open Opposite - -@[simp] -lemma op_le_op_iff {P Q : ObjectProperty C} : - P.op ≤ Q.op ↔ P ≤ Q := - ⟨fun h X hX ↦ h (op X) hX, fun h X hX ↦ h X.unop hX⟩ - -@[simp] -lemma unop_le_unop_iff {P Q : ObjectProperty Cᵒᵖ} : - P.unop ≤ Q.unop ↔ P ≤ Q := - op_le_op_iff.symm - end CategoryTheory.ObjectProperty diff --git a/Mathlib/CategoryTheory/ObjectProperty/Small.lean b/Mathlib/CategoryTheory/ObjectProperty/Small.lean index 4aa0e30baf2e01..5373955504c21c 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/Small.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/Small.lean @@ -172,9 +172,9 @@ lemma essentiallySmall_op_iff (P : ObjectProperty C) : ObjectProperty.EssentiallySmall.{w} P := by refine ⟨fun _ ↦ ?_, fun _ ↦ ?_⟩ · obtain ⟨Q, h₁, _, h₂⟩ := EssentiallySmall.exists_small_le P.op - exact ⟨Q.unop, inferInstance, by rwa [← unop_isoClosure, ← op_le_op_iff, op_unop]⟩ + exact ⟨Q.unop, inferInstance, by rwa [← unop_isoClosure, ← op_monotone_iff, op_unop]⟩ · obtain ⟨Q, h₁, _, h₂⟩ := EssentiallySmall.exists_small_le P - exact ⟨Q.op, inferInstance, by rwa [← op_isoClosure, op_le_op_iff]⟩ + exact ⟨Q.op, inferInstance, by rwa [← op_isoClosure, op_monotone_iff]⟩ @[simp] lemma essentiallySmall_unop_iff (P : ObjectProperty Cᵒᵖ) : From 6ec9b89be4ee85912e6e06f1ab684af6efbc224d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= <37772949+joelriou@users.noreply.github.com> Date: Mon, 13 Oct 2025 15:31:30 +0200 Subject: [PATCH 47/69] Apply suggestion from @joelriou --- Mathlib/CategoryTheory/Limits/Indization/Category.lean | 1 - 1 file changed, 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Limits/Indization/Category.lean b/Mathlib/CategoryTheory/Limits/Indization/Category.lean index 0722ceac4259a0..be927c9efe41f9 100644 --- a/Mathlib/CategoryTheory/Limits/Indization/Category.lean +++ b/Mathlib/CategoryTheory/Limits/Indization/Category.lean @@ -134,7 +134,6 @@ noncomputable instance {J : Type v} [HasLimitsOfShape (Discrete J) C] : rintro _ ⟨F, hF⟩ exact isIndObject_limit_of_discrete_of_hasLimitsOfShape _ hF) - noncomputable instance {J : Type v} [HasLimitsOfShape (Discrete J) C] : CreatesLimitsOfShape (Discrete J) (Ind.inclusion C) := inferInstanceAs <| From 6da7d95cb919a344eca4f6b1ac03276c679857c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 16 Oct 2025 19:04:49 +0200 Subject: [PATCH 48/69] fix --- Mathlib/CategoryTheory/Monoidal/Cartesian/Basic.lean | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Mathlib/CategoryTheory/Monoidal/Cartesian/Basic.lean b/Mathlib/CategoryTheory/Monoidal/Cartesian/Basic.lean index 819b42ba54feeb..8a461ad4d62d03 100644 --- a/Mathlib/CategoryTheory/Monoidal/Cartesian/Basic.lean +++ b/Mathlib/CategoryTheory/Monoidal/Cartesian/Basic.lean @@ -777,14 +777,14 @@ variable {P : ObjectProperty C} /-- The restriction of a Cartesian-monoidal category along an object property that's closed under finite products is Cartesian-monoidal. -/ @[simps!] -instance fullSubcategory' +instance fullSubcategory [P.IsClosedUnderLimitsOfShape (Discrete PEmpty)] [P.IsClosedUnderLimitsOfShape (Discrete WalkingPair)] : CartesianMonoidalCategory P.FullSubcategory where __ := MonoidalCategory.fullSubcategory P (P.prop_of_isLimit isTerminalTensorUnit (by simp)) (fun X Y hX hY ↦ P.prop_of_isLimit (tensorProductIsBinaryProduct X Y) - (by rintro ( _ | _) <;> assumption)) + (by rintro (_ | _) <;> assumption)) isTerminalTensorUnit := .ofUniqueHom (fun X ↦ toUnit X.1) fun _ _ ↦ by ext fst X Y := fst X.1 Y.1 snd X Y := snd X.1 Y.1 @@ -794,9 +794,6 @@ instance fullSubcategory' fst_def X Y := fst_def X.1 Y.1 snd_def X Y := snd_def X.1 Y.1 -@[deprecated (since := "2025-09-22")] alias fullSubcategory := - fullSubcategory' - end CartesianMonoidalCategory open MonoidalCategory CartesianMonoidalCategory From e2a124af6a0c6d5c9dd6a3a42631d8bc69200623 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 23 Oct 2025 09:17:06 +0200 Subject: [PATCH 49/69] wip --- Mathlib.lean | 1 + .../FunctorCategory/Limits.lean | 38 +++++++++++++++++++ .../Presentable/Cocontinuous.lean | 29 ++++++++++++++ 3 files changed, 68 insertions(+) create mode 100644 Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/Limits.lean create mode 100644 Mathlib/CategoryTheory/Presentable/Cocontinuous.lean diff --git a/Mathlib.lean b/Mathlib.lean index bda72d0978628d..0304173a467e7a 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -2755,6 +2755,7 @@ import Mathlib.CategoryTheory.Preadditive.Yoneda.Limits import Mathlib.CategoryTheory.Preadditive.Yoneda.Projective import Mathlib.CategoryTheory.Presentable.Basic import Mathlib.CategoryTheory.Presentable.CardinalFilteredPresentation +import Mathlib.CategoryTheory.Presentable.Cocontinuous import Mathlib.CategoryTheory.Presentable.ColimitPresentation import Mathlib.CategoryTheory.Presentable.Finite import Mathlib.CategoryTheory.Presentable.IsCardinalFiltered diff --git a/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/Limits.lean b/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/Limits.lean new file mode 100644 index 00000000000000..fa456e419b5ff2 --- /dev/null +++ b/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/Limits.lean @@ -0,0 +1,38 @@ +/- +Copyright (c) 2025 Joël Riou. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Joël Riou +-/ +import Mathlib.CategoryTheory.ObjectProperty.Basic +import Mathlib.CategoryTheory.ObjectProperty.CompleteLattice +import Mathlib.CategoryTheory.Limits.Preserves.Basic + +universe v₀ u₀ v v' u u' + +namespace CategoryTheory + +open Limits + +variable {C : Type u} [Category.{v} C] {D : Type u'} [Category.{v'} D] + +namespace Functor + +variable {J : Type u₀} [Category.{v₀} J] + +variable (D) in +/-- The property of objects in `C ⥤ D` which preserves the colimit +of a functor `F : J ⥤ C`. -/ +abbrev preservesColimit (F : J ⥤ C) : ObjectProperty (C ⥤ D) := PreservesColimit F + +@[simp] +lemma preservesColimit_iff (F : J ⥤ C) (G : C ⥤ D) : + preservesColimit D F G ↔ PreservesColimit F G := Iff.rfl + +variable (J D) in +def preservesColimitsOfShape : ObjectProperty (C ⥤ D) := by + refine ⨅ (j : J), ?_ + sorry + +end Functor + +end CategoryTheory diff --git a/Mathlib/CategoryTheory/Presentable/Cocontinuous.lean b/Mathlib/CategoryTheory/Presentable/Cocontinuous.lean new file mode 100644 index 00000000000000..292405187f0a74 --- /dev/null +++ b/Mathlib/CategoryTheory/Presentable/Cocontinuous.lean @@ -0,0 +1,29 @@ +/- +Copyright (c) 2025 Joël Riou. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Joël Riou +-/ +import Mathlib.CategoryTheory.Presentable.Basic +import Mathlib.SetTheory.Cardinal.HasCardinalLT + +/-! +# `κ`-cocontinuous functors +-/ +universe w v v' u u' + +namespace CategoryTheory + +variable {C : Type u} [Category.{v} C] {D : Type u'} [Category.{v'} D] + (κ : Cardinal.{w}) [Fact κ.IsRegular] + +namespace Functor + +#check PreservesColimit +variable (C D) in +def isCardinalCocontinuous : ObjectProperty (C ⥤ D) := + ∀ (J : Type w) [Category J] (hJ : HasCardinalLT J κ), 0 = by + have ip := + sorry + + +end CategoryTheory From 985ea6ce5bc48b2711b984725396c6de65762daa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 23 Oct 2025 09:30:21 +0200 Subject: [PATCH 50/69] wip --- .../FunctorCategory/Limits.lean | 14 +++++++---- .../Presentable/Cocontinuous.lean | 24 +++++++++++++++---- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/Limits.lean b/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/Limits.lean index fa456e419b5ff2..78b25afba436c8 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/Limits.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/Limits.lean @@ -3,7 +3,6 @@ Copyright (c) 2025 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ -import Mathlib.CategoryTheory.ObjectProperty.Basic import Mathlib.CategoryTheory.ObjectProperty.CompleteLattice import Mathlib.CategoryTheory.Limits.Preserves.Basic @@ -28,10 +27,15 @@ abbrev preservesColimit (F : J ⥤ C) : ObjectProperty (C ⥤ D) := PreservesCol lemma preservesColimit_iff (F : J ⥤ C) (G : C ⥤ D) : preservesColimit D F G ↔ PreservesColimit F G := Iff.rfl -variable (J D) in -def preservesColimitsOfShape : ObjectProperty (C ⥤ D) := by - refine ⨅ (j : J), ?_ - sorry +variable (C D J) in +def preservesColimitsOfShape : ObjectProperty (C ⥤ D) := + ⨅ (F : J ⥤ C), preservesColimit D F + +@[simp] +lemma preservesColimitsOfShape_iff (G : C ⥤ D) : + preservesColimitsOfShape C D J G ↔ PreservesColimitsOfShape J G := by + simp only [preservesColimitsOfShape, iInf_apply, preservesColimit_iff, iInf_Prop_eq] + exact ⟨fun _ ↦ ⟨inferInstance⟩, fun _ ↦ inferInstance⟩ end Functor diff --git a/Mathlib/CategoryTheory/Presentable/Cocontinuous.lean b/Mathlib/CategoryTheory/Presentable/Cocontinuous.lean index 292405187f0a74..7037189dd2b225 100644 --- a/Mathlib/CategoryTheory/Presentable/Cocontinuous.lean +++ b/Mathlib/CategoryTheory/Presentable/Cocontinuous.lean @@ -3,7 +3,7 @@ Copyright (c) 2025 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ -import Mathlib.CategoryTheory.Presentable.Basic +import Mathlib.CategoryTheory.ObjectProperty.FunctorCategory.Limits import Mathlib.SetTheory.Cardinal.HasCardinalLT /-! @@ -13,17 +13,31 @@ universe w v v' u u' namespace CategoryTheory +open Limits + variable {C : Type u} [Category.{v} C] {D : Type u'} [Category.{v'} D] (κ : Cardinal.{w}) [Fact κ.IsRegular] namespace Functor -#check PreservesColimit variable (C D) in def isCardinalCocontinuous : ObjectProperty (C ⥤ D) := - ∀ (J : Type w) [Category J] (hJ : HasCardinalLT J κ), 0 = by - have ip := - sorry + ⨅ (J : Type w) (_ : Category.{w} J) (_ : HasCardinalLT (Arrow J) κ), + preservesColimitsOfShape C D J + +lemma isCardinalCocontinuous_iff (F : C ⥤ D) (κ : Cardinal.{w}) [Fact κ.IsRegular] : + isCardinalCocontinuous C D κ F ↔ + ∀ (J : Type w) [SmallCategory J] (_ : HasCardinalLT (Arrow J) κ), + PreservesColimitsOfShape J F := by + simp [isCardinalCocontinuous] + +variable {κ} in +lemma isCardinalCocontinuous.preservesColimitsOfShape {F : C ⥤ D} + (hF : isCardinalCocontinuous C D κ F) + (J : Type w) [SmallCategory.{w} J] (hκ : HasCardinalLT (Arrow J) κ) : + PreservesColimitsOfShape J F := + (isCardinalCocontinuous_iff F κ).1 hF J hκ +end Functor end CategoryTheory From d2c339710e506133524d635889648cd913a2de05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 23 Oct 2025 10:16:02 +0200 Subject: [PATCH 51/69] wip --- Mathlib.lean | 4 +- .../MorphismProperty/Basic.lean | 3 + .../FunctorCategory/Limits.lean | 24 ++++++ .../FunctorCategory/Presheaf.lean | 78 +++++++++++++++++++ .../{Cocontinuous.lean => Continuous.lean} | 22 +++--- 5 files changed, 119 insertions(+), 12 deletions(-) create mode 100644 Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/Presheaf.lean rename Mathlib/CategoryTheory/Presentable/{Cocontinuous.lean => Continuous.lean} (59%) diff --git a/Mathlib.lean b/Mathlib.lean index a834e1541a3258..d78462fd89bb2e 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -2711,6 +2711,8 @@ import Mathlib.CategoryTheory.ObjectProperty.ContainsZero import Mathlib.CategoryTheory.ObjectProperty.EpiMono import Mathlib.CategoryTheory.ObjectProperty.Extensions import Mathlib.CategoryTheory.ObjectProperty.FullSubcategory +import Mathlib.CategoryTheory.ObjectProperty.FunctorCategory.Limits +import Mathlib.CategoryTheory.ObjectProperty.FunctorCategory.Presheaf import Mathlib.CategoryTheory.ObjectProperty.Ind import Mathlib.CategoryTheory.ObjectProperty.LimitsClosure import Mathlib.CategoryTheory.ObjectProperty.LimitsOfShape @@ -2757,8 +2759,8 @@ import Mathlib.CategoryTheory.Preadditive.Yoneda.Limits import Mathlib.CategoryTheory.Preadditive.Yoneda.Projective import Mathlib.CategoryTheory.Presentable.Basic import Mathlib.CategoryTheory.Presentable.CardinalFilteredPresentation -import Mathlib.CategoryTheory.Presentable.Cocontinuous import Mathlib.CategoryTheory.Presentable.ColimitPresentation +import Mathlib.CategoryTheory.Presentable.Continuous import Mathlib.CategoryTheory.Presentable.Finite import Mathlib.CategoryTheory.Presentable.IsCardinalFiltered import Mathlib.CategoryTheory.Presentable.Limits diff --git a/Mathlib/CategoryTheory/MorphismProperty/Basic.lean b/Mathlib/CategoryTheory/MorphismProperty/Basic.lean index 77d45f0447dc20..2c4e1652f2ea33 100644 --- a/Mathlib/CategoryTheory/MorphismProperty/Basic.lean +++ b/Mathlib/CategoryTheory/MorphismProperty/Basic.lean @@ -171,6 +171,9 @@ lemma ofHoms_homFamily (P : MorphismProperty C) : ofHoms P.homFamily = P := by · intro hf exact ⟨(⟨f, hf⟩ : P.toSet)⟩ +/-- The class of morphisms containing a single morphism. -/ +abbrev single {X Y : C} (f : X ⟶ Y) : MorphismProperty C := .ofHoms (fun (_ : Unit) ↦ f) + /-- A morphism property `P` satisfies `P.RespectsRight Q` if it is stable under post-composition with morphisms satisfying `Q`, i.e. whenever `P` holds for `f` and `Q` holds for `i` then `P` holds for `f ≫ i`. -/ diff --git a/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/Limits.lean b/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/Limits.lean index 78b25afba436c8..522c609d365ec1 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/Limits.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/Limits.lean @@ -6,6 +6,11 @@ Authors: Joël Riou import Mathlib.CategoryTheory.ObjectProperty.CompleteLattice import Mathlib.CategoryTheory.Limits.Preserves.Basic +/-! +# Functors which preserves limits + +-/ + universe v₀ u₀ v v' u u' namespace CategoryTheory @@ -37,6 +42,25 @@ lemma preservesColimitsOfShape_iff (G : C ⥤ D) : simp only [preservesColimitsOfShape, iInf_apply, preservesColimit_iff, iInf_Prop_eq] exact ⟨fun _ ↦ ⟨inferInstance⟩, fun _ ↦ inferInstance⟩ +variable (D) in +/-- The property of objects in `C ⥤ D` which preserves the limit +of a functor `F : J ⥤ C`. -/ +abbrev preservesLimit (F : J ⥤ C) : ObjectProperty (C ⥤ D) := PreservesLimit F + +@[simp] +lemma preservesLimit_iff (F : J ⥤ C) (G : C ⥤ D) : + preservesLimit D F G ↔ PreservesLimit F G := Iff.rfl + +variable (C D J) in +def preservesLimitsOfShape : ObjectProperty (C ⥤ D) := + ⨅ (F : J ⥤ C), preservesLimit D F + +@[simp] +lemma preservesLimitsOfShape_iff (G : C ⥤ D) : + preservesLimitsOfShape C D J G ↔ PreservesLimitsOfShape J G := by + simp only [preservesLimitsOfShape, iInf_apply, preservesLimit_iff, iInf_Prop_eq] + exact ⟨fun _ ↦ ⟨inferInstance⟩, fun _ ↦ inferInstance⟩ + end Functor end CategoryTheory diff --git a/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/Presheaf.lean b/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/Presheaf.lean new file mode 100644 index 00000000000000..37cff9f3da1f1e --- /dev/null +++ b/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/Presheaf.lean @@ -0,0 +1,78 @@ +/- +Copyright (c) 2025 Joël Riou. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Joël Riou +-/ +import Mathlib.CategoryTheory.ObjectProperty.FunctorCategory.Limits +import Mathlib.CategoryTheory.ObjectProperty.Local +import Mathlib.CategoryTheory.Limits.FunctorCategory.Basic +import Mathlib.CategoryTheory.Limits.Types.Colimits + +/-! +# Presheaves of types which preserves a limit +-/ + +universe w w' v u + +namespace CategoryTheory + +open Limits + +variable {C : Type u} [Category.{v} C] + +namespace FunctorToTypes + +protected abbrev Small (F : C ⥤ Type w') := ∀ (X : C), _root_.Small.{w} (F.obj X) + +@[simps] +noncomputable def shrink (F : C ⥤ Type w') [FunctorToTypes.Small.{w} F] : + C ⥤ Type w where + obj X := Shrink.{w} (F.obj X) + map {X Y} f := equivShrink.{w} _ ∘ F.map f ∘ (equivShrink.{w} _).symm + +attribute [local simp] FunctorToTypes.naturality in +@[simps] +noncomputable def shrinkMap {F G : C ⥤ Type w'} (τ : F ⟶ G) [FunctorToTypes.Small.{w} F] + [FunctorToTypes.Small.{w} G] : + shrink.{w} F ⟶ shrink.{w} G where + app X := equivShrink.{w} _ ∘ τ.app X ∘ (equivShrink.{w} _).symm + +end FunctorToTypes + +instance [LocallySmall.{w} C] (X : C) : FunctorToTypes.Small.{w} (yoneda.obj X) := + fun _ ↦ by dsimp; infer_instance + +noncomputable def shrinkYoneda [LocallySmall.{w} C] : + C ⥤ Cᵒᵖ ⥤ Type w where + obj X := FunctorToTypes.shrink (yoneda.obj X) + map f := FunctorToTypes.shrinkMap (yoneda.map f) + +namespace Presheaf + +variable {J : Type w} [SmallCategory J] [LocallySmall.{w} C] + {F : J ⥤ Cᵒᵖ} (c : Cone F) + +noncomputable def colimitToShrinkYoneda : + colimit (F.leftOp ⋙ shrinkYoneda) ⟶ shrinkYoneda.{w}.obj c.pt.unop := + colimit.desc _ (shrinkYoneda.{w}.mapCocone (coconeLeftOpOfCone c)) + +variable (P : Cᵒᵖ ⥤ Type w) + +lemma nonempty_isLimit_mapCone_iff : + Nonempty (IsLimit (P.mapCone c)) ↔ + (MorphismProperty.single (colimitToShrinkYoneda c)).isLocal P := by + sorry + +variable {c} + +lemma preservesLimit_eq_isLocal_single (hc : IsLimit c) : + Functor.preservesLimit (Type w) F = + (MorphismProperty.single (colimitToShrinkYoneda c)).isLocal := by + ext P + rw [← nonempty_isLimit_mapCone_iff c P] + exact ⟨fun _ ↦ ⟨isLimitOfPreserves P hc⟩, + fun ⟨h⟩ ↦ preservesLimit_of_preserves_limit_cone hc h⟩ + +end Presheaf + +end CategoryTheory diff --git a/Mathlib/CategoryTheory/Presentable/Cocontinuous.lean b/Mathlib/CategoryTheory/Presentable/Continuous.lean similarity index 59% rename from Mathlib/CategoryTheory/Presentable/Cocontinuous.lean rename to Mathlib/CategoryTheory/Presentable/Continuous.lean index 7037189dd2b225..ff9f6e4c5c8494 100644 --- a/Mathlib/CategoryTheory/Presentable/Cocontinuous.lean +++ b/Mathlib/CategoryTheory/Presentable/Continuous.lean @@ -7,7 +7,7 @@ import Mathlib.CategoryTheory.ObjectProperty.FunctorCategory.Limits import Mathlib.SetTheory.Cardinal.HasCardinalLT /-! -# `κ`-cocontinuous functors +# `κ`-continuous functors -/ universe w v v' u u' @@ -21,22 +21,22 @@ variable {C : Type u} [Category.{v} C] {D : Type u'} [Category.{v'} D] namespace Functor variable (C D) in -def isCardinalCocontinuous : ObjectProperty (C ⥤ D) := +def isCardinalContinuous : ObjectProperty (C ⥤ D) := ⨅ (J : Type w) (_ : Category.{w} J) (_ : HasCardinalLT (Arrow J) κ), - preservesColimitsOfShape C D J + preservesLimitsOfShape C D J -lemma isCardinalCocontinuous_iff (F : C ⥤ D) (κ : Cardinal.{w}) [Fact κ.IsRegular] : - isCardinalCocontinuous C D κ F ↔ +lemma isCardinalContinuous_iff (F : C ⥤ D) (κ : Cardinal.{w}) [Fact κ.IsRegular] : + isCardinalContinuous C D κ F ↔ ∀ (J : Type w) [SmallCategory J] (_ : HasCardinalLT (Arrow J) κ), - PreservesColimitsOfShape J F := by - simp [isCardinalCocontinuous] + PreservesLimitsOfShape J F := by + simp [isCardinalContinuous] variable {κ} in -lemma isCardinalCocontinuous.preservesColimitsOfShape {F : C ⥤ D} - (hF : isCardinalCocontinuous C D κ F) +lemma isCardinalContinuous.preservesColimitsOfShape {F : C ⥤ D} + (hF : isCardinalContinuous C D κ F) (J : Type w) [SmallCategory.{w} J] (hκ : HasCardinalLT (Arrow J) κ) : - PreservesColimitsOfShape J F := - (isCardinalCocontinuous_iff F κ).1 hF J hκ + PreservesLimitsOfShape J F := + (isCardinalContinuous_iff F κ).1 hF J hκ end Functor From 472ee70e8cb5aae981b2289813942e5c0c3124e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 23 Oct 2025 12:16:06 +0200 Subject: [PATCH 52/69] wip --- .../CategoryTheory/Limits/Types/Limits.lean | 1 + .../FunctorCategory/Presheaf.lean | 137 ++++++++++++++++-- 2 files changed, 122 insertions(+), 16 deletions(-) diff --git a/Mathlib/CategoryTheory/Limits/Types/Limits.lean b/Mathlib/CategoryTheory/Limits/Types/Limits.lean index aa47272f8cfdf9..9fc75e32e0d283 100644 --- a/Mathlib/CategoryTheory/Limits/Types/Limits.lean +++ b/Mathlib/CategoryTheory/Limits/Types/Limits.lean @@ -31,6 +31,7 @@ def coneOfSection {s} (hs : s ∈ F.sections) : Cone F where /-- Given a cone over a functor F into `Type*` and an element in the cone point, construct a section of F. -/ +@[simps] def sectionOfCone (c : Cone F) (x : c.pt) : F.sections := ⟨fun j ↦ c.π.app j x, fun f ↦ congr_fun (c.π.naturality f).symm x⟩ diff --git a/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/Presheaf.lean b/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/Presheaf.lean index 37cff9f3da1f1e..4c177e57afec4b 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/Presheaf.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/Presheaf.lean @@ -7,16 +7,24 @@ import Mathlib.CategoryTheory.ObjectProperty.FunctorCategory.Limits import Mathlib.CategoryTheory.ObjectProperty.Local import Mathlib.CategoryTheory.Limits.FunctorCategory.Basic import Mathlib.CategoryTheory.Limits.Types.Colimits +import Mathlib.CategoryTheory.Limits.Types.Limits /-! # Presheaves of types which preserves a limit + +Let `F : J ⥤ Cᵒᵖ` be a functor which has a limit (i.e. `F.leftOp : Jᵒᵖ ⥤ C` has a colimit). +We show that a presheaf `P : Cᵒᵖ ⥤ Type w` preserves the limit of `F` iff +`P` is a local object with respect to the obvious morphism from the +colimit of the presheaves represented by `(F.obj j).unop` to the presheaf represented +by the (opposite) of the limit of `F`. + -/ -universe w w' v u +universe w w' v v' u u' namespace CategoryTheory -open Limits +open Limits Opposite variable {C : Type u} [Category.{v} C] @@ -39,37 +47,134 @@ noncomputable def shrinkMap {F G : C ⥤ Type w'} (τ : F ⟶ G) [FunctorToTypes end FunctorToTypes -instance [LocallySmall.{w} C] (X : C) : FunctorToTypes.Small.{w} (yoneda.obj X) := +section + +variable [LocallySmall.{w} C] + +instance (X : C) : FunctorToTypes.Small.{w} (yoneda.obj X) := fun _ ↦ by dsimp; infer_instance -noncomputable def shrinkYoneda [LocallySmall.{w} C] : +-- to be moved +@[simps -isSimp obj map] +noncomputable def shrinkYoneda : C ⥤ Cᵒᵖ ⥤ Type w where obj X := FunctorToTypes.shrink (yoneda.obj X) map f := FunctorToTypes.shrinkMap (yoneda.map f) -namespace Presheaf - -variable {J : Type w} [SmallCategory J] [LocallySmall.{w} C] - {F : J ⥤ Cᵒᵖ} (c : Cone F) +noncomputable def shrinkYonedaObjObjEquiv {X : C} {Y : Cᵒᵖ} : + ((shrinkYoneda.{w}.obj X).obj Y) ≃ (Y.unop ⟶ X) := + (equivShrink _).symm + +noncomputable def shrinkYonedaEquiv {X : C} {P : Cᵒᵖ ⥤ Type w} : + (shrinkYoneda.{w}.obj X ⟶ P) ≃ P.obj (op X) where + toFun τ := τ.app _ (equivShrink.{w} _ (𝟙 X)) + invFun x := + { app Y f := P.map ((equivShrink.{w} _).symm f).op x + naturality Y Z g := by ext; simp [shrinkYoneda] } + left_inv τ := by + ext Y f + obtain ⟨f, rfl⟩ := (equivShrink _).surjective f + simpa [shrinkYoneda] using congr_fun (τ.naturality f.op).symm (equivShrink _ (𝟙 X)) + right_inv x := by simp + +lemma map_shrinkYonedaEquiv {X Y : C} {P : Cᵒᵖ ⥤ Type w} (f : shrinkYoneda.obj X ⟶ P) + (g : Y ⟶ X) : P.map g.op (shrinkYonedaEquiv f) = + f.app (op Y) (shrinkYonedaObjObjEquiv.symm g) := by + simp [shrinkYonedaObjObjEquiv, shrinkYonedaEquiv, shrinkYoneda, + ← FunctorToTypes.naturality] + +lemma shrinkYonedaEquiv_shrinkYoneda_map {X Y : C} (f : X ⟶ Y) : + shrinkYonedaEquiv (shrinkYoneda.{w}.map f) = shrinkYonedaObjObjEquiv.symm f := by + simp [shrinkYonedaEquiv, shrinkYoneda, shrinkYonedaObjObjEquiv] + +lemma shrinkYonedaEquiv_comp {X : C} {P Q : Cᵒᵖ ⥤ Type w} (α : shrinkYoneda.obj X ⟶ P) + (β : P ⟶ Q) : + shrinkYonedaEquiv (α ≫ β) = β.app _ (shrinkYonedaEquiv α) := by + simp [shrinkYonedaEquiv] + +lemma shrinkYonedaEquiv_naturality {X Y : C} {P : Cᵒᵖ ⥤ Type w} + (f : shrinkYoneda.obj X ⟶ P) (g : Y ⟶ X) : + P.map g.op (shrinkYonedaEquiv f) = shrinkYonedaEquiv (shrinkYoneda.map g ≫ f) := by + simpa [shrinkYonedaEquiv, shrinkYoneda] + using congr_fun (f.naturality g.op).symm ((equivShrink _) (𝟙 _)) + +@[reassoc] +lemma shrinkYonedaEquiv_symm_map {X Y : Cᵒᵖ} (f : X ⟶ Y) {P : Cᵒᵖ ⥤ Type w} (t : P.obj X) : + shrinkYonedaEquiv.symm (P.map f t) = + shrinkYoneda.map f.unop ≫ shrinkYonedaEquiv.symm t := + shrinkYonedaEquiv.injective (by + obtain ⟨t, rfl⟩ := shrinkYonedaEquiv.surjective t + rw [← shrinkYonedaEquiv_naturality] + simp) + +end -noncomputable def colimitToShrinkYoneda : - colimit (F.leftOp ⋙ shrinkYoneda) ⟶ shrinkYoneda.{w}.obj c.pt.unop := - colimit.desc _ (shrinkYoneda.{w}.mapCocone (coconeLeftOpOfCone c)) +namespace Presheaf -variable (P : Cᵒᵖ ⥤ Type w) +variable {J : Type u'} [Category.{v'} J] [LocallySmall.{w} C] + {F : J ⥤ Cᵒᵖ} (c : Cone F) {c' : Cocone (F.leftOp ⋙ shrinkYoneda.{w})} + (hc' : IsColimit c') (P : Cᵒᵖ ⥤ Type w) + +variable {P} in +@[simps -isSimp symm_apply apply_coe] +noncomputable def coconeCompShrinkYonedaHomEquiv : + (c'.pt ⟶ P) ≃ (F ⋙ P).sections where + toFun f := + { val j := shrinkYonedaEquiv (c'.ι.app (op j) ≫ f) + property {X X'} g := by + have h₁ := c'.w g.op + dsimp at h₁ ⊢ + rw [← h₁, Category.assoc] + conv_rhs => rw [shrinkYonedaEquiv_comp] + erw [map_shrinkYonedaEquiv] + rw [shrinkYonedaEquiv_shrinkYoneda_map] + rfl } + invFun s := hc'.desc (Cocone.mk _ + { app j := shrinkYonedaEquiv.symm (s.val j.unop) + naturality j₁ j₂ f := by + rw [← s.property f.unop] + dsimp + rw [shrinkYonedaEquiv_symm_map, Category.comp_id] }) + left_inv f := hc'.hom_ext (by simp) + right_inv u := by ext; simp + +noncomputable def coconePtToShrinkYoneda : + c'.pt ⟶ shrinkYoneda.{w}.obj c.pt.unop := + hc'.desc (shrinkYoneda.{w}.mapCocone (coconeLeftOpOfCone c)) + +variable {P} in +@[reassoc] +lemma coconePtToShrinkYoneda_comp (x : P.obj c.pt) : + coconePtToShrinkYoneda c hc' ≫ shrinkYonedaEquiv.symm x = + (coconeCompShrinkYonedaHomEquiv hc').symm + (Types.sectionOfCone (P.mapCone c) x) := by + refine hc'.hom_ext (fun j ↦ ?_) + dsimp [coconePtToShrinkYoneda, coconeCompShrinkYonedaHomEquiv_symm_apply] + rw [hc'.fac_assoc, hc'.fac] + dsimp + rw [shrinkYonedaEquiv_symm_map] lemma nonempty_isLimit_mapCone_iff : Nonempty (IsLimit (P.mapCone c)) ↔ - (MorphismProperty.single (colimitToShrinkYoneda c)).isLocal P := by - sorry + (MorphismProperty.single (coconePtToShrinkYoneda c hc')).isLocal P := by + -- this should be a separate lemma + have h : (MorphismProperty.single (coconePtToShrinkYoneda c hc')).isLocal P ↔ + (Function.Bijective (fun (f : _ ⟶ P) ↦ coconePtToShrinkYoneda c hc' ≫ f)) := + ⟨fun h ↦ h _ ⟨⟨⟩⟩, fun h ↦ by rintro _ _ _ ⟨_⟩; exact h⟩ + rw [Types.isLimit_iff_bijective_sectionOfCone, h, ← Function.Bijective.of_comp_iff' + (coconeCompShrinkYonedaHomEquiv hc').symm.bijective, + ← Function.Bijective.of_comp_iff _ shrinkYonedaEquiv.bijective] + convert Iff.rfl using 2 + ext : 1 + simp [← coconePtToShrinkYoneda_comp] variable {c} lemma preservesLimit_eq_isLocal_single (hc : IsLimit c) : Functor.preservesLimit (Type w) F = - (MorphismProperty.single (colimitToShrinkYoneda c)).isLocal := by + (MorphismProperty.single (coconePtToShrinkYoneda c hc')).isLocal := by ext P - rw [← nonempty_isLimit_mapCone_iff c P] + rw [← nonempty_isLimit_mapCone_iff c hc' P] exact ⟨fun _ ↦ ⟨isLimitOfPreserves P hc⟩, fun ⟨h⟩ ↦ preservesLimit_of_preserves_limit_cone hc h⟩ From 87e2d14e6c1d6eb5ffba9629a16e03c34ffaebbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 23 Oct 2025 15:39:00 +0200 Subject: [PATCH 53/69] wip --- .../FunctorCategory/Limits.lean | 16 +++++ .../FunctorCategory/Presheaf.lean | 59 ++++++++++++++++--- .../CategoryTheory/ObjectProperty/Local.lean | 6 ++ .../Presentable/Continuous.lean | 15 ++++- 4 files changed, 85 insertions(+), 11 deletions(-) diff --git a/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/Limits.lean b/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/Limits.lean index 522c609d365ec1..cc642bbcd39c16 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/Limits.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/Limits.lean @@ -42,6 +42,14 @@ lemma preservesColimitsOfShape_iff (G : C ⥤ D) : simp only [preservesColimitsOfShape, iInf_apply, preservesColimit_iff, iInf_Prop_eq] exact ⟨fun _ ↦ ⟨inferInstance⟩, fun _ ↦ inferInstance⟩ +variable (C D) in +lemma congr_preservesColimitsOfShape {J' : Type*} [Category J'] (e : J ≌ J') : + preservesColimitsOfShape C D J = preservesColimitsOfShape C D J' := by + ext G + simp only [preservesColimitsOfShape_iff] + exact ⟨fun _ ↦ preservesColimitsOfShape_of_equiv e _, + fun _ ↦ preservesColimitsOfShape_of_equiv e.symm _⟩ + variable (D) in /-- The property of objects in `C ⥤ D` which preserves the limit of a functor `F : J ⥤ C`. -/ @@ -61,6 +69,14 @@ lemma preservesLimitsOfShape_iff (G : C ⥤ D) : simp only [preservesLimitsOfShape, iInf_apply, preservesLimit_iff, iInf_Prop_eq] exact ⟨fun _ ↦ ⟨inferInstance⟩, fun _ ↦ inferInstance⟩ +variable (C D) in +lemma congr_preservesLimitsOfShape {J' : Type*} [Category J'] (e : J ≌ J') : + preservesLimitsOfShape C D J = preservesLimitsOfShape C D J' := by + ext G + simp only [preservesLimitsOfShape_iff] + exact ⟨fun _ ↦ preservesLimitsOfShape_of_equiv e _, + fun _ ↦ preservesLimitsOfShape_of_equiv e.symm _⟩ + end Functor end CategoryTheory diff --git a/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/Presheaf.lean b/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/Presheaf.lean index 4c177e57afec4b..56efa1d3a1be03 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/Presheaf.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/Presheaf.lean @@ -12,11 +12,10 @@ import Mathlib.CategoryTheory.Limits.Types.Limits /-! # Presheaves of types which preserves a limit -Let `F : J ⥤ Cᵒᵖ` be a functor which has a limit (i.e. `F.leftOp : Jᵒᵖ ⥤ C` has a colimit). -We show that a presheaf `P : Cᵒᵖ ⥤ Type w` preserves the limit of `F` iff -`P` is a local object with respect to the obvious morphism from the -colimit of the presheaves represented by `(F.obj j).unop` to the presheaf represented -by the (opposite) of the limit of `F`. +Let `F : J ⥤ Cᵒᵖ` be a functor. We show that a presheaf `P : Cᵒᵖ ⥤ Type w` +preserves the limit of `F` iff `P` is a local object with respect to a suitable +family of morphisms in `Cᵒᵖ ⥤ Type w` (this family contains `1` or `0` morphism +depending on whether the limit of `F` exists or not). -/ @@ -26,6 +25,8 @@ namespace CategoryTheory open Limits Opposite +section + variable {C : Type u} [Category.{v} C] namespace FunctorToTypes @@ -109,11 +110,16 @@ lemma shrinkYonedaEquiv_symm_map {X Y : Cᵒᵖ} (f : X ⟶ Y) {P : Cᵒᵖ ⥤ end +end + namespace Presheaf -variable {J : Type u'} [Category.{v'} J] [LocallySmall.{w} C] +section + +variable {C : Type u} [Category.{v} C] + {J : Type u'} [Category.{v'} J] [LocallySmall.{w} C] {F : J ⥤ Cᵒᵖ} (c : Cone F) {c' : Cocone (F.leftOp ⋙ shrinkYoneda.{w})} - (hc' : IsColimit c') (P : Cᵒᵖ ⥤ Type w) + (hc : IsLimit c) (hc' : IsColimit c') (P : Cᵒᵖ ⥤ Type w) variable {P} in @[simps -isSimp symm_apply apply_coe] @@ -170,7 +176,8 @@ lemma nonempty_isLimit_mapCone_iff : variable {c} -lemma preservesLimit_eq_isLocal_single (hc : IsLimit c) : +include hc in +lemma preservesLimit_eq_isLocal_single : Functor.preservesLimit (Type w) F = (MorphismProperty.single (coconePtToShrinkYoneda c hc')).isLocal := by ext P @@ -178,6 +185,42 @@ lemma preservesLimit_eq_isLocal_single (hc : IsLimit c) : exact ⟨fun _ ↦ ⟨isLimitOfPreserves P hc⟩, fun ⟨h⟩ ↦ preservesLimit_of_preserves_limit_cone hc h⟩ +variable (F) + +variable [Small.{w} J] +noncomputable def preservesLimitHomFamilySrc := + colimit (F.leftOp ⋙ shrinkYoneda) + +noncomputable def preservesLimitHomFamilyTgt (h : PLift (HasLimit F)) := + letI := h.down + shrinkYoneda.obj (limit F).unop + +--coconePtToShrinkYoneda (limit.cone F) (colimit.isColimit _) +noncomputable def preservesLimitHomFamily (h : PLift (HasLimit F)) : + preservesLimitHomFamilySrc F ⟶ preservesLimitHomFamilyTgt F h := + letI := h.down + coconePtToShrinkYoneda (limit.cone F) (colimit.isColimit _) + +lemma preservesLimit_eq_isLocal : + Functor.preservesLimit (Type w) F = + (MorphismProperty.ofHoms (preservesLimitHomFamily F)).isLocal := by + ext G + by_cases hF : HasLimit F + · rw [preservesLimit_eq_isLocal_single (limit.isLimit F) (colimit.isColimit _)] + convert Iff.rfl + ext _ _ f + exact ⟨fun ⟨_⟩ ↦ ⟨⟨⟩⟩, fun ⟨_⟩ ↦ ⟨⟨hF⟩⟩⟩ + · exact ⟨fun _ _ _ _ ⟨h⟩ ↦ (hF h.down).elim, + fun _ ↦ ⟨fun hc ↦ (hF ⟨_, hc⟩).elim⟩⟩ + +lemma preservesLimitsOfShape_eq_isLocal : + Functor.preservesLimitsOfShape Cᵒᵖ (Type w) J = + (⨆ (F : J ⥤ Cᵒᵖ), MorphismProperty.ofHoms (preservesLimitHomFamily F)).isLocal := by + simp only [Functor.preservesLimitsOfShape, + MorphismProperty.isLocal_iSup, preservesLimit_eq_isLocal] + +end + end Presheaf end CategoryTheory diff --git a/Mathlib/CategoryTheory/ObjectProperty/Local.lean b/Mathlib/CategoryTheory/ObjectProperty/Local.lean index 79ff81047c117a..3e27837ce8240c 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/Local.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/Local.lean @@ -47,6 +47,12 @@ instance : W.isLocal.IsClosedUnderIsomorphisms where convert (Iso.homToEquiv e).bijective.comp (hZ f hf) using 1 aesop +attribute [local simp] isLocal_iff in +@[simp] +lemma isLocal_iSup {ι : Sort*} (W : ι → MorphismProperty C) : + (⨆ (i : ι), W i).isLocal = ⨅ (i : ι), (W i).isLocal := by + aesop + end MorphismProperty end CategoryTheory diff --git a/Mathlib/CategoryTheory/Presentable/Continuous.lean b/Mathlib/CategoryTheory/Presentable/Continuous.lean index ff9f6e4c5c8494..92fd4d6fafecbc 100644 --- a/Mathlib/CategoryTheory/Presentable/Continuous.lean +++ b/Mathlib/CategoryTheory/Presentable/Continuous.lean @@ -3,7 +3,7 @@ Copyright (c) 2025 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ -import Mathlib.CategoryTheory.ObjectProperty.FunctorCategory.Limits +import Mathlib.CategoryTheory.ObjectProperty.FunctorCategory.Presheaf import Mathlib.SetTheory.Cardinal.HasCardinalLT /-! @@ -15,11 +15,13 @@ namespace CategoryTheory open Limits +namespace Functor + +section + variable {C : Type u} [Category.{v} C] {D : Type u'} [Category.{v'} D] (κ : Cardinal.{w}) [Fact κ.IsRegular] -namespace Functor - variable (C D) in def isCardinalContinuous : ObjectProperty (C ⥤ D) := ⨅ (J : Type w) (_ : Category.{w} J) (_ : HasCardinalLT (Arrow J) κ), @@ -38,6 +40,13 @@ lemma isCardinalContinuous.preservesColimitsOfShape {F : C ⥤ D} PreservesLimitsOfShape J F := (isCardinalContinuous_iff F κ).1 hF J hκ +end + +variable {C : Type w} [SmallCategory C] (κ : Cardinal.{w}) [Fact κ.IsRegular] + +--lemma isCardinalContinuous_eq_isLocal : +-- isCardinalContinuous C (Type w) = sorry := sorry + end Functor end CategoryTheory From b305f691b6b099ff43014fb5ef21c38ad25ceb4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 23 Oct 2025 16:09:22 +0200 Subject: [PATCH 54/69] wip --- .../MorphismProperty/IsSmall.lean | 12 +++++ .../Presentable/Continuous.lean | 54 +++++++++++++++++-- 2 files changed, 62 insertions(+), 4 deletions(-) diff --git a/Mathlib/CategoryTheory/MorphismProperty/IsSmall.lean b/Mathlib/CategoryTheory/MorphismProperty/IsSmall.lean index 0b361867a8f940..8320c51a00e112 100644 --- a/Mathlib/CategoryTheory/MorphismProperty/IsSmall.lean +++ b/Mathlib/CategoryTheory/MorphismProperty/IsSmall.lean @@ -56,6 +56,18 @@ lemma isSmall_iff_eq_ofHoms : · rintro ⟨_, _, _, _, rfl⟩ infer_instance +lemma iSup_ofHoms {α : Type*} {ι : α → Type t} {A B : ∀ a, ι a → C} + (f : ∀ a, ∀ i, A a i ⟶ B a i) : + ⨆ (a : α), ofHoms (f a) = ofHoms (fun (j : Σ (a : α), ι a) ↦ f j.1 j.2) := by + ext f + simp [ofHoms_iff] + +instance {ι : Type t} [Small.{w} ι] (W : ι → MorphismProperty C) [∀ i, IsSmall.{w} (W i)] : + IsSmall.{w} (⨆ i, W i) := by + choose α A B f hf using fun i ↦ (isSmall_iff_eq_ofHoms.{w} (W i)).1 inferInstance + simp only [hf, iSup_ofHoms] + infer_instance + end MorphismProperty end CategoryTheory diff --git a/Mathlib/CategoryTheory/Presentable/Continuous.lean b/Mathlib/CategoryTheory/Presentable/Continuous.lean index 92fd4d6fafecbc..9df1f482fbd66b 100644 --- a/Mathlib/CategoryTheory/Presentable/Continuous.lean +++ b/Mathlib/CategoryTheory/Presentable/Continuous.lean @@ -4,11 +4,29 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.CategoryTheory.ObjectProperty.FunctorCategory.Presheaf +import Mathlib.CategoryTheory.MorphismProperty.IsSmall +import Mathlib.CategoryTheory.SmallRepresentatives import Mathlib.SetTheory.Cardinal.HasCardinalLT /-! # `κ`-continuous functors + +Given categories `C`, `D` and a regular cardinal `κ : Cardinal.{w}`, we define +`isCardinalContinuous C D κ : ObjectProperty C ⥤ D` as the property +of functors which preserves limits indexed by categories `J` +such that `HasCardinalLT (Arrow J) κ`. + +When `C : Type w` is a small category, we show that `κ`-continuous +functors `Cᵒᵖ ⥤ Type w` is exactly the property of objects that are local +to a suitable `w`-small family of morphisms. + +## TODO (@joelriou) +* Show that `(isCardinalContinuous Cᵒᵖ (Type w) κ).FullSubcategory` is +locally `κ`-presentable, and that any locally `κ`-presentable category +is equivalent to a category of `κ`-continuous presheaves. + -/ + universe w v v' u u' namespace CategoryTheory @@ -42,11 +60,39 @@ lemma isCardinalContinuous.preservesColimitsOfShape {F : C ⥤ D} end -variable {C : Type w} [SmallCategory C] (κ : Cardinal.{w}) [Fact κ.IsRegular] +end Functor + +namespace Presheaf ---lemma isCardinalContinuous_eq_isLocal : --- isCardinalContinuous C (Type w) = sorry := sorry +open Functor -end Functor +variable (C : Type w) [SmallCategory C] (κ : Cardinal.{w}) [Fact κ.IsRegular] + +abbrev isCardinalContinuousMorphismProperty : MorphismProperty (Cᵒᵖ ⥤ Type w) := + ⨆ (J) (F : SmallCategoryCardinalLT.categoryFamily κ J ⥤ Cᵒᵖ), + MorphismProperty.ofHoms (Presheaf.preservesLimitHomFamily F) + +example : MorphismProperty.IsSmall.{w} + (isCardinalContinuousMorphismProperty C κ) := by + infer_instance + +lemma isCardinalContinuous_eq_isLocal : + isCardinalContinuous Cᵒᵖ (Type w) κ = + (isCardinalContinuousMorphismProperty.{w} C κ).isLocal := by + trans ⨅ (J : SmallCategoryCardinalLT κ), + preservesLimitsOfShape Cᵒᵖ (Type w) (SmallCategoryCardinalLT.categoryFamily κ J) + · refine le_antisymm ?_ ?_ + · simp only [le_iInf_iff] + intro J P hP + simpa using hP.preservesColimitsOfShape _ (SmallCategoryCardinalLT.hasCardinalLT κ J) + · dsimp [isCardinalContinuous] + simp only [le_iInf_iff] + intro J _ hJ + obtain ⟨J', ⟨e⟩⟩ := SmallCategoryCardinalLT.exists_equivalence κ J hJ + rw [← congr_preservesLimitsOfShape _ _ e] + apply iInf_le + · simp [preservesLimitsOfShape_eq_isLocal] + +end Presheaf end CategoryTheory From e858756f364a2b6223fb00e8ec8ef1b044646d01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 23 Oct 2025 16:11:35 +0200 Subject: [PATCH 55/69] typo --- Mathlib/CategoryTheory/Presentable/Continuous.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Presentable/Continuous.lean b/Mathlib/CategoryTheory/Presentable/Continuous.lean index 9df1f482fbd66b..9681d6e587d056 100644 --- a/Mathlib/CategoryTheory/Presentable/Continuous.lean +++ b/Mathlib/CategoryTheory/Presentable/Continuous.lean @@ -17,7 +17,7 @@ of functors which preserves limits indexed by categories `J` such that `HasCardinalLT (Arrow J) κ`. When `C : Type w` is a small category, we show that `κ`-continuous -functors `Cᵒᵖ ⥤ Type w` is exactly the property of objects that are local +functors `Cᵒᵖ ⥤ Type w` are exactly the objects that are local to a suitable `w`-small family of morphisms. ## TODO (@joelriou) From b817ecff4c502b84a09d718b19e1ae40b1fa71b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 23 Oct 2025 16:27:26 +0200 Subject: [PATCH 56/69] typo --- Mathlib/CategoryTheory/Presentable/Continuous.lean | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/Continuous.lean b/Mathlib/CategoryTheory/Presentable/Continuous.lean index 9681d6e587d056..80e4e24fc8beec 100644 --- a/Mathlib/CategoryTheory/Presentable/Continuous.lean +++ b/Mathlib/CategoryTheory/Presentable/Continuous.lean @@ -17,8 +17,8 @@ of functors which preserves limits indexed by categories `J` such that `HasCardinalLT (Arrow J) κ`. When `C : Type w` is a small category, we show that `κ`-continuous -functors `Cᵒᵖ ⥤ Type w` are exactly the objects that are local -to a suitable `w`-small family of morphisms. +functors `Cᵒᵖ ⥤ Type w` are exactly the objects that are local with +respect to a suitable `w`-small family of morphisms. ## TODO (@joelriou) * Show that `(isCardinalContinuous Cᵒᵖ (Type w) κ).FullSubcategory` is From 966b688368ea2f2c9782ae13cd614fbb225a467b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 23 Oct 2025 16:33:30 +0200 Subject: [PATCH 57/69] wip --- Mathlib/CategoryTheory/Presentable/Continuous.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Presentable/Continuous.lean b/Mathlib/CategoryTheory/Presentable/Continuous.lean index 80e4e24fc8beec..de927184950224 100644 --- a/Mathlib/CategoryTheory/Presentable/Continuous.lean +++ b/Mathlib/CategoryTheory/Presentable/Continuous.lean @@ -12,7 +12,7 @@ import Mathlib.SetTheory.Cardinal.HasCardinalLT # `κ`-continuous functors Given categories `C`, `D` and a regular cardinal `κ : Cardinal.{w}`, we define -`isCardinalContinuous C D κ : ObjectProperty C ⥤ D` as the property +`isCardinalContinuous C D κ : ObjectProperty (C ⥤ D)` as the property of functors which preserves limits indexed by categories `J` such that `HasCardinalLT (Arrow J) κ`. From 6755b2b2a2fbfcb5fadbbbb3aa51a0cb0350ebee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sat, 25 Oct 2025 09:06:26 +0200 Subject: [PATCH 58/69] apply (config := { allowSynthFailures := true }) --- .../Limits/MorphismProperty.lean | 39 +++++++------------ 1 file changed, 14 insertions(+), 25 deletions(-) diff --git a/Mathlib/CategoryTheory/Limits/MorphismProperty.lean b/Mathlib/CategoryTheory/Limits/MorphismProperty.lean index 7439ed81bdc010..69b87257b4e1f2 100644 --- a/Mathlib/CategoryTheory/Limits/MorphismProperty.lean +++ b/Mathlib/CategoryTheory/Limits/MorphismProperty.lean @@ -114,11 +114,6 @@ instance Over.closedUnderLimitsOfShape_discrete_empty [P.ContainsIdentities] [P. (P.overObj (X := X)).IsClosedUnderLimitsOfShape (Discrete PEmpty.{1}) := CostructuredArrow.closedUnderLimitsOfShape_discrete_empty P -instance [P.RespectsIso] [P.ContainsIdentities] : - (MorphismProperty.commaObj (𝟭 T) (Functor.fromPUnit.{0} X) P).IsClosedUnderLimitsOfShape - (Discrete PEmpty.{1}) := - Over.closedUnderLimitsOfShape_discrete_empty _ - /-- Let `P` be stable under composition and base change. If `P` satisfies cancellation on the right, the subcategory of `Over X` defined by `P` is closed under pullbacks. @@ -129,7 +124,6 @@ instance Over.closedUnderLimitsOfShape_pullback [HasPullbacks T] (P.overObj (X := X)).IsClosedUnderLimitsOfShape WalkingCospan where limitsOfShape_le := by rintro Y ⟨p⟩ - have ip := p.π.app .left have h := IsPullback.of_isLimit_cone <| Limits.isLimitOfPreserves (CategoryTheory.Over.forget X) p.isLimit dsimp at h @@ -139,12 +133,6 @@ instance Over.closedUnderLimitsOfShape_pullback [HasPullbacks T] exact P.of_postcomp _ (p.diag.obj WalkingCospan.one).hom (p.prop_diag_obj .one) (by simpa using p.prop_diag_obj .right) -instance [HasPullbacks T] [P.IsStableUnderComposition] - [P.IsStableUnderBaseChange] [P.HasOfPostcompProperty P] : - (MorphismProperty.commaObj (𝟭 T) (Functor.fromPUnit.{0} X) P).IsClosedUnderLimitsOfShape - WalkingCospan := - Over.closedUnderLimitsOfShape_pullback _ - end namespace MorphismProperty.Over @@ -152,11 +140,10 @@ namespace MorphismProperty.Over variable (X : T) noncomputable instance [P.ContainsIdentities] [P.RespectsIso] : - CreatesLimitsOfShape (Discrete PEmpty.{1}) (Over.forget P ⊤ X) := - haveI : HasLimitsOfShape (Discrete PEmpty.{1}) (Comma (𝟭 T) (Functor.fromPUnit X)) := by - change HasLimitsOfShape _ (Over X) - infer_instance - forgetCreatesLimitsOfShapeOfClosed _ + CreatesLimitsOfShape (Discrete PEmpty.{1}) (Over.forget P ⊤ X) := by + apply (config := { allowSynthFailures := true }) forgetCreatesLimitsOfShapeOfClosed + · exact inferInstanceAs (HasLimitsOfShape _ (Over X)) + · apply Over.closedUnderLimitsOfShape_discrete_empty _ variable {X} in instance [P.ContainsIdentities] (Y : P.Over ⊤ X) : @@ -177,22 +164,24 @@ instance [P.ContainsIdentities] : HasTerminal (P.Over ⊤ X) := let h : IsTerminal (Over.mk ⊤ (𝟙 X) (P.id_mem X)) := Over.mkIdTerminal P X h.hasTerminal + /-- If `P` is stable under composition, base change and satisfies post-cancellation, `Over.forget P ⊤ X` creates pullbacks. -/ noncomputable instance createsLimitsOfShape_walkingCospan [HasPullbacks T] [P.IsStableUnderComposition] [P.IsStableUnderBaseChange] [P.HasOfPostcompProperty P] : - CreatesLimitsOfShape WalkingCospan (Over.forget P ⊤ X) := - haveI : HasLimitsOfShape WalkingCospan (Comma (𝟭 T) (Functor.fromPUnit X)) := - inferInstanceAs <| HasLimitsOfShape WalkingCospan (Over X) - forgetCreatesLimitsOfShapeOfClosed P + CreatesLimitsOfShape WalkingCospan (Over.forget P ⊤ X) := by + apply (config := { allowSynthFailures := true }) forgetCreatesLimitsOfShapeOfClosed + · exact inferInstanceAs (HasLimitsOfShape WalkingCospan (Over X)) + · apply Over.closedUnderLimitsOfShape_pullback /-- If `P` is stable under composition, base change and satisfies post-cancellation, `P.Over ⊤ X` has pullbacks -/ instance (priority := 900) hasPullbacks [HasPullbacks T] [P.IsStableUnderComposition] - [P.IsStableUnderBaseChange] [P.HasOfPostcompProperty P] : HasPullbacks (P.Over ⊤ X) := - haveI : HasLimitsOfShape WalkingCospan (Comma (𝟭 T) (Functor.fromPUnit X)) := - inferInstanceAs <| HasLimitsOfShape WalkingCospan (Over X) - hasLimitsOfShape_of_closedUnderLimitsOfShape P + [P.IsStableUnderBaseChange] [P.HasOfPostcompProperty P] : HasPullbacks (P.Over ⊤ X) := by + apply (config := { allowSynthFailures := true }) + hasLimitsOfShape_of_closedUnderLimitsOfShape + · exact inferInstanceAs (HasLimitsOfShape WalkingCospan (Over X)) + · apply Over.closedUnderLimitsOfShape_pullback end MorphismProperty.Over From fa01e0c45b8d391b66858a2a9be132febadfd00e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sat, 25 Oct 2025 09:08:59 +0200 Subject: [PATCH 59/69] removed unnecessary line --- Mathlib/CategoryTheory/Limits/MorphismProperty.lean | 1 - 1 file changed, 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Limits/MorphismProperty.lean b/Mathlib/CategoryTheory/Limits/MorphismProperty.lean index 69b87257b4e1f2..80c5d9440e4cf2 100644 --- a/Mathlib/CategoryTheory/Limits/MorphismProperty.lean +++ b/Mathlib/CategoryTheory/Limits/MorphismProperty.lean @@ -126,7 +126,6 @@ instance Over.closedUnderLimitsOfShape_pullback [HasPullbacks T] rintro Y ⟨p⟩ have h := IsPullback.of_isLimit_cone <| Limits.isLimitOfPreserves (CategoryTheory.Over.forget X) p.isLimit - dsimp at h rw [MorphismProperty.overObj_iff, show Y.hom = (p.π.app .left).left ≫ (p.diag.obj .left).hom by simp] apply P.comp_mem _ _ (P.of_isPullback h.flip ?_) (p.prop_diag_obj _) From be9f65b459a2c47f5de00e27c77d2bae5a78cbf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= <37772949+joelriou@users.noreply.github.com> Date: Mon, 27 Oct 2025 09:21:32 +0100 Subject: [PATCH 60/69] Update Mathlib/CategoryTheory/Limits/MorphismProperty.lean Co-authored-by: Christian Merten --- Mathlib/CategoryTheory/Limits/MorphismProperty.lean | 1 - 1 file changed, 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Limits/MorphismProperty.lean b/Mathlib/CategoryTheory/Limits/MorphismProperty.lean index 80c5d9440e4cf2..35815858c8a409 100644 --- a/Mathlib/CategoryTheory/Limits/MorphismProperty.lean +++ b/Mathlib/CategoryTheory/Limits/MorphismProperty.lean @@ -163,7 +163,6 @@ instance [P.ContainsIdentities] : HasTerminal (P.Over ⊤ X) := let h : IsTerminal (Over.mk ⊤ (𝟙 X) (P.id_mem X)) := Over.mkIdTerminal P X h.hasTerminal - /-- If `P` is stable under composition, base change and satisfies post-cancellation, `Over.forget P ⊤ X` creates pullbacks. -/ noncomputable instance createsLimitsOfShape_walkingCospan [HasPullbacks T] From 241aaa6dd8e7c11cc333aafac2e86ce5ac5647dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= <37772949+joelriou@users.noreply.github.com> Date: Wed, 29 Oct 2025 11:22:27 +0100 Subject: [PATCH 61/69] Apply suggestion from @joelriou --- Mathlib/CategoryTheory/ObjectProperty/ColimitsClosure.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/ObjectProperty/ColimitsClosure.lean b/Mathlib/CategoryTheory/ObjectProperty/ColimitsClosure.lean index f1f6eeefc70cc8..8049c08ab5fd8f 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/ColimitsClosure.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/ColimitsClosure.lean @@ -12,7 +12,7 @@ import Mathlib.CategoryTheory.ObjectProperty.ColimitsOfShape In this file, given a property `P` of objects in a category `C` and family of categories `J : α → Type _`, we introduce the closure `P.colimitsClosure J` of `P` under colimits of shapes `J a` for all `a : α`, -and under certain smallness assumptions, we show that its essentially small. +and under certain smallness assumptions, we show that it is essentially small. (We deduce these results about the closure under colimits by dualising the results in the file `ObjectProperty.LimitsClosure`.) From d78f3ab5cd6b9331d8eafdc1b623d90a6db2084b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 20 Nov 2025 18:27:16 +0100 Subject: [PATCH 62/69] wip --- .../ObjectProperty/ColimitsCardinalClosure.lean | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Mathlib/CategoryTheory/ObjectProperty/ColimitsCardinalClosure.lean b/Mathlib/CategoryTheory/ObjectProperty/ColimitsCardinalClosure.lean index 9ed96124c2f522..e6546d1f688413 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/ColimitsCardinalClosure.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/ColimitsCardinalClosure.lean @@ -5,8 +5,8 @@ Authors: Joël Riou -/ module -import Mathlib.CategoryTheory.ObjectProperty.ColimitsClosure -import Mathlib.CategoryTheory.SmallRepresentatives +public import Mathlib.CategoryTheory.ObjectProperty.ColimitsClosure +public import Mathlib.CategoryTheory.SmallRepresentatives /-! # Closure of a property of objects under colimits of bounded cardinality From 930f86bb6ba95aec5c252cfc3390f7293a9b904b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 4 Dec 2025 10:25:21 +0100 Subject: [PATCH 63/69] fix --- Mathlib.lean | 1 - .../FunctorCategory/Limits.lean | 82 ------------------- .../FunctorCategory/PreservesLimits.lean | 67 ++++++++++++++- .../FunctorCategory/Presheaf.lean | 11 ++- .../Presentable/Continuous.lean | 6 +- 5 files changed, 74 insertions(+), 93 deletions(-) delete mode 100644 Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/Limits.lean diff --git a/Mathlib.lean b/Mathlib.lean index ce63a08774ac60..269edde27ddca4 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -2865,7 +2865,6 @@ public import Mathlib.CategoryTheory.ObjectProperty.EpiMono public import Mathlib.CategoryTheory.ObjectProperty.Equivalence public import Mathlib.CategoryTheory.ObjectProperty.Extensions public import Mathlib.CategoryTheory.ObjectProperty.FullSubcategory -public import Mathlib.CategoryTheory.ObjectProperty.FunctorCategory.Limits public import Mathlib.CategoryTheory.ObjectProperty.FunctorCategory.PreservesLimits public import Mathlib.CategoryTheory.ObjectProperty.FunctorCategory.Presheaf public import Mathlib.CategoryTheory.ObjectProperty.HasCardinalLT diff --git a/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/Limits.lean b/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/Limits.lean deleted file mode 100644 index cc642bbcd39c16..00000000000000 --- a/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/Limits.lean +++ /dev/null @@ -1,82 +0,0 @@ -/- -Copyright (c) 2025 Joël Riou. All rights reserved. -Released under Apache 2.0 license as described in the file LICENSE. -Authors: Joël Riou --/ -import Mathlib.CategoryTheory.ObjectProperty.CompleteLattice -import Mathlib.CategoryTheory.Limits.Preserves.Basic - -/-! -# Functors which preserves limits - --/ - -universe v₀ u₀ v v' u u' - -namespace CategoryTheory - -open Limits - -variable {C : Type u} [Category.{v} C] {D : Type u'} [Category.{v'} D] - -namespace Functor - -variable {J : Type u₀} [Category.{v₀} J] - -variable (D) in -/-- The property of objects in `C ⥤ D` which preserves the colimit -of a functor `F : J ⥤ C`. -/ -abbrev preservesColimit (F : J ⥤ C) : ObjectProperty (C ⥤ D) := PreservesColimit F - -@[simp] -lemma preservesColimit_iff (F : J ⥤ C) (G : C ⥤ D) : - preservesColimit D F G ↔ PreservesColimit F G := Iff.rfl - -variable (C D J) in -def preservesColimitsOfShape : ObjectProperty (C ⥤ D) := - ⨅ (F : J ⥤ C), preservesColimit D F - -@[simp] -lemma preservesColimitsOfShape_iff (G : C ⥤ D) : - preservesColimitsOfShape C D J G ↔ PreservesColimitsOfShape J G := by - simp only [preservesColimitsOfShape, iInf_apply, preservesColimit_iff, iInf_Prop_eq] - exact ⟨fun _ ↦ ⟨inferInstance⟩, fun _ ↦ inferInstance⟩ - -variable (C D) in -lemma congr_preservesColimitsOfShape {J' : Type*} [Category J'] (e : J ≌ J') : - preservesColimitsOfShape C D J = preservesColimitsOfShape C D J' := by - ext G - simp only [preservesColimitsOfShape_iff] - exact ⟨fun _ ↦ preservesColimitsOfShape_of_equiv e _, - fun _ ↦ preservesColimitsOfShape_of_equiv e.symm _⟩ - -variable (D) in -/-- The property of objects in `C ⥤ D` which preserves the limit -of a functor `F : J ⥤ C`. -/ -abbrev preservesLimit (F : J ⥤ C) : ObjectProperty (C ⥤ D) := PreservesLimit F - -@[simp] -lemma preservesLimit_iff (F : J ⥤ C) (G : C ⥤ D) : - preservesLimit D F G ↔ PreservesLimit F G := Iff.rfl - -variable (C D J) in -def preservesLimitsOfShape : ObjectProperty (C ⥤ D) := - ⨅ (F : J ⥤ C), preservesLimit D F - -@[simp] -lemma preservesLimitsOfShape_iff (G : C ⥤ D) : - preservesLimitsOfShape C D J G ↔ PreservesLimitsOfShape J G := by - simp only [preservesLimitsOfShape, iInf_apply, preservesLimit_iff, iInf_Prop_eq] - exact ⟨fun _ ↦ ⟨inferInstance⟩, fun _ ↦ inferInstance⟩ - -variable (C D) in -lemma congr_preservesLimitsOfShape {J' : Type*} [Category J'] (e : J ≌ J') : - preservesLimitsOfShape C D J = preservesLimitsOfShape C D J' := by - ext G - simp only [preservesLimitsOfShape_iff] - exact ⟨fun _ ↦ preservesLimitsOfShape_of_equiv e _, - fun _ ↦ preservesLimitsOfShape_of_equiv e.symm _⟩ - -end Functor - -end CategoryTheory diff --git a/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/PreservesLimits.lean b/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/PreservesLimits.lean index e81448900ce26b..46487cc9fb191e 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/PreservesLimits.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/PreservesLimits.lean @@ -24,10 +24,29 @@ namespace CategoryTheory open Limits -variable {J C : Type*} (K K' : Type*) [Category K] [Category K'] [Category J] [Category C] +variable {J J' C D : Type*} (K K' : Type*) + [Category K] [Category K'] [Category J] [Category J'] [Category C] [Category D] namespace ObjectProperty +variable {K} in +/-- The property of objects in the functor category `J ⥤ C` +which preserves the limit of a functor `F : K ⥤ J`. -/ +abbrev preservesLimit (F : K ⥤ J) : ObjectProperty (J ⥤ C) := PreservesLimit F + +@[simp] +lemma preservesLimit_iff (F : K ⥤ J) (G : J ⥤ C) : + preservesLimit F G ↔ PreservesLimit F G := Iff.rfl + +variable {K} in +/-- The property of objects in the functor category `J ⥤ C` +which preserves the colimit of a functor `F : K ⥤ J`. -/ +abbrev preservesColimit (F : K ⥤ J) : ObjectProperty (J ⥤ C) := PreservesColimit F + +@[simp] +lemma preservesColimit_iff (F : K ⥤ J) (G : J ⥤ C) : + preservesColimit F G ↔ PreservesColimit F G := Iff.rfl + /-- The property of objects in the functor category `J ⥤ C` which preserves limits of shape `K`. -/ abbrev preservesLimitsOfShape : ObjectProperty (J ⥤ C) := PreservesLimitsOfShape K @@ -36,6 +55,44 @@ abbrev preservesLimitsOfShape : ObjectProperty (J ⥤ C) := PreservesLimitsOfSha lemma preservesLimitsOfShape_iff (F : J ⥤ C) : preservesLimitsOfShape K F ↔ PreservesLimitsOfShape K F := Iff.rfl +lemma preservesLimitsOfShape_eq_iSup : + preservesLimitsOfShape (J := J) (C := C) K = + ⨅ (F : K ⥤ J), preservesLimit F := by + ext G + simp only [preservesLimitsOfShape_iff, iInf_apply, preservesLimit_iff, iInf_Prop_eq] + exact ⟨fun _ ↦ inferInstance, fun _ ↦ ⟨inferInstance⟩⟩ + +variable (J C) {K K'} in +lemma congr_preservesLimitsOfShape (e : K ≌ K') : + preservesLimitsOfShape (J := J) (C := C) K = preservesLimitsOfShape K' := by + ext G + simp only [preservesLimitsOfShape_iff] + exact ⟨fun _ ↦ preservesLimitsOfShape_of_equiv e _, + fun _ ↦ preservesLimitsOfShape_of_equiv e.symm _⟩ + +/-- The property of objects in the functor category `J ⥤ C` +which preserves colimits of shape `K`. -/ +abbrev preservesColimitsOfShape : ObjectProperty (J ⥤ C) := PreservesColimitsOfShape K + +@[simp] +lemma preservesColimitsOfShape_iff (F : J ⥤ C) : + preservesColimitsOfShape K F ↔ PreservesColimitsOfShape K F := Iff.rfl + +lemma preservesColimitsOfShape_eq_iSup : + preservesColimitsOfShape (J := J) (C := C) K = + ⨅ (F : K ⥤ J), preservesColimit F := by + ext G + simp only [preservesColimitsOfShape_iff, iInf_apply, preservesColimit_iff, iInf_Prop_eq] + exact ⟨fun _ ↦ inferInstance, fun _ ↦ ⟨inferInstance⟩⟩ + +variable (J C) {K K'} in +lemma congr_preservesColimitsOfShape (e : K ≌ K') : + preservesColimitsOfShape (J := J) (C := C) K = preservesColimitsOfShape K' := by + ext G + simp only [preservesColimitsOfShape_iff] + exact ⟨fun _ ↦ preservesColimitsOfShape_of_equiv e _, + fun _ ↦ preservesColimitsOfShape_of_equiv e.symm _⟩ + /-- The property of objects in the functor category `J ⥤ C` which preserves finite limits. -/ abbrev preservesFiniteLimits : ObjectProperty (J ⥤ C) := PreservesFiniteLimits @@ -44,6 +101,14 @@ abbrev preservesFiniteLimits : ObjectProperty (J ⥤ C) := PreservesFiniteLimits lemma preservesFiniteLimits_iff (F : J ⥤ C) : preservesFiniteLimits F ↔ PreservesFiniteLimits F := Iff.rfl +/-- The property of objects in the functor category `J ⥤ C` +which preserves finite colimits. -/ +abbrev preservesFiniteColimits : ObjectProperty (J ⥤ C) := PreservesFiniteColimits + +@[simp] +lemma preservesFiniteColimits_iff (F : J ⥤ C) : + preservesFiniteColimits F ↔ PreservesFiniteColimits F := Iff.rfl + instance [HasColimitsOfShape K' C] [PreservesLimitsOfShape K (colim (J := K') (C := C))] : (preservesLimitsOfShape K : ObjectProperty (J ⥤ C)).IsClosedUnderColimitsOfShape K' where diff --git a/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/Presheaf.lean b/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/Presheaf.lean index 56efa1d3a1be03..29a7fc6bcdb774 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/Presheaf.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/Presheaf.lean @@ -3,7 +3,7 @@ Copyright (c) 2025 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ -import Mathlib.CategoryTheory.ObjectProperty.FunctorCategory.Limits +import Mathlib.CategoryTheory.ObjectProperty.FunctorCategory.PreservesLimits import Mathlib.CategoryTheory.ObjectProperty.Local import Mathlib.CategoryTheory.Limits.FunctorCategory.Basic import Mathlib.CategoryTheory.Limits.Types.Colimits @@ -178,7 +178,7 @@ variable {c} include hc in lemma preservesLimit_eq_isLocal_single : - Functor.preservesLimit (Type w) F = + ObjectProperty.preservesLimit F = (MorphismProperty.single (coconePtToShrinkYoneda c hc')).isLocal := by ext P rw [← nonempty_isLimit_mapCone_iff c hc' P] @@ -195,14 +195,13 @@ noncomputable def preservesLimitHomFamilyTgt (h : PLift (HasLimit F)) := letI := h.down shrinkYoneda.obj (limit F).unop ---coconePtToShrinkYoneda (limit.cone F) (colimit.isColimit _) noncomputable def preservesLimitHomFamily (h : PLift (HasLimit F)) : preservesLimitHomFamilySrc F ⟶ preservesLimitHomFamilyTgt F h := letI := h.down coconePtToShrinkYoneda (limit.cone F) (colimit.isColimit _) lemma preservesLimit_eq_isLocal : - Functor.preservesLimit (Type w) F = + ObjectProperty.preservesLimit F = (MorphismProperty.ofHoms (preservesLimitHomFamily F)).isLocal := by ext G by_cases hF : HasLimit F @@ -214,9 +213,9 @@ lemma preservesLimit_eq_isLocal : fun _ ↦ ⟨fun hc ↦ (hF ⟨_, hc⟩).elim⟩⟩ lemma preservesLimitsOfShape_eq_isLocal : - Functor.preservesLimitsOfShape Cᵒᵖ (Type w) J = + ObjectProperty.preservesLimitsOfShape J = (⨆ (F : J ⥤ Cᵒᵖ), MorphismProperty.ofHoms (preservesLimitHomFamily F)).isLocal := by - simp only [Functor.preservesLimitsOfShape, + simp only [ObjectProperty.preservesLimitsOfShape_eq_iSup, MorphismProperty.isLocal_iSup, preservesLimit_eq_isLocal] end diff --git a/Mathlib/CategoryTheory/Presentable/Continuous.lean b/Mathlib/CategoryTheory/Presentable/Continuous.lean index de927184950224..2e9a5d47187e00 100644 --- a/Mathlib/CategoryTheory/Presentable/Continuous.lean +++ b/Mathlib/CategoryTheory/Presentable/Continuous.lean @@ -43,7 +43,7 @@ variable {C : Type u} [Category.{v} C] {D : Type u'} [Category.{v'} D] variable (C D) in def isCardinalContinuous : ObjectProperty (C ⥤ D) := ⨅ (J : Type w) (_ : Category.{w} J) (_ : HasCardinalLT (Arrow J) κ), - preservesLimitsOfShape C D J + ObjectProperty.preservesLimitsOfShape J lemma isCardinalContinuous_iff (F : C ⥤ D) (κ : Cardinal.{w}) [Fact κ.IsRegular] : isCardinalContinuous C D κ F ↔ @@ -80,7 +80,7 @@ lemma isCardinalContinuous_eq_isLocal : isCardinalContinuous Cᵒᵖ (Type w) κ = (isCardinalContinuousMorphismProperty.{w} C κ).isLocal := by trans ⨅ (J : SmallCategoryCardinalLT κ), - preservesLimitsOfShape Cᵒᵖ (Type w) (SmallCategoryCardinalLT.categoryFamily κ J) + ObjectProperty.preservesLimitsOfShape (SmallCategoryCardinalLT.categoryFamily κ J) · refine le_antisymm ?_ ?_ · simp only [le_iInf_iff] intro J P hP @@ -89,7 +89,7 @@ lemma isCardinalContinuous_eq_isLocal : simp only [le_iInf_iff] intro J _ hJ obtain ⟨J', ⟨e⟩⟩ := SmallCategoryCardinalLT.exists_equivalence κ J hJ - rw [← congr_preservesLimitsOfShape _ _ e] + rw [← ObjectProperty.congr_preservesLimitsOfShape _ _ e] apply iInf_le · simp [preservesLimitsOfShape_eq_isLocal] From 24989cdb361de8f721dfdc5c90922ca5a46877ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 4 Dec 2025 10:35:58 +0100 Subject: [PATCH 64/69] cleaning up --- Mathlib.lean | 1 + .../FunctorCategory/Presheaf.lean | 88 +------------- Mathlib/CategoryTheory/ShrinkYoneda.lean | 112 ++++++++++++++++++ 3 files changed, 114 insertions(+), 87 deletions(-) create mode 100644 Mathlib/CategoryTheory/ShrinkYoneda.lean diff --git a/Mathlib.lean b/Mathlib.lean index 269edde27ddca4..f278a6e4ec44cb 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -2954,6 +2954,7 @@ public import Mathlib.CategoryTheory.Shift.ShiftedHom public import Mathlib.CategoryTheory.Shift.ShiftedHomOpposite public import Mathlib.CategoryTheory.Shift.SingleFunctors public import Mathlib.CategoryTheory.Shift.Twist +public import Mathlib.CategoryTheory.ShrinkYoneda public import Mathlib.CategoryTheory.Sigma.Basic public import Mathlib.CategoryTheory.Simple public import Mathlib.CategoryTheory.SingleObj diff --git a/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/Presheaf.lean b/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/Presheaf.lean index 29a7fc6bcdb774..f097dbe394df8b 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/Presheaf.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/Presheaf.lean @@ -8,6 +8,7 @@ import Mathlib.CategoryTheory.ObjectProperty.Local import Mathlib.CategoryTheory.Limits.FunctorCategory.Basic import Mathlib.CategoryTheory.Limits.Types.Colimits import Mathlib.CategoryTheory.Limits.Types.Limits +import Mathlib.CategoryTheory.ShrinkYoneda /-! # Presheaves of types which preserves a limit @@ -25,93 +26,6 @@ namespace CategoryTheory open Limits Opposite -section - -variable {C : Type u} [Category.{v} C] - -namespace FunctorToTypes - -protected abbrev Small (F : C ⥤ Type w') := ∀ (X : C), _root_.Small.{w} (F.obj X) - -@[simps] -noncomputable def shrink (F : C ⥤ Type w') [FunctorToTypes.Small.{w} F] : - C ⥤ Type w where - obj X := Shrink.{w} (F.obj X) - map {X Y} f := equivShrink.{w} _ ∘ F.map f ∘ (equivShrink.{w} _).symm - -attribute [local simp] FunctorToTypes.naturality in -@[simps] -noncomputable def shrinkMap {F G : C ⥤ Type w'} (τ : F ⟶ G) [FunctorToTypes.Small.{w} F] - [FunctorToTypes.Small.{w} G] : - shrink.{w} F ⟶ shrink.{w} G where - app X := equivShrink.{w} _ ∘ τ.app X ∘ (equivShrink.{w} _).symm - -end FunctorToTypes - -section - -variable [LocallySmall.{w} C] - -instance (X : C) : FunctorToTypes.Small.{w} (yoneda.obj X) := - fun _ ↦ by dsimp; infer_instance - --- to be moved -@[simps -isSimp obj map] -noncomputable def shrinkYoneda : - C ⥤ Cᵒᵖ ⥤ Type w where - obj X := FunctorToTypes.shrink (yoneda.obj X) - map f := FunctorToTypes.shrinkMap (yoneda.map f) - -noncomputable def shrinkYonedaObjObjEquiv {X : C} {Y : Cᵒᵖ} : - ((shrinkYoneda.{w}.obj X).obj Y) ≃ (Y.unop ⟶ X) := - (equivShrink _).symm - -noncomputable def shrinkYonedaEquiv {X : C} {P : Cᵒᵖ ⥤ Type w} : - (shrinkYoneda.{w}.obj X ⟶ P) ≃ P.obj (op X) where - toFun τ := τ.app _ (equivShrink.{w} _ (𝟙 X)) - invFun x := - { app Y f := P.map ((equivShrink.{w} _).symm f).op x - naturality Y Z g := by ext; simp [shrinkYoneda] } - left_inv τ := by - ext Y f - obtain ⟨f, rfl⟩ := (equivShrink _).surjective f - simpa [shrinkYoneda] using congr_fun (τ.naturality f.op).symm (equivShrink _ (𝟙 X)) - right_inv x := by simp - -lemma map_shrinkYonedaEquiv {X Y : C} {P : Cᵒᵖ ⥤ Type w} (f : shrinkYoneda.obj X ⟶ P) - (g : Y ⟶ X) : P.map g.op (shrinkYonedaEquiv f) = - f.app (op Y) (shrinkYonedaObjObjEquiv.symm g) := by - simp [shrinkYonedaObjObjEquiv, shrinkYonedaEquiv, shrinkYoneda, - ← FunctorToTypes.naturality] - -lemma shrinkYonedaEquiv_shrinkYoneda_map {X Y : C} (f : X ⟶ Y) : - shrinkYonedaEquiv (shrinkYoneda.{w}.map f) = shrinkYonedaObjObjEquiv.symm f := by - simp [shrinkYonedaEquiv, shrinkYoneda, shrinkYonedaObjObjEquiv] - -lemma shrinkYonedaEquiv_comp {X : C} {P Q : Cᵒᵖ ⥤ Type w} (α : shrinkYoneda.obj X ⟶ P) - (β : P ⟶ Q) : - shrinkYonedaEquiv (α ≫ β) = β.app _ (shrinkYonedaEquiv α) := by - simp [shrinkYonedaEquiv] - -lemma shrinkYonedaEquiv_naturality {X Y : C} {P : Cᵒᵖ ⥤ Type w} - (f : shrinkYoneda.obj X ⟶ P) (g : Y ⟶ X) : - P.map g.op (shrinkYonedaEquiv f) = shrinkYonedaEquiv (shrinkYoneda.map g ≫ f) := by - simpa [shrinkYonedaEquiv, shrinkYoneda] - using congr_fun (f.naturality g.op).symm ((equivShrink _) (𝟙 _)) - -@[reassoc] -lemma shrinkYonedaEquiv_symm_map {X Y : Cᵒᵖ} (f : X ⟶ Y) {P : Cᵒᵖ ⥤ Type w} (t : P.obj X) : - shrinkYonedaEquiv.symm (P.map f t) = - shrinkYoneda.map f.unop ≫ shrinkYonedaEquiv.symm t := - shrinkYonedaEquiv.injective (by - obtain ⟨t, rfl⟩ := shrinkYonedaEquiv.surjective t - rw [← shrinkYonedaEquiv_naturality] - simp) - -end - -end - namespace Presheaf section diff --git a/Mathlib/CategoryTheory/ShrinkYoneda.lean b/Mathlib/CategoryTheory/ShrinkYoneda.lean new file mode 100644 index 00000000000000..fdc5f52b9ad3c5 --- /dev/null +++ b/Mathlib/CategoryTheory/ShrinkYoneda.lean @@ -0,0 +1,112 @@ +/- +Copyright (c) 2025 Joël Riou. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Joël Riou +-/ +import Mathlib.CategoryTheory.EssentiallySmall + +/-! +# The yoneda functor for locally small categories + +Let `C` be a locally `w`-small category. We define the yoneda +embedding `shrinkYoneda : C ⥤ Cᵒᵖ ⥤ Type w`. + +-/ + +@[expose] public section + +universe w w' v u + +namespace CategoryTheory + +open Opposite + +variable {C : Type u} [Category.{v} C] + +namespace FunctorToTypes + +/-- A functor to types `F : C ⥤ Type w'` is `w`-small if for any `X : C`, +the type `F.obj X` is `w`-small. -/ +protected abbrev Small (F : C ⥤ Type w') := ∀ (X : C), _root_.Small.{w} (F.obj X) + +/-- If a functor `F : C ⥤ Type w'` is `w`-small, this is the functor `C ⥤ Type w` +obtained by shrinking `F.obj X` for all `X : C`. -/ +@[simps] +noncomputable def shrink (F : C ⥤ Type w') [FunctorToTypes.Small.{w} F] : + C ⥤ Type w where + obj X := Shrink.{w} (F.obj X) + map f := equivShrink.{w} _ ∘ F.map f ∘ (equivShrink.{w} _).symm + +attribute [local simp] FunctorToTypes.naturality in +/-- The natural transformation `shrink.{w} F ⟶ shrink.{w} G` induces by a natural +transformation `τ : F ⟶ G` between `w`-small functors to types. -/ +@[simps] +noncomputable def shrinkMap {F G : C ⥤ Type w'} (τ : F ⟶ G) [FunctorToTypes.Small.{w} F] + [FunctorToTypes.Small.{w} G] : + shrink.{w} F ⟶ shrink.{w} G where + app X := equivShrink.{w} _ ∘ τ.app X ∘ (equivShrink.{w} _).symm + +end FunctorToTypes + +variable [LocallySmall.{w} C] + +instance (X : C) : FunctorToTypes.Small.{w} (yoneda.obj X) := + fun _ ↦ by dsimp; infer_instance + +/-- The yoneda embedding `C ⥤ Cᵒᵖ ⥤ Type w` for a locally `w`-small category `C`. -/ +@[simps -isSimp obj map] +noncomputable def shrinkYoneda : + C ⥤ Cᵒᵖ ⥤ Type w where + obj X := FunctorToTypes.shrink (yoneda.obj X) + map f := FunctorToTypes.shrinkMap (yoneda.map f) + +/-- The type `(shrinkYoneda.obj X).obj Y` is equivalent to `Y.unop ⟶ X`. -/ +noncomputable def shrinkYonedaObjObjEquiv {X : C} {Y : Cᵒᵖ} : + ((shrinkYoneda.{w}.obj X).obj Y) ≃ (Y.unop ⟶ X) := + (equivShrink _).symm + +/-- The type of natural transformations `shrinkYoneda.{w}.obj X ⟶ P` +with `X : C` and `P : Cᵒᵖ ⥤ Type w` is equivalent to `P.obj (op X)`. -/ +noncomputable def shrinkYonedaEquiv {X : C} {P : Cᵒᵖ ⥤ Type w} : + (shrinkYoneda.{w}.obj X ⟶ P) ≃ P.obj (op X) where + toFun τ := τ.app _ (equivShrink.{w} _ (𝟙 X)) + invFun x := + { app Y f := P.map ((equivShrink.{w} _).symm f).op x + naturality Y Z g := by ext; simp [shrinkYoneda] } + left_inv τ := by + ext Y f + obtain ⟨f, rfl⟩ := (equivShrink _).surjective f + simpa [shrinkYoneda] using congr_fun (τ.naturality f.op).symm (equivShrink _ (𝟙 X)) + right_inv x := by simp + +lemma map_shrinkYonedaEquiv {X Y : C} {P : Cᵒᵖ ⥤ Type w} (f : shrinkYoneda.obj X ⟶ P) + (g : Y ⟶ X) : P.map g.op (shrinkYonedaEquiv f) = + f.app (op Y) (shrinkYonedaObjObjEquiv.symm g) := by + simp [shrinkYonedaObjObjEquiv, shrinkYonedaEquiv, shrinkYoneda, + ← FunctorToTypes.naturality] + +lemma shrinkYonedaEquiv_shrinkYoneda_map {X Y : C} (f : X ⟶ Y) : + shrinkYonedaEquiv (shrinkYoneda.{w}.map f) = shrinkYonedaObjObjEquiv.symm f := by + simp [shrinkYonedaEquiv, shrinkYoneda, shrinkYonedaObjObjEquiv] + +lemma shrinkYonedaEquiv_comp {X : C} {P Q : Cᵒᵖ ⥤ Type w} (α : shrinkYoneda.obj X ⟶ P) + (β : P ⟶ Q) : + shrinkYonedaEquiv (α ≫ β) = β.app _ (shrinkYonedaEquiv α) := by + simp [shrinkYonedaEquiv] + +lemma shrinkYonedaEquiv_naturality {X Y : C} {P : Cᵒᵖ ⥤ Type w} + (f : shrinkYoneda.obj X ⟶ P) (g : Y ⟶ X) : + P.map g.op (shrinkYonedaEquiv f) = shrinkYonedaEquiv (shrinkYoneda.map g ≫ f) := by + simpa [shrinkYonedaEquiv, shrinkYoneda] + using congr_fun (f.naturality g.op).symm ((equivShrink _) (𝟙 _)) + +@[reassoc] +lemma shrinkYonedaEquiv_symm_map {X Y : Cᵒᵖ} (f : X ⟶ Y) {P : Cᵒᵖ ⥤ Type w} (t : P.obj X) : + shrinkYonedaEquiv.symm (P.map f t) = + shrinkYoneda.map f.unop ≫ shrinkYonedaEquiv.symm t := + shrinkYonedaEquiv.injective (by + obtain ⟨t, rfl⟩ := shrinkYonedaEquiv.surjective t + rw [← shrinkYonedaEquiv_naturality] + simp) + +end CategoryTheory From 1bbfe07b1d5d2bb4c49c48530018c403ad447004 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 4 Dec 2025 10:36:59 +0100 Subject: [PATCH 65/69] feat(CategoryTheory): more preservation properties of functors --- .../FunctorCategory/PreservesLimits.lean | 67 ++++++++++++++++++- 1 file changed, 66 insertions(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/PreservesLimits.lean b/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/PreservesLimits.lean index e81448900ce26b..46487cc9fb191e 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/PreservesLimits.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/PreservesLimits.lean @@ -24,10 +24,29 @@ namespace CategoryTheory open Limits -variable {J C : Type*} (K K' : Type*) [Category K] [Category K'] [Category J] [Category C] +variable {J J' C D : Type*} (K K' : Type*) + [Category K] [Category K'] [Category J] [Category J'] [Category C] [Category D] namespace ObjectProperty +variable {K} in +/-- The property of objects in the functor category `J ⥤ C` +which preserves the limit of a functor `F : K ⥤ J`. -/ +abbrev preservesLimit (F : K ⥤ J) : ObjectProperty (J ⥤ C) := PreservesLimit F + +@[simp] +lemma preservesLimit_iff (F : K ⥤ J) (G : J ⥤ C) : + preservesLimit F G ↔ PreservesLimit F G := Iff.rfl + +variable {K} in +/-- The property of objects in the functor category `J ⥤ C` +which preserves the colimit of a functor `F : K ⥤ J`. -/ +abbrev preservesColimit (F : K ⥤ J) : ObjectProperty (J ⥤ C) := PreservesColimit F + +@[simp] +lemma preservesColimit_iff (F : K ⥤ J) (G : J ⥤ C) : + preservesColimit F G ↔ PreservesColimit F G := Iff.rfl + /-- The property of objects in the functor category `J ⥤ C` which preserves limits of shape `K`. -/ abbrev preservesLimitsOfShape : ObjectProperty (J ⥤ C) := PreservesLimitsOfShape K @@ -36,6 +55,44 @@ abbrev preservesLimitsOfShape : ObjectProperty (J ⥤ C) := PreservesLimitsOfSha lemma preservesLimitsOfShape_iff (F : J ⥤ C) : preservesLimitsOfShape K F ↔ PreservesLimitsOfShape K F := Iff.rfl +lemma preservesLimitsOfShape_eq_iSup : + preservesLimitsOfShape (J := J) (C := C) K = + ⨅ (F : K ⥤ J), preservesLimit F := by + ext G + simp only [preservesLimitsOfShape_iff, iInf_apply, preservesLimit_iff, iInf_Prop_eq] + exact ⟨fun _ ↦ inferInstance, fun _ ↦ ⟨inferInstance⟩⟩ + +variable (J C) {K K'} in +lemma congr_preservesLimitsOfShape (e : K ≌ K') : + preservesLimitsOfShape (J := J) (C := C) K = preservesLimitsOfShape K' := by + ext G + simp only [preservesLimitsOfShape_iff] + exact ⟨fun _ ↦ preservesLimitsOfShape_of_equiv e _, + fun _ ↦ preservesLimitsOfShape_of_equiv e.symm _⟩ + +/-- The property of objects in the functor category `J ⥤ C` +which preserves colimits of shape `K`. -/ +abbrev preservesColimitsOfShape : ObjectProperty (J ⥤ C) := PreservesColimitsOfShape K + +@[simp] +lemma preservesColimitsOfShape_iff (F : J ⥤ C) : + preservesColimitsOfShape K F ↔ PreservesColimitsOfShape K F := Iff.rfl + +lemma preservesColimitsOfShape_eq_iSup : + preservesColimitsOfShape (J := J) (C := C) K = + ⨅ (F : K ⥤ J), preservesColimit F := by + ext G + simp only [preservesColimitsOfShape_iff, iInf_apply, preservesColimit_iff, iInf_Prop_eq] + exact ⟨fun _ ↦ inferInstance, fun _ ↦ ⟨inferInstance⟩⟩ + +variable (J C) {K K'} in +lemma congr_preservesColimitsOfShape (e : K ≌ K') : + preservesColimitsOfShape (J := J) (C := C) K = preservesColimitsOfShape K' := by + ext G + simp only [preservesColimitsOfShape_iff] + exact ⟨fun _ ↦ preservesColimitsOfShape_of_equiv e _, + fun _ ↦ preservesColimitsOfShape_of_equiv e.symm _⟩ + /-- The property of objects in the functor category `J ⥤ C` which preserves finite limits. -/ abbrev preservesFiniteLimits : ObjectProperty (J ⥤ C) := PreservesFiniteLimits @@ -44,6 +101,14 @@ abbrev preservesFiniteLimits : ObjectProperty (J ⥤ C) := PreservesFiniteLimits lemma preservesFiniteLimits_iff (F : J ⥤ C) : preservesFiniteLimits F ↔ PreservesFiniteLimits F := Iff.rfl +/-- The property of objects in the functor category `J ⥤ C` +which preserves finite colimits. -/ +abbrev preservesFiniteColimits : ObjectProperty (J ⥤ C) := PreservesFiniteColimits + +@[simp] +lemma preservesFiniteColimits_iff (F : J ⥤ C) : + preservesFiniteColimits F ↔ PreservesFiniteColimits F := Iff.rfl + instance [HasColimitsOfShape K' C] [PreservesLimitsOfShape K (colim (J := K') (C := C))] : (preservesLimitsOfShape K : ObjectProperty (J ⥤ C)).IsClosedUnderColimitsOfShape K' where From 658e18cb2440f64ff4b4009c7ad2e5a0c00d93da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 4 Dec 2025 10:47:30 +0100 Subject: [PATCH 66/69] feat(CategoryTheory): the yoneda embedding for a locally small category --- Mathlib.lean | 1 + Mathlib/CategoryTheory/ShrinkYoneda.lean | 127 +++++++++++++++++++++++ 2 files changed, 128 insertions(+) create mode 100644 Mathlib/CategoryTheory/ShrinkYoneda.lean diff --git a/Mathlib.lean b/Mathlib.lean index 42f12ffe9592b7..ee30ed7304673d 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -2952,6 +2952,7 @@ public import Mathlib.CategoryTheory.Shift.ShiftedHom public import Mathlib.CategoryTheory.Shift.ShiftedHomOpposite public import Mathlib.CategoryTheory.Shift.SingleFunctors public import Mathlib.CategoryTheory.Shift.Twist +public import Mathlib.CategoryTheory.ShrinkYoneda public import Mathlib.CategoryTheory.Sigma.Basic public import Mathlib.CategoryTheory.Simple public import Mathlib.CategoryTheory.SingleObj diff --git a/Mathlib/CategoryTheory/ShrinkYoneda.lean b/Mathlib/CategoryTheory/ShrinkYoneda.lean new file mode 100644 index 00000000000000..5a7e949ee99ca2 --- /dev/null +++ b/Mathlib/CategoryTheory/ShrinkYoneda.lean @@ -0,0 +1,127 @@ +/- +Copyright (c) 2025 Joël Riou. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Joël Riou +-/ +import Mathlib.CategoryTheory.EssentiallySmall + +/-! +# The yoneda functor for locally small categories + +Let `C` be a locally `w`-small category. We define the yoneda +embedding `shrinkYoneda : C ⥤ Cᵒᵖ ⥤ Type w`. + +-/ + +@[expose] public section + +universe w w' v u + +namespace CategoryTheory + +open Opposite + +variable {C : Type u} [Category.{v} C] + +namespace FunctorToTypes + +/-- A functor to types `F : C ⥤ Type w'` is `w`-small if for any `X : C`, +the type `F.obj X` is `w`-small. -/ +protected abbrev Small (F : C ⥤ Type w') := ∀ (X : C), _root_.Small.{w} (F.obj X) + +/-- If a functor `F : C ⥤ Type w'` is `w`-small, this is the functor `C ⥤ Type w` +obtained by shrinking `F.obj X` for all `X : C`. -/ +@[simps] +noncomputable def shrink (F : C ⥤ Type w') [FunctorToTypes.Small.{w} F] : + C ⥤ Type w where + obj X := Shrink.{w} (F.obj X) + map f := equivShrink.{w} _ ∘ F.map f ∘ (equivShrink.{w} _).symm + +attribute [local simp] FunctorToTypes.naturality in +/-- The natural transformation `shrink.{w} F ⟶ shrink.{w} G` induces by a natural +transformation `τ : F ⟶ G` between `w`-small functors to types. -/ +@[simps] +noncomputable def shrinkMap {F G : C ⥤ Type w'} (τ : F ⟶ G) [FunctorToTypes.Small.{w} F] + [FunctorToTypes.Small.{w} G] : + shrink.{w} F ⟶ shrink.{w} G where + app X := equivShrink.{w} _ ∘ τ.app X ∘ (equivShrink.{w} _).symm + +end FunctorToTypes + +variable [LocallySmall.{w} C] + +instance (X : C) : FunctorToTypes.Small.{w} (yoneda.obj X) := + fun _ ↦ by dsimp; infer_instance + +/-- The yoneda embedding `C ⥤ Cᵒᵖ ⥤ Type w` for a locally `w`-small category `C`. -/ +@[simps -isSimp obj map] +noncomputable def shrinkYoneda : + C ⥤ Cᵒᵖ ⥤ Type w where + obj X := FunctorToTypes.shrink (yoneda.obj X) + map f := FunctorToTypes.shrinkMap (yoneda.map f) + +/-- The type `(shrinkYoneda.obj X).obj Y` is equivalent to `Y.unop ⟶ X`. -/ +noncomputable def shrinkYonedaObjObjEquiv {X : C} {Y : Cᵒᵖ} : + ((shrinkYoneda.{w}.obj X).obj Y) ≃ (Y.unop ⟶ X) := + (equivShrink _).symm + +/-- The type of natural transformations `shrinkYoneda.{w}.obj X ⟶ P` +with `X : C` and `P : Cᵒᵖ ⥤ Type w` is equivalent to `P.obj (op X)`. -/ +noncomputable def shrinkYonedaEquiv {X : C} {P : Cᵒᵖ ⥤ Type w} : + (shrinkYoneda.{w}.obj X ⟶ P) ≃ P.obj (op X) where + toFun τ := τ.app _ (equivShrink.{w} _ (𝟙 X)) + invFun x := + { app Y f := P.map ((equivShrink.{w} _).symm f).op x + naturality Y Z g := by ext; simp [shrinkYoneda] } + left_inv τ := by + ext Y f + obtain ⟨f, rfl⟩ := (equivShrink _).surjective f + simpa [shrinkYoneda] using congr_fun (τ.naturality f.op).symm (equivShrink _ (𝟙 X)) + right_inv x := by simp + +lemma map_shrinkYonedaEquiv {X Y : C} {P : Cᵒᵖ ⥤ Type w} (f : shrinkYoneda.obj X ⟶ P) + (g : Y ⟶ X) : P.map g.op (shrinkYonedaEquiv f) = + f.app (op Y) (shrinkYonedaObjObjEquiv.symm g) := by + simp [shrinkYonedaObjObjEquiv, shrinkYonedaEquiv, shrinkYoneda, + ← FunctorToTypes.naturality] + +lemma shrinkYonedaEquiv_shrinkYoneda_map {X Y : C} (f : X ⟶ Y) : + shrinkYonedaEquiv (shrinkYoneda.{w}.map f) = shrinkYonedaObjObjEquiv.symm f := by + simp [shrinkYonedaEquiv, shrinkYoneda, shrinkYonedaObjObjEquiv] + +lemma shrinkYonedaEquiv_comp {X : C} {P Q : Cᵒᵖ ⥤ Type w} (α : shrinkYoneda.obj X ⟶ P) + (β : P ⟶ Q) : + shrinkYonedaEquiv (α ≫ β) = β.app _ (shrinkYonedaEquiv α) := by + simp [shrinkYonedaEquiv] + +lemma shrinkYonedaEquiv_naturality {X Y : C} {P : Cᵒᵖ ⥤ Type w} + (f : shrinkYoneda.obj X ⟶ P) (g : Y ⟶ X) : + P.map g.op (shrinkYonedaEquiv f) = shrinkYonedaEquiv (shrinkYoneda.map g ≫ f) := by + simpa [shrinkYonedaEquiv, shrinkYoneda] + using congr_fun (f.naturality g.op).symm ((equivShrink _) (𝟙 _)) + +@[reassoc] +lemma shrinkYonedaEquiv_symm_map {X Y : Cᵒᵖ} (f : X ⟶ Y) {P : Cᵒᵖ ⥤ Type w} (t : P.obj X) : + shrinkYonedaEquiv.symm (P.map f t) = + shrinkYoneda.map f.unop ≫ shrinkYonedaEquiv.symm t := + shrinkYonedaEquiv.injective (by + obtain ⟨t, rfl⟩ := shrinkYonedaEquiv.surjective t + rw [← shrinkYonedaEquiv_naturality] + simp) + +variable (C) in +/-- The functor `shrinkYoneda : C ⥤ Cᵒᵖ ⥤ Type w` for a locally `w`-small category `C` +is fully faithful. -/ +noncomputable def fullyFaithfulShrinkYoneda : + (shrinkYoneda.{w} (C := C)).FullyFaithful where + preimage f := shrinkYonedaObjObjEquiv (shrinkYonedaEquiv f) + map_preimage f := by + obtain ⟨f, rfl⟩ := shrinkYonedaEquiv.symm.surjective f + cat_disch + preimage_map f := by simp [shrinkYonedaEquiv_shrinkYoneda_map] + +instance : (shrinkYoneda.{w} (C := C)).Faithful := (fullyFaithfulShrinkYoneda C).faithful + +instance : (shrinkYoneda.{w} (C := C)).Full := (fullyFaithfulShrinkYoneda C).full + +end CategoryTheory From ea7ea9a6526c46d38c000e9de2c283fb29f81864 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 4 Dec 2025 10:55:47 +0100 Subject: [PATCH 67/69] fix --- Mathlib/CategoryTheory/ShrinkYoneda.lean | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/ShrinkYoneda.lean b/Mathlib/CategoryTheory/ShrinkYoneda.lean index 5a7e949ee99ca2..43f2fdedbc6dd9 100644 --- a/Mathlib/CategoryTheory/ShrinkYoneda.lean +++ b/Mathlib/CategoryTheory/ShrinkYoneda.lean @@ -3,7 +3,9 @@ Copyright (c) 2025 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ -import Mathlib.CategoryTheory.EssentiallySmall +module + +public import Mathlib.CategoryTheory.EssentiallySmall /-! # The yoneda functor for locally small categories From 82ec36014277a64ade86dcfd183ff6a1dd89d1e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 4 Dec 2025 11:00:36 +0100 Subject: [PATCH 68/69] fix --- .../ObjectProperty/FunctorCategory/Presheaf.lean | 16 ++++++++++------ .../CategoryTheory/Presentable/Continuous.lean | 12 ++++++++---- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/Presheaf.lean b/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/Presheaf.lean index f097dbe394df8b..360e9616b35680 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/Presheaf.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/Presheaf.lean @@ -3,12 +3,14 @@ Copyright (c) 2025 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ -import Mathlib.CategoryTheory.ObjectProperty.FunctorCategory.PreservesLimits -import Mathlib.CategoryTheory.ObjectProperty.Local -import Mathlib.CategoryTheory.Limits.FunctorCategory.Basic -import Mathlib.CategoryTheory.Limits.Types.Colimits -import Mathlib.CategoryTheory.Limits.Types.Limits -import Mathlib.CategoryTheory.ShrinkYoneda +module + +public import Mathlib.CategoryTheory.ObjectProperty.FunctorCategory.PreservesLimits +public import Mathlib.CategoryTheory.ObjectProperty.Local +public import Mathlib.CategoryTheory.Limits.FunctorCategory.Basic +public import Mathlib.CategoryTheory.Limits.Types.Colimits +public import Mathlib.CategoryTheory.Limits.Types.Limits +public import Mathlib.CategoryTheory.ShrinkYoneda /-! # Presheaves of types which preserves a limit @@ -20,6 +22,8 @@ depending on whether the limit of `F` exists or not). -/ +@[expose] public section + universe w w' v v' u u' namespace CategoryTheory diff --git a/Mathlib/CategoryTheory/Presentable/Continuous.lean b/Mathlib/CategoryTheory/Presentable/Continuous.lean index 2e9a5d47187e00..57a6457b73cb8d 100644 --- a/Mathlib/CategoryTheory/Presentable/Continuous.lean +++ b/Mathlib/CategoryTheory/Presentable/Continuous.lean @@ -3,10 +3,12 @@ Copyright (c) 2025 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ -import Mathlib.CategoryTheory.ObjectProperty.FunctorCategory.Presheaf -import Mathlib.CategoryTheory.MorphismProperty.IsSmall -import Mathlib.CategoryTheory.SmallRepresentatives -import Mathlib.SetTheory.Cardinal.HasCardinalLT +module + +public import Mathlib.CategoryTheory.ObjectProperty.FunctorCategory.Presheaf +public import Mathlib.CategoryTheory.MorphismProperty.IsSmall +public import Mathlib.CategoryTheory.SmallRepresentatives +public import Mathlib.SetTheory.Cardinal.HasCardinalLT /-! # `κ`-continuous functors @@ -27,6 +29,8 @@ is equivalent to a category of `κ`-continuous presheaves. -/ +@[expose] public section + universe w v v' u u' namespace CategoryTheory From 2d683f07226c3b3c67e5deb5ac9d2336ab6a0f72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 11 Dec 2025 12:25:50 +0100 Subject: [PATCH 69/69] fix --- Mathlib.lean | 1 + .../MorphismProperty/Basic.lean | 3 + .../MorphismProperty/IsSmall.lean | 12 ++ .../FunctorCategory/Presheaf.lean | 150 ++++++++++++++++++ .../CategoryTheory/ObjectProperty/Local.lean | 22 +++ 5 files changed, 188 insertions(+) create mode 100644 Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/Presheaf.lean diff --git a/Mathlib.lean b/Mathlib.lean index 4f7076c0f5023c..422eec10dd021b 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -2885,6 +2885,7 @@ public import Mathlib.CategoryTheory.ObjectProperty.Equivalence public import Mathlib.CategoryTheory.ObjectProperty.Extensions public import Mathlib.CategoryTheory.ObjectProperty.FullSubcategory public import Mathlib.CategoryTheory.ObjectProperty.FunctorCategory.PreservesLimits +public import Mathlib.CategoryTheory.ObjectProperty.FunctorCategory.Presheaf public import Mathlib.CategoryTheory.ObjectProperty.HasCardinalLT public import Mathlib.CategoryTheory.ObjectProperty.Ind public import Mathlib.CategoryTheory.ObjectProperty.InheritedFromHom diff --git a/Mathlib/CategoryTheory/MorphismProperty/Basic.lean b/Mathlib/CategoryTheory/MorphismProperty/Basic.lean index 0041870edd69e0..fd492f14e365bb 100644 --- a/Mathlib/CategoryTheory/MorphismProperty/Basic.lean +++ b/Mathlib/CategoryTheory/MorphismProperty/Basic.lean @@ -214,6 +214,9 @@ lemma ofHoms_homFamily (P : MorphismProperty C) : ofHoms P.homFamily = P := by · intro hf exact ⟨(⟨f, hf⟩ : P.toSet)⟩ +/-- The class of morphisms containing a single morphism. -/ +abbrev single {X Y : C} (f : X ⟶ Y) : MorphismProperty C := .ofHoms (fun (_ : Unit) ↦ f) + end section diff --git a/Mathlib/CategoryTheory/MorphismProperty/IsSmall.lean b/Mathlib/CategoryTheory/MorphismProperty/IsSmall.lean index bbb73d9a63bff0..d685fa57bd912e 100644 --- a/Mathlib/CategoryTheory/MorphismProperty/IsSmall.lean +++ b/Mathlib/CategoryTheory/MorphismProperty/IsSmall.lean @@ -60,6 +60,18 @@ lemma isSmall_iff_eq_ofHoms : · rintro ⟨_, _, _, _, rfl⟩ infer_instance +lemma iSup_ofHoms {α : Type*} {ι : α → Type t} {A B : ∀ a, ι a → C} + (f : ∀ a, ∀ i, A a i ⟶ B a i) : + ⨆ (a : α), ofHoms (f a) = ofHoms (fun (j : Σ (a : α), ι a) ↦ f j.1 j.2) := by + ext f + simp [ofHoms_iff] + +instance {ι : Type t} [Small.{w} ι] (W : ι → MorphismProperty C) [∀ i, IsSmall.{w} (W i)] : + IsSmall.{w} (⨆ i, W i) := by + choose α A B f hf using fun i ↦ (isSmall_iff_eq_ofHoms.{w} (W i)).1 inferInstance + simp only [hf, iSup_ofHoms] + infer_instance + end MorphismProperty end CategoryTheory diff --git a/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/Presheaf.lean b/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/Presheaf.lean new file mode 100644 index 00000000000000..fa17c3f536bff6 --- /dev/null +++ b/Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/Presheaf.lean @@ -0,0 +1,150 @@ +/- +Copyright (c) 2025 Joël Riou. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Joël Riou +-/ +module + +public import Mathlib.CategoryTheory.ObjectProperty.FunctorCategory.PreservesLimits +public import Mathlib.CategoryTheory.ObjectProperty.Local +public import Mathlib.CategoryTheory.Limits.FunctorCategory.Basic +public import Mathlib.CategoryTheory.Limits.Types.Colimits +public import Mathlib.CategoryTheory.Limits.Types.Limits +public import Mathlib.CategoryTheory.ShrinkYoneda + +/-! +# Presheaves of types which preserves a limit + +Let `F : J ⥤ Cᵒᵖ` be a functor. We show that a presheaf `P : Cᵒᵖ ⥤ Type w` +preserves the limit of `F` iff `P` is a local object with respect to a suitable +family of morphisms in `Cᵒᵖ ⥤ Type w` (this family contains `1` or `0` morphism +depending on whether the limit of `F` exists or not). + +-/ + +@[expose] public section + +universe w w' v v' u u' + +namespace CategoryTheory + +open Limits Opposite + +namespace Presheaf + +section + +variable {C : Type u} [Category.{v} C] + {J : Type u'} [Category.{v'} J] [LocallySmall.{w} C] + {F : J ⥤ Cᵒᵖ} (c : Cone F) {c' : Cocone (F.leftOp ⋙ shrinkYoneda.{w})} + (hc : IsLimit c) (hc' : IsColimit c') (P : Cᵒᵖ ⥤ Type w) + +variable {P} in +/-- Let `F : J ⥤ Cᵒᵖ` be a functor, `c'` a colimit cocone for `F.leftOp ⋙ shrinkYoneda.{w}`. +For any `P : Cᵒᵖ ⥤ Type w`, this is the bijection between `c'.pt ⟶ P` and the type +of sections of `F ⋙ P`. -/ +@[simps -isSimp symm_apply apply_coe] +noncomputable def coconeCompShrinkYonedaHomEquiv : + (c'.pt ⟶ P) ≃ (F ⋙ P).sections where + toFun f := + { val j := shrinkYonedaEquiv (c'.ι.app (op j) ≫ f) + property {X X'} g := by + have h₁ := c'.w g.op + dsimp at h₁ ⊢ + rw [← h₁, Category.assoc] + conv_rhs => rw [shrinkYonedaEquiv_comp] + rw [shrinkYonedaEquiv_shrinkYoneda_map] + apply map_shrinkYonedaEquiv } + invFun s := hc'.desc (Cocone.mk _ + { app j := shrinkYonedaEquiv.symm (s.val j.unop) + naturality j₁ j₂ f := by + rw [← s.property f.unop] + dsimp + rw [shrinkYonedaEquiv_symm_map, Category.comp_id] }) + left_inv f := hc'.hom_ext (by simp) + right_inv u := by ext; simp + + +/-- Let `F : J ⥤ Cᵒᵖ` be a functor, `c'` a colimit cocone for `F.leftOp ⋙ shrinkYoneda.{w}`. +For any cone `c` for `F`, this is the canonical natural transformation +`c'.pt ⟶ shrinkYoneda.{w}.obj c.pt.unop`. -/ +noncomputable def coconePtToShrinkYoneda : + c'.pt ⟶ shrinkYoneda.{w}.obj c.pt.unop := + hc'.desc (shrinkYoneda.{w}.mapCocone (coconeLeftOpOfCone c)) + +variable {P} in +@[reassoc] +lemma coconePtToShrinkYoneda_comp (x : P.obj c.pt) : + coconePtToShrinkYoneda c hc' ≫ shrinkYonedaEquiv.symm x = + (coconeCompShrinkYonedaHomEquiv hc').symm + (Types.sectionOfCone (P.mapCone c) x) := by + refine hc'.hom_ext (fun j ↦ ?_) + dsimp [coconePtToShrinkYoneda, coconeCompShrinkYonedaHomEquiv_symm_apply] + rw [hc'.fac_assoc, hc'.fac] + exact (shrinkYonedaEquiv_symm_map _ _).symm + +lemma nonempty_isLimit_mapCone_iff : + Nonempty (IsLimit (P.mapCone c)) ↔ + (MorphismProperty.single (coconePtToShrinkYoneda c hc')).isLocal P := by + rw [Types.isLimit_iff_bijective_sectionOfCone, + MorphismProperty.isLocal_single_iff_bijective, + ← Function.Bijective.of_comp_iff' (coconeCompShrinkYonedaHomEquiv hc').symm.bijective, + ← Function.Bijective.of_comp_iff _ shrinkYonedaEquiv.bijective] + convert Iff.rfl using 2 + ext : 1 + simp [← coconePtToShrinkYoneda_comp] + +variable {c} + +include hc in +lemma preservesLimit_eq_isLocal_single : + ObjectProperty.preservesLimit F = + (MorphismProperty.single (coconePtToShrinkYoneda c hc')).isLocal := by + ext P + rw [← nonempty_isLimit_mapCone_iff c hc' P] + exact ⟨fun _ ↦ ⟨isLimitOfPreserves P hc⟩, + fun ⟨h⟩ ↦ preservesLimit_of_preserves_limit_cone hc h⟩ + +variable (F) [Small.{w} J] + +/-- Auxiliary definition for `Presheaf.preservesLimitHomFamily`. -/ +noncomputable def preservesLimitHomFamilySrc := + colimit (F.leftOp ⋙ shrinkYoneda) + +/-- Auxiliary definition for `Presheaf.preservesLimitHomFamily`. -/ +noncomputable def preservesLimitHomFamilyTgt (h : PLift (HasLimit F)) := + letI := h.down + shrinkYoneda.obj (limit F).unop + +/-- Let `F : J ⥤ Cᵒᵖ` be a functor. This is the family of morphisms +which consists of the single morphism +`colimit (F.leftOp ⋙ shrinkYoneda) ⟶ shrinkYoneda.obj (limit F).unop` +if `F` has a limit, or is the empty family otherwise. -/ +noncomputable def preservesLimitHomFamily (h : PLift (HasLimit F)) : + preservesLimitHomFamilySrc F ⟶ preservesLimitHomFamilyTgt F h := + letI := h.down + coconePtToShrinkYoneda (limit.cone F) (colimit.isColimit _) + +lemma preservesLimit_eq_isLocal : + ObjectProperty.preservesLimit F = + (MorphismProperty.ofHoms (preservesLimitHomFamily F)).isLocal := by + ext G + by_cases hF : HasLimit F + · rw [preservesLimit_eq_isLocal_single (limit.isLimit F) (colimit.isColimit _)] + convert Iff.rfl + ext _ _ f + exact ⟨fun ⟨_⟩ ↦ ⟨⟨⟩⟩, fun ⟨_⟩ ↦ ⟨⟨hF⟩⟩⟩ + · exact ⟨fun _ _ _ _ ⟨h⟩ ↦ (hF h.down).elim, + fun _ ↦ ⟨fun hc ↦ (hF ⟨_, hc⟩).elim⟩⟩ + +lemma preservesLimitsOfShape_eq_isLocal : + ObjectProperty.preservesLimitsOfShape J = + (⨆ (F : J ⥤ Cᵒᵖ), MorphismProperty.ofHoms (preservesLimitHomFamily F)).isLocal := by + simp only [ObjectProperty.preservesLimitsOfShape_eq_iSup, + MorphismProperty.isLocal_iSup, preservesLimit_eq_isLocal] + +end + +end Presheaf + +end CategoryTheory diff --git a/Mathlib/CategoryTheory/ObjectProperty/Local.lean b/Mathlib/CategoryTheory/ObjectProperty/Local.lean index a466de4044b58d..54b66a9fa7a4c3 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/Local.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/Local.lean @@ -100,6 +100,28 @@ instance (J : Type u') [Category.{v'} J] : (by simp [h]) }), p.isColimit.hom_ext (fun j ↦ by simp [p.isColimit.fac_assoc, h])⟩ +attribute [local simp] isLocal_iff in +@[simp] +lemma isLocal_iSup {ι : Sort*} (W : ι → MorphismProperty C) : + (⨆ (i : ι), W i).isLocal = ⨅ (i : ι), (W i).isLocal := by + aesop + +attribute [local simp] isColocal_iff in +@[simp] +lemma isColocal_iSup {ι : Sort*} (W : ι → MorphismProperty C) : + (⨆ (i : ι), W i).isColocal = ⨅ (i : ι), (W i).isColocal := by + aesop + +lemma isLocal_single_iff_bijective {X Y : C} (f : X ⟶ Y) (Z : C) : + (MorphismProperty.single f).isLocal Z ↔ + (Function.Bijective (fun (g : _ ⟶ Z) ↦ f ≫ g)) := + ⟨fun h ↦ h _ ⟨⟨⟩⟩, fun h ↦ by rintro _ _ _ ⟨_⟩; exact h⟩ + +lemma isColocal_single_iff_bijective {X Y : C} (f : X ⟶ Y) (Z : C) : + (MorphismProperty.single f).isColocal Z ↔ + (Function.Bijective (fun (g : Z ⟶ _) ↦ g ≫ f)) := + ⟨fun h ↦ h _ ⟨⟨⟩⟩, fun h ↦ by rintro _ _ _ ⟨_⟩; exact h⟩ + end MorphismProperty end CategoryTheory