From 25407bba6793a24bb3d30389c9ba74d886480ad0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 13 Dec 2024 14:14:40 +0100 Subject: [PATCH 001/309] feat(CategoryTheory): presentable objects --- Mathlib.lean | 1 + Mathlib/CategoryTheory/Presentable/Basic.lean | 86 +++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 Mathlib/CategoryTheory/Presentable/Basic.lean diff --git a/Mathlib.lean b/Mathlib.lean index c63dcf2117b60f..08368e7d3fb75a 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -2046,6 +2046,7 @@ import Mathlib.CategoryTheory.Preadditive.Yoneda.Basic import Mathlib.CategoryTheory.Preadditive.Yoneda.Injective import Mathlib.CategoryTheory.Preadditive.Yoneda.Limits import Mathlib.CategoryTheory.Preadditive.Yoneda.Projective +import Mathlib.CategoryTheory.Presentable.Basic import Mathlib.CategoryTheory.Products.Associator import Mathlib.CategoryTheory.Products.Basic import Mathlib.CategoryTheory.Products.Bifunctor diff --git a/Mathlib/CategoryTheory/Presentable/Basic.lean b/Mathlib/CategoryTheory/Presentable/Basic.lean new file mode 100644 index 00000000000000..cf86f73062e54e --- /dev/null +++ b/Mathlib/CategoryTheory/Presentable/Basic.lean @@ -0,0 +1,86 @@ +/- +Copyright (c) 2024 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.Limits.Filtered +import Mathlib.SetTheory.Cardinal.Cofinality +import Mathlib.Data.Set.Finite.Basic + +/-! # Presentable objects + +-/ + +universe w v' v u' u + +namespace CategoryTheory + +open Limits Opposite + +section + +variable (J : Type w) [Preorder J] + (κ : Cardinal.{w}) + +class IsCardinalDirected [Fact κ.IsRegular] : Prop where + exists_upper_bound (S : Set J) (hS : Cardinal.mk S < κ) : + ∃ (j : J), ∀ (s : S), s.1 ≤ j + +namespace IsCardinalDirected + +variable [hκ : Fact κ.IsRegular] [IsCardinalDirected J κ] + +section + +variable {J κ} (S : Set J) (hS : Cardinal.mk S < κ) + +noncomputable def upperBound : J := + (IsCardinalDirected.exists_upper_bound S hS).choose + +lemma le_upperBound (s : S) : s.1 ≤ upperBound S hS := + (IsCardinalDirected.exists_upper_bound S hS).choose_spec s + +end + +include κ in +lemma isDirected : IsDirected J (· ≤ ·) where + directed X Y := by + have : Cardinal.mk ({X, Y} : Set J) < κ := by + refine lt_of_lt_of_le ?_ hκ.out.aleph0_le + rw [Cardinal.lt_aleph0_iff_subtype_finite] + apply Finite.Set.finite_insert + refine ⟨upperBound _ this, + le_upperBound _ this ⟨X, by simp⟩, le_upperBound _ this ⟨Y, by simp⟩⟩ + +include κ in +lemma isFiltered_of_isCardinalDirected : + IsFiltered J := by + have : Nonempty J := ⟨upperBound (κ := κ) (∅ : Set J) (by + refine lt_of_lt_of_le ?_ hκ.out.aleph0_le + simpa only [Cardinal.mk_eq_zero] using Cardinal.aleph0_pos)⟩ + have := isDirected J κ + infer_instance + +end IsCardinalDirected + +end + +variable {C : Type u} [Category.{v} C] + +def coyonedaColimitComparison (X : C) {J : Type u'} [Category.{v'} J] {F : J ⥤ C} + (c : Cocone F) : + Types.Quot (F ⋙ coyoneda.obj (op X)) → (X ⟶ c.pt) := + Quot.lift (fun ⟨j, f⟩ ↦ f ≫ c.ι.app j) (by + rintro ⟨j, f⟩ ⟨j', f'⟩ ⟨g, fac⟩ + dsimp at f f' g fac + subst fac + simp) + +variable (X : C) (κ : Cardinal.{w}) [Fact κ.IsRegular] + +class IsPresentable : Prop where + commutes {J : Type w} [Preorder J] [IsCardinalDirected J κ] + {F : J ⥤ C} (c : Cocone F) (hc : IsColimit c) : + Function.Bijective (coyonedaColimitComparison X c) + +end CategoryTheory From e45308db64305989f58a8c5059cbdd3596631489 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 13 Dec 2024 16:09:05 +0100 Subject: [PATCH 002/309] cleaning up --- Mathlib/CategoryTheory/Presentable/Basic.lean | 57 ++++++++++++++----- 1 file changed, 42 insertions(+), 15 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/Basic.lean b/Mathlib/CategoryTheory/Presentable/Basic.lean index cf86f73062e54e..7ce20dbb63608f 100644 --- a/Mathlib/CategoryTheory/Presentable/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/Basic.lean @@ -4,11 +4,22 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.CategoryTheory.Limits.Filtered +import Mathlib.CategoryTheory.Limits.Preserves.Basic import Mathlib.SetTheory.Cardinal.Cofinality import Mathlib.Data.Set.Finite.Basic /-! # Presentable objects +If `κ` is a regular cardinal, we shall say that a preordered type `J` +is `κ`-directed (`IsCardinalDirected`) if any subset of `J` of +cardinality `< κ` has an upper bound. + +A functor `F : C ⥤ D` is `κ`-accessible (`Functor.IsAccessible`) +if it commutes with colimits of shape `J` where `J` is any `κ`-directed preordered type. + +An object `X` of a category is `κ`-presentable (`IsPresentable`) +if the functor `Hom(X, _)` (i.e. `coyoneda.obj (op X)`) is `κ`-accessible. + -/ universe w v' v u' u @@ -19,9 +30,10 @@ open Limits Opposite section -variable (J : Type w) [Preorder J] - (κ : Cardinal.{w}) +variable (J : Type w) [Preorder J] (κ : Cardinal.{w}) +/-- A preorder `J` is `κ`-directed (when `κ` is regular cardinal), +if any subset of `J` of cardinality `< κ` has an upper bound. -/ class IsCardinalDirected [Fact κ.IsRegular] : Prop where exists_upper_bound (S : Set J) (hS : Cardinal.mk S < κ) : ∃ (j : J), ∀ (s : S), s.1 ≤ j @@ -34,6 +46,8 @@ section variable {J κ} (S : Set J) (hS : Cardinal.mk S < κ) +/-- A choice of upper bound for a subset `S : Set J` +of cardinality `< κ`, when `J` is `κ`-directed. -/ noncomputable def upperBound : J := (IsCardinalDirected.exists_upper_bound S hS).choose @@ -65,22 +79,35 @@ end IsCardinalDirected end -variable {C : Type u} [Category.{v} C] +variable {C : Type u} [Category.{v} C] {D : Type u'} [Category.{v'} D] + +namespace Functor -def coyonedaColimitComparison (X : C) {J : Type u'} [Category.{v'} J] {F : J ⥤ C} - (c : Cocone F) : - Types.Quot (F ⋙ coyoneda.obj (op X)) → (X ⟶ c.pt) := - Quot.lift (fun ⟨j, f⟩ ↦ f ≫ c.ι.app j) (by - rintro ⟨j, f⟩ ⟨j', f'⟩ ⟨g, fac⟩ - dsimp at f f' g fac - subst fac - simp) +variable (F : C ⥤ D) (κ : Cardinal.{w}) [Fact κ.IsRegular] + +/-- A functor is `κ`-accessible (with `κ` a regular cardinal) +if it preserves colimits of shape `J` where `J` is any `κ`-directed preorder. -/ +class IsAccessible : Prop where + preservesColimitOfShape {J : Type w} [Preorder J] [IsCardinalDirected J κ] : + PreservesColimitsOfShape J F + +lemma preservesColimitsOfShape_of_isAccessible [F.IsAccessible κ] + (J : Type w) [Preorder J] [IsCardinalDirected J κ] : + PreservesColimitsOfShape J F := + IsAccessible.preservesColimitOfShape κ + +end Functor variable (X : C) (κ : Cardinal.{w}) [Fact κ.IsRegular] -class IsPresentable : Prop where - commutes {J : Type w} [Preorder J] [IsCardinalDirected J κ] - {F : J ⥤ C} (c : Cocone F) (hc : IsColimit c) : - Function.Bijective (coyonedaColimitComparison X c) +/-- An object `X` in a category is `κ`-presentable (for `κ` a regular cardinal) +when the functor `Hom(X, _)` preserves colimits indexed by +`κ`-directed preordered sets. -/ +abbrev IsPresentable : Prop := (coyoneda.obj (op X)).IsAccessible κ + +lemma preservesColimitsOfShape_of_isPresentable [IsPresentable X κ] + (J : Type w) [Preorder J] [IsCardinalDirected J κ] : + PreservesColimitsOfShape J (coyoneda.obj (op X)) := + (coyoneda.obj (op X)).preservesColimitsOfShape_of_isAccessible κ J end CategoryTheory From c07745cb536cae05d036e3be42ea2fbfd058cdf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 13 Dec 2024 16:09:34 +0100 Subject: [PATCH 003/309] typo --- Mathlib/CategoryTheory/Presentable/Basic.lean | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/Basic.lean b/Mathlib/CategoryTheory/Presentable/Basic.lean index 7ce20dbb63608f..963b0266745765 100644 --- a/Mathlib/CategoryTheory/Presentable/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/Basic.lean @@ -86,7 +86,7 @@ namespace Functor variable (F : C ⥤ D) (κ : Cardinal.{w}) [Fact κ.IsRegular] /-- A functor is `κ`-accessible (with `κ` a regular cardinal) -if it preserves colimits of shape `J` where `J` is any `κ`-directed preorder. -/ +if it preserves colimits of shape `J` where `J` is any `κ`-directed preordered type. -/ class IsAccessible : Prop where preservesColimitOfShape {J : Type w} [Preorder J] [IsCardinalDirected J κ] : PreservesColimitsOfShape J F @@ -102,7 +102,7 @@ variable (X : C) (κ : Cardinal.{w}) [Fact κ.IsRegular] /-- An object `X` in a category is `κ`-presentable (for `κ` a regular cardinal) when the functor `Hom(X, _)` preserves colimits indexed by -`κ`-directed preordered sets. -/ +`κ`-directed preordered types. -/ abbrev IsPresentable : Prop := (coyoneda.obj (op X)).IsAccessible κ lemma preservesColimitsOfShape_of_isPresentable [IsPresentable X κ] From 357684fe84c2da2b747704cd834496a8e6111161 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 13 Dec 2024 16:26:57 +0100 Subject: [PATCH 004/309] added ref --- Mathlib/CategoryTheory/Presentable/Basic.lean | 24 +++++++++++++++++++ docs/references.bib | 15 ++++++++++++ 2 files changed, 39 insertions(+) diff --git a/Mathlib/CategoryTheory/Presentable/Basic.lean b/Mathlib/CategoryTheory/Presentable/Basic.lean index 963b0266745765..326e151b77b510 100644 --- a/Mathlib/CategoryTheory/Presentable/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/Basic.lean @@ -3,6 +3,7 @@ Copyright (c) 2024 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.Limits.Filtered import Mathlib.CategoryTheory.Limits.Preserves.Basic import Mathlib.SetTheory.Cardinal.Cofinality @@ -20,6 +21,9 @@ if it commutes with colimits of shape `J` where `J` is any `κ`-directed preorde An object `X` of a category is `κ`-presentable (`IsPresentable`) if the functor `Hom(X, _)` (i.e. `coyoneda.obj (op X)`) is `κ`-accessible. +## References +* [Adámek, J. and Rosický, J., *Locally presentable and accessible categories*][Adamek_Rosicky_1994] + -/ universe w v' v u' u @@ -56,6 +60,12 @@ lemma le_upperBound (s : S) : s.1 ≤ upperBound S hS := end +variable {κ} in +lemma of_le {κ' : Cardinal.{w}} [Fact κ'.IsRegular] (h : κ' ≤ κ) : + IsCardinalDirected J κ' where + exists_upper_bound S hS := + ⟨upperBound S (lt_of_lt_of_le hS h), le_upperBound _ _⟩ + include κ in lemma isDirected : IsDirected J (· ≤ ·) where directed X Y := by @@ -96,6 +106,14 @@ lemma preservesColimitsOfShape_of_isAccessible [F.IsAccessible κ] PreservesColimitsOfShape J F := IsAccessible.preservesColimitOfShape κ +variable {κ} in +lemma isAccessible_of_le + [F.IsAccessible κ] {κ' : Cardinal.{w}} [Fact κ'.IsRegular] (h : κ ≤ κ') : + F.IsAccessible κ' where + preservesColimitOfShape {J _ _} := by + have := IsCardinalDirected.of_le J h + exact F.preservesColimitsOfShape_of_isAccessible κ J + end Functor variable (X : C) (κ : Cardinal.{w}) [Fact κ.IsRegular] @@ -110,4 +128,10 @@ lemma preservesColimitsOfShape_of_isPresentable [IsPresentable X κ] PreservesColimitsOfShape J (coyoneda.obj (op X)) := (coyoneda.obj (op X)).preservesColimitsOfShape_of_isAccessible κ J +variable {κ} in +lemma isPresentable_of_le [IsPresentable X κ] + {κ' : Cardinal.{w}} [Fact κ'.IsRegular] (h : κ ≤ κ') : + IsPresentable X κ' := + (coyoneda.obj (op X)).isAccessible_of_le h + end CategoryTheory diff --git a/docs/references.bib b/docs/references.bib index d397a999563cc3..6670fdbf4f0abb 100644 --- a/docs/references.bib +++ b/docs/references.bib @@ -21,6 +21,21 @@ @Book{ abramsky_gabbay_maibaum_1994 zbl = {0829.68111} } +@Book{ Adamek_Rosicky_1994, + author = {Adámek, Jiří and Rosický, Jiří}, + title = {Locally presentable and accessible categories}, + series = {London Mathematical Society Lecture Note Series}, + volume = {189}, + publisher = {Cambridge University Press, Cambridge}, + year = {1994}, + pages = {xiv+316}, + isbn = {0-521-42261-2}, + mrclass = {18Axx (18-02)}, + mrnumber = {1294136}, + doi = {10.1017/CBO9780511600579}, + url = {https://doi.org/10.1017/CBO9780511600579}, +} + @Book{ Adamek_Rosicky_Vitale_2010, place = {Cambridge}, series = {Cambridge Tracts in Mathematics}, From da24d3f9dc1a15903c71a9e2fbc045fef4c831bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 13 Dec 2024 16:31:55 +0100 Subject: [PATCH 005/309] fixing imports --- Mathlib/CategoryTheory/Presentable/Basic.lean | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/Basic.lean b/Mathlib/CategoryTheory/Presentable/Basic.lean index 326e151b77b510..0a7a6fc0b7105c 100644 --- a/Mathlib/CategoryTheory/Presentable/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/Basic.lean @@ -4,10 +4,10 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ -import Mathlib.CategoryTheory.Limits.Filtered +import Mathlib.CategoryTheory.Filtered.Basic import Mathlib.CategoryTheory.Limits.Preserves.Basic -import Mathlib.SetTheory.Cardinal.Cofinality import Mathlib.Data.Set.Finite.Basic +import Mathlib.SetTheory.Cardinal.Cofinality /-! # Presentable objects From 2ee8c78d6f1d78597db824aa83769b36d127febe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= <37772949+joelriou@users.noreply.github.com> Date: Fri, 13 Dec 2024 16:32:31 +0100 Subject: [PATCH 006/309] Update docs/references.bib Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- docs/references.bib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/references.bib b/docs/references.bib index 6670fdbf4f0abb..51a6c001b2d090 100644 --- a/docs/references.bib +++ b/docs/references.bib @@ -33,7 +33,7 @@ @Book{ Adamek_Rosicky_1994 mrclass = {18Axx (18-02)}, mrnumber = {1294136}, doi = {10.1017/CBO9780511600579}, - url = {https://doi.org/10.1017/CBO9780511600579}, + url = {https://doi.org/10.1017/CBO9780511600579} } @Book{ Adamek_Rosicky_Vitale_2010, From 05d573bcd79ef90539eabed9fe4eef099f6846be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 13 Dec 2024 18:43:06 +0100 Subject: [PATCH 007/309] s/directed/filtered/ --- Mathlib/CategoryTheory/Presentable/Basic.lean | 203 +++++++++++++----- 1 file changed, 145 insertions(+), 58 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/Basic.lean b/Mathlib/CategoryTheory/Presentable/Basic.lean index 0a7a6fc0b7105c..083d44a3fe5747 100644 --- a/Mathlib/CategoryTheory/Presentable/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/Basic.lean @@ -11,12 +11,13 @@ import Mathlib.SetTheory.Cardinal.Cofinality /-! # Presentable objects -If `κ` is a regular cardinal, we shall say that a preordered type `J` -is `κ`-directed (`IsCardinalDirected`) if any subset of `J` of -cardinality `< κ` has an upper bound. +If `κ` is a regular cardinal, we introduce the notion of `κ`-filtered +category, which generalizes the notion of filtered category. +Indeed, we obtain the equivalence +`IsCardinalFiltered J ℵ₀ ↔ IsFiltered J`. A functor `F : C ⥤ D` is `κ`-accessible (`Functor.IsAccessible`) -if it commutes with colimits of shape `J` where `J` is any `κ`-directed preordered type. +if it commutes with colimits of shape `J` where `J` is any `κ`-filtered category. An object `X` of a category is `κ`-presentable (`IsPresentable`) if the functor `Hom(X, _)` (i.e. `coyoneda.obj (op X)`) is `κ`-accessible. @@ -26,66 +27,152 @@ if the functor `Hom(X, _)` (i.e. `coyoneda.obj (op X)`) is `κ`-accessible. -/ -universe w v' v u' u +universe w w' v' v u' u namespace CategoryTheory open Limits Opposite -section - -variable (J : Type w) [Preorder J] (κ : Cardinal.{w}) - -/-- A preorder `J` is `κ`-directed (when `κ` is regular cardinal), -if any subset of `J` of cardinality `< κ` has an upper bound. -/ -class IsCardinalDirected [Fact κ.IsRegular] : Prop where - exists_upper_bound (S : Set J) (hS : Cardinal.mk S < κ) : - ∃ (j : J), ∀ (s : S), s.1 ≤ j - -namespace IsCardinalDirected - -variable [hκ : Fact κ.IsRegular] [IsCardinalDirected J κ] +-- to be moved +@[simp] +lemma cardinal_arrow_discrete (S : Type w) : + Cardinal.mk (Arrow (Discrete S)) = Cardinal.mk S := by + let e : Arrow (Discrete S) ≃ S := + { toFun f := f.left.as + invFun s := Arrow.mk (𝟙 (Discrete.mk s)) + left_inv := by + rintro ⟨⟨a⟩, ⟨b⟩, f⟩ + obtain rfl := Discrete.eq_of_hom f + rfl + right_inv _ := rfl } + exact Cardinal.mk_congr e section -variable {J κ} (S : Set J) (hS : Cardinal.mk S < κ) - -/-- A choice of upper bound for a subset `S : Set J` -of cardinality `< κ`, when `J` is `κ`-directed. -/ -noncomputable def upperBound : J := - (IsCardinalDirected.exists_upper_bound S hS).choose +/-- A category `J` is `κ`-filtered (for a regular cardinal `κ`) is +any functor `F : A ⥤ J` from a `κ`-small category (`Cardinal.mk (Arrow A) < κ`) +admits a cocone. -/ +class IsCardinalFiltered (J : Type w) [SmallCategory J] + (κ : Cardinal.{w}) [Fact κ.IsRegular] : Prop where + nonempty_cocone {A : Type w} [SmallCategory A] (F : A ⥤ J) + (hA : Cardinal.mk (Arrow A) < κ) : Nonempty (Cocone F) + +namespace IsCardinalFiltered + +variable {J : Type w} [SmallCategory J] {κ : Cardinal.{w}} [hκ : Fact κ.IsRegular] + [IsCardinalFiltered J κ] + +/-- A choice of cocone for a functor `F : A ⥤ J` such that `Cardinal.mk (Arrow A) < κ` +when `J` is a `κ`-filtered category. -/ +noncomputable def cocone {A : Type w} [SmallCategory A] + (F : A ⥤ J) (hA : Cardinal.mk (Arrow A) < κ) : + Cocone F := + (nonempty_cocone (κ := κ) _ hA).some + +/-- When `S : Set J` is of cardinality `< κ` and `J` is `κ`-filtered, this is +a choice of object in `J` which is the target of a map from any object in `S`. -/ +noncomputable def max (S : Set J) (hS : Cardinal.mk S < κ) : J := by + have : Cardinal.mk (Arrow (Discrete S)) < κ := by simpa using hS + exact (cocone (Discrete.functor Subtype.val) this).pt + +/-- When `S : Set J` is of cardinality `< κ` and `J` is `κ`-filtered, +this is a choice of map `s.1 ⟶ max S hS` for any `s : S`. -/ +noncomputable def toMax (S : Set J) (hS : Cardinal.mk S < κ) (s : S) : + s.1 ⟶ max S hS := by + have : Cardinal.mk (Arrow (Discrete S)) < κ := by simpa using hS + exact (cocone (Discrete.functor Subtype.val) this).ι.app ⟨s⟩ + +variable (J) -lemma le_upperBound (s : S) : s.1 ≤ upperBound S hS := - (IsCardinalDirected.exists_upper_bound S hS).choose_spec s - -end - -variable {κ} in lemma of_le {κ' : Cardinal.{w}} [Fact κ'.IsRegular] (h : κ' ≤ κ) : - IsCardinalDirected J κ' where - exists_upper_bound S hS := - ⟨upperBound S (lt_of_lt_of_le hS h), le_upperBound _ _⟩ - -include κ in -lemma isDirected : IsDirected J (· ≤ ·) where - directed X Y := by - have : Cardinal.mk ({X, Y} : Set J) < κ := by - refine lt_of_lt_of_le ?_ hκ.out.aleph0_le - rw [Cardinal.lt_aleph0_iff_subtype_finite] - apply Finite.Set.finite_insert - refine ⟨upperBound _ this, - le_upperBound _ this ⟨X, by simp⟩, le_upperBound _ this ⟨Y, by simp⟩⟩ - -include κ in -lemma isFiltered_of_isCardinalDirected : + IsCardinalFiltered J κ' where + nonempty_cocone F hA := ⟨cocone F (lt_of_lt_of_le hA h)⟩ + +end IsCardinalFiltered + +-- to be moved +/-- `Arrow A` is equivalent to a sigma type. -/ +@[simps!] +def Arrow.equivSigma (A : Type u) [Category.{v} A] : + Arrow A ≃ Σ (X : A) (Y : A), X ⟶ Y where + toFun f := ⟨_, _, f.hom⟩ + invFun x := Arrow.mk x.2.2 + left_inv _ := rfl + right_inv _ := rfl + +-- to be moved +lemma Arrow.finite_iff (A : Type u) [SmallCategory A] : + Finite (Arrow A) ↔ Nonempty (FinCategory A) := by + constructor + · intro + refine ⟨?_, fun a b ↦ ?_⟩ + · have := Finite.of_injective (fun (a : A) ↦ Arrow.mk (𝟙 a)) + (fun _ _ ↦ congr_arg Comma.left) + apply Fintype.ofFinite + · have := Finite.of_injective (fun (f : a ⟶ b) ↦ Arrow.mk f) + (fun f g h ↦ by + change (Arrow.mk f).hom = (Arrow.mk g).hom + congr) + apply Fintype.ofFinite + · rintro ⟨_⟩ + have := Fintype.ofEquiv _ (Arrow.equivSigma A).symm + infer_instance + +-- to be moved +instance {A : Type u} [SmallCategory A] [FinCategory A] : + Finite (Arrow A) := by + rw [Arrow.finite_iff] + exact ⟨inferInstance⟩ + +open IsCardinalFiltered in +lemma isFiltered_of_isCardinalDirected (J : Type w) [SmallCategory J] + (κ : Cardinal.{w}) [hκ : Fact κ.IsRegular] [IsCardinalFiltered J κ]: IsFiltered J := by - have : Nonempty J := ⟨upperBound (κ := κ) (∅ : Set J) (by + rw [IsFiltered.iff_cocone_nonempty.{w}] + intro A _ _ F + have hA : Cardinal.mk (Arrow A) < κ := by refine lt_of_lt_of_le ?_ hκ.out.aleph0_le - simpa only [Cardinal.mk_eq_zero] using Cardinal.aleph0_pos)⟩ - have := isDirected J κ - infer_instance - -end IsCardinalDirected + rw [Cardinal.mk_lt_aleph0_iff] + infer_instance + exact ⟨cocone F hA⟩ + +instance : Fact Cardinal.aleph0.IsRegular where + out := Cardinal.isRegular_aleph0 + +lemma isCardinalFiltered_aleph0_iff (J : Type w) [SmallCategory J] : + IsCardinalFiltered J Cardinal.aleph0 ↔ IsFiltered J := by + constructor + · intro + exact isFiltered_of_isCardinalDirected J Cardinal.aleph0 + · intro + constructor + intro A _ F hA + rw [Cardinal.mk_lt_aleph0_iff] at hA + have := ((Arrow.finite_iff A).1 hA).some + exact ⟨IsFiltered.cocone F⟩ + +-- to be moved +lemma cardinal_le_cardinal_arrow (A : Type u) [SmallCategory A] : + Cardinal.mk A ≤ Cardinal.mk (Arrow A) := + Cardinal.mk_le_of_injective (f := fun a ↦ Arrow.mk (𝟙 a)) (fun _ _ ↦ congr_arg Comma.left) + +lemma isCardinalFiltered_preorder (J : Type w) [Preorder J] + (κ : Cardinal.{w}) [Fact κ.IsRegular] + (h : ∀ (S : Set J) (_ : Cardinal.mk S < κ), ∃ (j : J), ∀ (s : S), s.1 ≤ j) : + IsCardinalFiltered J κ where + nonempty_cocone {A _ F hA} := by + let S := Set.range F.obj + have hS : Cardinal.mk S < κ := by + let f : A → S := fun a ↦ ⟨F.obj a, ⟨a, rfl⟩⟩ + have hf : Function.Surjective f := by + rintro ⟨_, ⟨a, rfl⟩⟩ + exact ⟨a, rfl⟩ + exact lt_of_le_of_lt (Cardinal.mk_le_of_surjective hf) + (lt_of_le_of_lt (cardinal_le_cardinal_arrow A) hA) + obtain ⟨j, hj⟩ := h S hS + refine ⟨Cocone.mk j + { app a := homOfLE (hj ⟨F.obj a, ⟨a, rfl⟩⟩) + naturality _ _ _ := rfl }⟩ end @@ -96,13 +183,13 @@ namespace Functor variable (F : C ⥤ D) (κ : Cardinal.{w}) [Fact κ.IsRegular] /-- A functor is `κ`-accessible (with `κ` a regular cardinal) -if it preserves colimits of shape `J` where `J` is any `κ`-directed preordered type. -/ +if it preserves colimits of shape `J` where `J` is any `κ`-filtered category. -/ class IsAccessible : Prop where - preservesColimitOfShape {J : Type w} [Preorder J] [IsCardinalDirected J κ] : + preservesColimitOfShape {J : Type w} [SmallCategory J] [IsCardinalFiltered J κ] : PreservesColimitsOfShape J F lemma preservesColimitsOfShape_of_isAccessible [F.IsAccessible κ] - (J : Type w) [Preorder J] [IsCardinalDirected J κ] : + (J : Type w) [SmallCategory J] [IsCardinalFiltered J κ] : PreservesColimitsOfShape J F := IsAccessible.preservesColimitOfShape κ @@ -111,7 +198,7 @@ lemma isAccessible_of_le [F.IsAccessible κ] {κ' : Cardinal.{w}} [Fact κ'.IsRegular] (h : κ ≤ κ') : F.IsAccessible κ' where preservesColimitOfShape {J _ _} := by - have := IsCardinalDirected.of_le J h + have := IsCardinalFiltered.of_le J h exact F.preservesColimitsOfShape_of_isAccessible κ J end Functor @@ -120,11 +207,11 @@ variable (X : C) (κ : Cardinal.{w}) [Fact κ.IsRegular] /-- An object `X` in a category is `κ`-presentable (for `κ` a regular cardinal) when the functor `Hom(X, _)` preserves colimits indexed by -`κ`-directed preordered types. -/ +`κ`-filtered categories. -/ abbrev IsPresentable : Prop := (coyoneda.obj (op X)).IsAccessible κ lemma preservesColimitsOfShape_of_isPresentable [IsPresentable X κ] - (J : Type w) [Preorder J] [IsCardinalDirected J κ] : + (J : Type w) [SmallCategory J] [IsCardinalFiltered J κ] : PreservesColimitsOfShape J (coyoneda.obj (op X)) := (coyoneda.obj (op X)).preservesColimitsOfShape_of_isAccessible κ J From d48b4f3a36b9eea1d8e60f969a3a9ea719ad7c28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 13 Dec 2024 19:11:43 +0100 Subject: [PATCH 008/309] cardinality of Arrow --- Mathlib.lean | 1 + Mathlib/CategoryTheory/Comma/Arrow.lean | 21 ++++++++ .../CategoryTheory/Comma/CardinalArrow.lean | 50 +++++++++++++++++++ 3 files changed, 72 insertions(+) create mode 100644 Mathlib/CategoryTheory/Comma/CardinalArrow.lean diff --git a/Mathlib.lean b/Mathlib.lean index dfa70e2924e2d7..b462a2ce8b11ed 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -1669,6 +1669,7 @@ import Mathlib.CategoryTheory.CofilteredSystem import Mathlib.CategoryTheory.CommSq import Mathlib.CategoryTheory.Comma.Arrow import Mathlib.CategoryTheory.Comma.Basic +import Mathlib.CategoryTheory.Comma.CardinalArrow import Mathlib.CategoryTheory.Comma.Final import Mathlib.CategoryTheory.Comma.Over import Mathlib.CategoryTheory.Comma.OverClass diff --git a/Mathlib/CategoryTheory/Comma/Arrow.lean b/Mathlib/CategoryTheory/Comma/Arrow.lean index cc6d53e196a949..ac388b2c255e61 100644 --- a/Mathlib/CategoryTheory/Comma/Arrow.lean +++ b/Mathlib/CategoryTheory/Comma/Arrow.lean @@ -333,4 +333,25 @@ def Arrow.isoOfNatIso {C D : Type*} [Category C] [Category D] {F G : C ⥤ D} (e (f : Arrow C) : F.mapArrow.obj f ≅ G.mapArrow.obj f := Arrow.isoMk (e.app f.left) (e.app f.right) +variable (T) + +/-- `Arrow T` is equivalent to a sigma type. -/ +@[simps!] +def Arrow.equivSigma : + Arrow T ≃ Σ (X Y : T), X ⟶ Y where + toFun f := ⟨_, _, f.hom⟩ + invFun x := Arrow.mk x.2.2 + left_inv _ := rfl + right_inv _ := rfl + +/-- The equivalence `Arrow (Discrete S) ≃ S`. -/ +def Arrow.discreteEquiv (S : Type u) : Arrow (Discrete S) ≃ S where + toFun f := f.left.as + invFun s := Arrow.mk (𝟙 (Discrete.mk s)) + left_inv := by + rintro ⟨⟨_⟩, ⟨_⟩, f⟩ + obtain rfl := Discrete.eq_of_hom f + rfl + right_inv _ := rfl + end CategoryTheory diff --git a/Mathlib/CategoryTheory/Comma/CardinalArrow.lean b/Mathlib/CategoryTheory/Comma/CardinalArrow.lean new file mode 100644 index 00000000000000..ca598dcdb6d492 --- /dev/null +++ b/Mathlib/CategoryTheory/Comma/CardinalArrow.lean @@ -0,0 +1,50 @@ +/- +Copyright (c) 2024 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.Comma.Arrow +import Mathlib.CategoryTheory.FinCategory.Basic +import Mathlib.Data.Set.Finite.Basic +import Mathlib.SetTheory.Cardinal.Basic + +/-! +# Cardinal of Arrow + +If `A` is a (small) category, `Arrow A` is finite iff `FinCategory A` holds. + +-/ + +universe u + +namespace CategoryTheory + +@[simp] +lemma cardinal_arrow_discrete (S : Type u) : + Cardinal.mk (Arrow (Discrete S)) = Cardinal.mk S := + Cardinal.mk_congr (Arrow.discreteEquiv S) + +lemma Arrow.finite_iff (A : Type u) [SmallCategory A] : + Finite (Arrow A) ↔ Nonempty (FinCategory A) := by + constructor + · intro + refine ⟨?_, fun a b ↦ ?_⟩ + · have := Finite.of_injective (fun (a : A) ↦ Arrow.mk (𝟙 a)) + (fun _ _ ↦ congr_arg Comma.left) + apply Fintype.ofFinite + · have := Finite.of_injective (fun (f : a ⟶ b) ↦ Arrow.mk f) + (fun f g h ↦ by + change (Arrow.mk f).hom = (Arrow.mk g).hom + congr) + apply Fintype.ofFinite + · rintro ⟨_⟩ + have := Fintype.ofEquiv _ (Arrow.equivSigma A).symm + infer_instance + +instance Arrow.finite {A : Type u} [SmallCategory A] [FinCategory A] : + Finite (Arrow A) := by + rw [Arrow.finite_iff] + exact ⟨inferInstance⟩ + +end CategoryTheory From 737913432c8fe1f8047b7e44d0c32bfc87aa5190 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 13 Dec 2024 19:32:05 +0100 Subject: [PATCH 009/309] cardinal_le_cardinal_arrow --- Mathlib/CategoryTheory/Comma/CardinalArrow.lean | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Mathlib/CategoryTheory/Comma/CardinalArrow.lean b/Mathlib/CategoryTheory/Comma/CardinalArrow.lean index ca598dcdb6d492..758957caf658a9 100644 --- a/Mathlib/CategoryTheory/Comma/CardinalArrow.lean +++ b/Mathlib/CategoryTheory/Comma/CardinalArrow.lean @@ -47,4 +47,8 @@ instance Arrow.finite {A : Type u} [SmallCategory A] [FinCategory A] : rw [Arrow.finite_iff] exact ⟨inferInstance⟩ +lemma cardinal_le_cardinal_arrow (A : Type u) [SmallCategory A] : + Cardinal.mk A ≤ Cardinal.mk (Arrow A) := + Cardinal.mk_le_of_injective (f := fun a ↦ Arrow.mk (𝟙 a)) (fun _ _ ↦ congr_arg Comma.left) + end CategoryTheory From fbd5682931eee549c4d66323b018ac866247d4a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 13 Dec 2024 19:32:22 +0100 Subject: [PATCH 010/309] wip --- Mathlib/CategoryTheory/Presentable/Basic.lean | 1 + 1 file changed, 1 insertion(+) diff --git a/Mathlib/CategoryTheory/Presentable/Basic.lean b/Mathlib/CategoryTheory/Presentable/Basic.lean index 083d44a3fe5747..cc5be5ff83db20 100644 --- a/Mathlib/CategoryTheory/Presentable/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/Basic.lean @@ -6,6 +6,7 @@ Authors: Joël Riou import Mathlib.CategoryTheory.Filtered.Basic import Mathlib.CategoryTheory.Limits.Preserves.Basic +import Mathlib.CategoryTheory.Comma.CardinalArrow import Mathlib.Data.Set.Finite.Basic import Mathlib.SetTheory.Cardinal.Cofinality From f1aef0f2ed8731e6a81090c603e84be5ff49eea4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 13 Dec 2024 19:33:26 +0100 Subject: [PATCH 011/309] wip --- Mathlib/CategoryTheory/Presentable/Basic.lean | 54 ------------------- 1 file changed, 54 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/Basic.lean b/Mathlib/CategoryTheory/Presentable/Basic.lean index cc5be5ff83db20..78f1dd09e97b9e 100644 --- a/Mathlib/CategoryTheory/Presentable/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/Basic.lean @@ -7,7 +7,6 @@ Authors: Joël Riou import Mathlib.CategoryTheory.Filtered.Basic import Mathlib.CategoryTheory.Limits.Preserves.Basic import Mathlib.CategoryTheory.Comma.CardinalArrow -import Mathlib.Data.Set.Finite.Basic import Mathlib.SetTheory.Cardinal.Cofinality /-! # Presentable objects @@ -34,20 +33,6 @@ namespace CategoryTheory open Limits Opposite --- to be moved -@[simp] -lemma cardinal_arrow_discrete (S : Type w) : - Cardinal.mk (Arrow (Discrete S)) = Cardinal.mk S := by - let e : Arrow (Discrete S) ≃ S := - { toFun f := f.left.as - invFun s := Arrow.mk (𝟙 (Discrete.mk s)) - left_inv := by - rintro ⟨⟨a⟩, ⟨b⟩, f⟩ - obtain rfl := Discrete.eq_of_hom f - rfl - right_inv _ := rfl } - exact Cardinal.mk_congr e - section /-- A category `J` is `κ`-filtered (for a regular cardinal `κ`) is @@ -91,40 +76,6 @@ lemma of_le {κ' : Cardinal.{w}} [Fact κ'.IsRegular] (h : κ' ≤ κ) : end IsCardinalFiltered --- to be moved -/-- `Arrow A` is equivalent to a sigma type. -/ -@[simps!] -def Arrow.equivSigma (A : Type u) [Category.{v} A] : - Arrow A ≃ Σ (X : A) (Y : A), X ⟶ Y where - toFun f := ⟨_, _, f.hom⟩ - invFun x := Arrow.mk x.2.2 - left_inv _ := rfl - right_inv _ := rfl - --- to be moved -lemma Arrow.finite_iff (A : Type u) [SmallCategory A] : - Finite (Arrow A) ↔ Nonempty (FinCategory A) := by - constructor - · intro - refine ⟨?_, fun a b ↦ ?_⟩ - · have := Finite.of_injective (fun (a : A) ↦ Arrow.mk (𝟙 a)) - (fun _ _ ↦ congr_arg Comma.left) - apply Fintype.ofFinite - · have := Finite.of_injective (fun (f : a ⟶ b) ↦ Arrow.mk f) - (fun f g h ↦ by - change (Arrow.mk f).hom = (Arrow.mk g).hom - congr) - apply Fintype.ofFinite - · rintro ⟨_⟩ - have := Fintype.ofEquiv _ (Arrow.equivSigma A).symm - infer_instance - --- to be moved -instance {A : Type u} [SmallCategory A] [FinCategory A] : - Finite (Arrow A) := by - rw [Arrow.finite_iff] - exact ⟨inferInstance⟩ - open IsCardinalFiltered in lemma isFiltered_of_isCardinalDirected (J : Type w) [SmallCategory J] (κ : Cardinal.{w}) [hκ : Fact κ.IsRegular] [IsCardinalFiltered J κ]: @@ -152,11 +103,6 @@ lemma isCardinalFiltered_aleph0_iff (J : Type w) [SmallCategory J] : have := ((Arrow.finite_iff A).1 hA).some exact ⟨IsFiltered.cocone F⟩ --- to be moved -lemma cardinal_le_cardinal_arrow (A : Type u) [SmallCategory A] : - Cardinal.mk A ≤ Cardinal.mk (Arrow A) := - Cardinal.mk_le_of_injective (f := fun a ↦ Arrow.mk (𝟙 a)) (fun _ _ ↦ congr_arg Comma.left) - lemma isCardinalFiltered_preorder (J : Type w) [Preorder J] (κ : Cardinal.{w}) [Fact κ.IsRegular] (h : ∀ (S : Set J) (_ : Cardinal.mk S < κ), ∃ (j : J), ∀ (s : S), s.1 ≤ j) : From ef6c402a0bbaa9bbd6e64f5dcd45075e193aac49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sat, 14 Dec 2024 11:20:09 +0100 Subject: [PATCH 012/309] wip --- Mathlib.lean | 1 + .../CategoryTheory/Comma/CardinalArrow.lean | 11 +- .../CategoryTheory/Presentable/Limits.lean | 138 ++++++++++++++++++ 3 files changed, 149 insertions(+), 1 deletion(-) create mode 100644 Mathlib/CategoryTheory/Presentable/Limits.lean diff --git a/Mathlib.lean b/Mathlib.lean index 743033d3a013b5..3cb276777a36bb 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -2050,6 +2050,7 @@ import Mathlib.CategoryTheory.Preadditive.Yoneda.Injective import Mathlib.CategoryTheory.Preadditive.Yoneda.Limits import Mathlib.CategoryTheory.Preadditive.Yoneda.Projective import Mathlib.CategoryTheory.Presentable.Basic +import Mathlib.CategoryTheory.Presentable.Limits import Mathlib.CategoryTheory.Products.Associator import Mathlib.CategoryTheory.Products.Basic import Mathlib.CategoryTheory.Products.Bifunctor diff --git a/Mathlib/CategoryTheory/Comma/CardinalArrow.lean b/Mathlib/CategoryTheory/Comma/CardinalArrow.lean index 758957caf658a9..4b18733ffb239c 100644 --- a/Mathlib/CategoryTheory/Comma/CardinalArrow.lean +++ b/Mathlib/CategoryTheory/Comma/CardinalArrow.lean @@ -16,7 +16,7 @@ If `A` is a (small) category, `Arrow A` is finite iff `FinCategory A` holds. -/ -universe u +universe v u namespace CategoryTheory @@ -25,6 +25,15 @@ lemma cardinal_arrow_discrete (S : Type u) : Cardinal.mk (Arrow (Discrete S)) = Cardinal.mk S := Cardinal.mk_congr (Arrow.discreteEquiv S) +@[simp] +lemma cardinal_arrow_op (A : Type u) [Category.{v} A] : + Cardinal.mk (Arrow Aᵒᵖ) = Cardinal.mk (Arrow A) := + Cardinal.mk_congr + { toFun f := Arrow.mk f.hom.unop + invFun g := Arrow.mk g.hom.op + left_inv _ := rfl + right_inv _ := rfl } + lemma Arrow.finite_iff (A : Type u) [SmallCategory A] : Finite (Arrow A) ↔ Nonempty (FinCategory A) := by constructor diff --git a/Mathlib/CategoryTheory/Presentable/Limits.lean b/Mathlib/CategoryTheory/Presentable/Limits.lean new file mode 100644 index 00000000000000..5206871435ef1b --- /dev/null +++ b/Mathlib/CategoryTheory/Presentable/Limits.lean @@ -0,0 +1,138 @@ +/- +Copyright (c) 2024 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.Limits.Preserves.Basic +import Mathlib.CategoryTheory.Limits.Types +import Mathlib.CategoryTheory.Limits.Yoneda +import Mathlib.CategoryTheory.Limits.FunctorCategory.Basic +import Mathlib.CategoryTheory.Presentable.Basic + +/-! +# Colimits of presentable objects + +In this file, we show that `κ`-accessible functors (to the category of types) +are stable under limits indexed by a small category `K` such that +`Cardinal.mk (Arrow K) < κ`. + +-/ + +universe w w' v u + +namespace CategoryTheory + +open Opposite Limits + +namespace Limits + +namespace Types + +namespace FilteredColimit + +variable {J : Type u} [Category.{v} J] [IsFiltered J] {F : J ⥤ Type w} + (c : Cocone F) + +def isColimit_mk (hc₁ : ∀ (x : c.pt), ∃ (j : J) (y : F.obj j), c.ι.app j y = x) + (hc₂ : ∀ (j : J) (y₁ y₂ : F.obj j) (hy : c.ι.app j y₁ = c.ι.app j y₂), + ∃ (j' : J) (k : j ⟶ j'), F.map k y₁ = F.map k y₂) : + IsColimit c := by + have : IsFiltered J := inferInstance + sorry + +end FilteredColimit + +end Types + +end Limits + +variable {C : Type u} [Category.{v} C] + +namespace Functor + +namespace Accessible + +namespace Limits + +section + +variable {K : Type w} [SmallCategory K] {F : K ⥤ C ⥤ Type w'} + (c : Cone F) (hc : ∀ (Y : C), IsLimit (((evaluation _ _).obj Y).mapCone c)) + (κ : Cardinal.{w}) [Fact κ.IsRegular] + (hK : Cardinal.mk (Arrow K) < κ) + {J : Type w} [SmallCategory J] [IsCardinalFiltered J κ] + {X : J ⥤ C} (cX : Cocone X) (hcX : IsColimit cX) + (hF : ∀ (k : K), IsColimit ((F.obj k).mapCocone cX)) + +def isColimitMapCocone : IsColimit (c.pt.mapCocone cX) := by + have := isFiltered_of_isCardinalDirected J κ + have := hcX + have := hc + have := hF + have := hK + apply Types.FilteredColimit.isColimit_mk + · intro x + obtain ⟨y, hy⟩ := (Types.isLimitEquivSections (hc cX.pt)).symm.surjective x + have H := fun k ↦ Types.jointly_surjective_of_isColimit (hF k) (y.1 k) + let j (k : K) : J := (H k).choose + let z (k : K) : (F.obj k).obj (X.obj (j k)) := (H k).choose_spec.choose + have hz (k : K) : (F.obj k).map (cX.ι.app (j k)) (z k) = y.1 k := + (H k).choose_spec.choose_spec + have h : Cardinal.mk (Set.range j) < κ := + lt_of_le_of_lt Cardinal.mk_range_le (lt_of_le_of_lt (cardinal_le_cardinal_arrow K) hK) + let j₀ := IsCardinalFiltered.max (Set.range j) h + let α (k : K) : j k ⟶ j₀ := IsCardinalFiltered.toMax (Set.range j) h ⟨j k, k, rfl⟩ + have j₁ : J := sorry + have β : j₀ ⟶ j₁ := sorry + let s : (F ⋙ (evaluation C (Type w')).obj (X.obj j₁)).sections := + { val k := (F.obj k).map (X.map (α k ≫ β)) (z k) + property {k k'} φ := by + sorry } + refine ⟨j₁, (Types.isLimitEquivSections (hc (X.obj j₁))).symm s, ?_⟩ + apply (Types.isLimitEquivSections (hc cX.pt)).injective + rw [← hy, Equiv.apply_symm_apply] + ext k + have h₁ := Types.isLimitEquivSections_apply (hc cX.pt) k + (c.pt.map (cX.ι.app j₁) ((Types.isLimitEquivSections (hc (X.obj j₁))).symm s)) + have h₂ := Types.isLimitEquivSections_symm_apply (hc (X.obj j₁)) s k + dsimp at h₁ h₂ ⊢ + rw [h₁, ← hz k, FunctorToTypes.naturality, h₂, ← FunctorToTypes.map_comp_apply, cX.w] + · sorry + +end + +end Limits + +end Accessible + +lemma accessible_of_isLimit {K : Type w} [SmallCategory K] {F : K ⥤ C ⥤ Type w'} + (c : Cone F) (hc : IsLimit c) (κ : Cardinal.{w}) [Fact κ.IsRegular] + (hK : Cardinal.mk (Arrow K) < κ) + [HasLimitsOfSize.{w, w} (Type w')] + [∀ k, (F.obj k).IsAccessible κ] : + c.pt.IsAccessible κ where + preservesColimitOfShape {J _ _} := ⟨fun {X} ↦ ⟨fun {cX} hcX ↦ by + have := fun k ↦ preservesColimitsOfShape_of_isAccessible (F.obj k) κ J + exact ⟨Accessible.Limits.isColimitMapCocone c + (fun Y ↦ isLimitOfPreserves ((evaluation C (Type w')).obj Y) hc) κ hK cX hcX + (fun k ↦ isColimitOfPreserves (F.obj k) hcX)⟩⟩⟩ + + +end Functor + +lemma isPresentable_of_isColimit + {K : Type w} [SmallCategory K] {Y : K ⥤ C} + (c : Cocone Y) (hc : IsColimit c) (κ : Cardinal.{w}) [Fact κ.IsRegular] + (hK : Cardinal.mk (Arrow K) < κ) + [HasLimitsOfSize.{w, w} (Type v)] + [∀ k, IsPresentable (Y.obj k) κ] : + IsPresentable c.pt κ := by + have : ∀ (k : Kᵒᵖ), ((Y.op ⋙ coyoneda).obj k).IsAccessible κ := fun k ↦ by + dsimp + infer_instance + exact Functor.accessible_of_isLimit + (coyoneda.mapCone c.op) (isLimitOfPreserves _ hc.op) κ + (by simpa only [cardinal_arrow_op] using hK) + +end CategoryTheory From e71f7ab74cdc86fa82e0c373881bd147fe2828d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sat, 14 Dec 2024 11:22:47 +0100 Subject: [PATCH 013/309] better docstring --- Mathlib/CategoryTheory/Presentable/Limits.lean | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Mathlib/CategoryTheory/Presentable/Limits.lean b/Mathlib/CategoryTheory/Presentable/Limits.lean index 5206871435ef1b..072a826ab2a272 100644 --- a/Mathlib/CategoryTheory/Presentable/Limits.lean +++ b/Mathlib/CategoryTheory/Presentable/Limits.lean @@ -16,6 +16,8 @@ import Mathlib.CategoryTheory.Presentable.Basic In this file, we show that `κ`-accessible functors (to the category of types) are stable under limits indexed by a small category `K` such that `Cardinal.mk (Arrow K) < κ`. +In particular, `κ`-presentable objects are stable by colimits indexed +by a small category `K` such that `Cardinal.mk (Arrow K) < κ`. -/ From 5f62e66c300e114aabbc3c2a496c6ce521847dab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sat, 14 Dec 2024 11:28:52 +0100 Subject: [PATCH 014/309] added lemma --- Mathlib/CategoryTheory/Comma/CardinalArrow.lean | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Comma/CardinalArrow.lean b/Mathlib/CategoryTheory/Comma/CardinalArrow.lean index 758957caf658a9..4b18733ffb239c 100644 --- a/Mathlib/CategoryTheory/Comma/CardinalArrow.lean +++ b/Mathlib/CategoryTheory/Comma/CardinalArrow.lean @@ -16,7 +16,7 @@ If `A` is a (small) category, `Arrow A` is finite iff `FinCategory A` holds. -/ -universe u +universe v u namespace CategoryTheory @@ -25,6 +25,15 @@ lemma cardinal_arrow_discrete (S : Type u) : Cardinal.mk (Arrow (Discrete S)) = Cardinal.mk S := Cardinal.mk_congr (Arrow.discreteEquiv S) +@[simp] +lemma cardinal_arrow_op (A : Type u) [Category.{v} A] : + Cardinal.mk (Arrow Aᵒᵖ) = Cardinal.mk (Arrow A) := + Cardinal.mk_congr + { toFun f := Arrow.mk f.hom.unop + invFun g := Arrow.mk g.hom.op + left_inv _ := rfl + right_inv _ := rfl } + lemma Arrow.finite_iff (A : Type u) [SmallCategory A] : Finite (Arrow A) ↔ Nonempty (FinCategory A) := by constructor From 7d53761c33111a3422d2f9b65b45fb54314ad10d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sat, 14 Dec 2024 15:16:45 +0100 Subject: [PATCH 015/309] wip --- Mathlib.lean | 1 + .../CategoryTheory/Comma/CardinalArrow.lean | 110 +++++++++++++----- Mathlib/CategoryTheory/EssentiallySmall.lean | 30 ++++- Mathlib/CategoryTheory/Presentable/Basic.lean | 74 ++++++------ Mathlib/SetTheory/Cardinal/HasCardinalLT.lean | 78 +++++++++++++ 5 files changed, 227 insertions(+), 66 deletions(-) create mode 100644 Mathlib/SetTheory/Cardinal/HasCardinalLT.lean diff --git a/Mathlib.lean b/Mathlib.lean index 743033d3a013b5..f3aa73941362eb 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -4661,6 +4661,7 @@ import Mathlib.SetTheory.Cardinal.ENat import Mathlib.SetTheory.Cardinal.Finite import Mathlib.SetTheory.Cardinal.Finsupp import Mathlib.SetTheory.Cardinal.Free +import Mathlib.SetTheory.Cardinal.HasCardinalLT import Mathlib.SetTheory.Cardinal.SchroederBernstein import Mathlib.SetTheory.Cardinal.Subfield import Mathlib.SetTheory.Cardinal.ToNat diff --git a/Mathlib/CategoryTheory/Comma/CardinalArrow.lean b/Mathlib/CategoryTheory/Comma/CardinalArrow.lean index 4b18733ffb239c..ecd7fc1d8b5d7e 100644 --- a/Mathlib/CategoryTheory/Comma/CardinalArrow.lean +++ b/Mathlib/CategoryTheory/Comma/CardinalArrow.lean @@ -6,40 +6,28 @@ Authors: Joël Riou import Mathlib.CategoryTheory.Comma.Arrow import Mathlib.CategoryTheory.FinCategory.Basic +import Mathlib.CategoryTheory.EssentiallySmall import Mathlib.Data.Set.Finite.Basic -import Mathlib.SetTheory.Cardinal.Basic +import Mathlib.SetTheory.Cardinal.HasCardinalLT /-! # Cardinal of Arrow -If `A` is a (small) category, `Arrow A` is finite iff `FinCategory A` holds. +We obtain various results about the cardinality of `Arrow C`. For example, +If `A` is a (small) category, `Arrow C` is finite iff `FinCategory C` holds. -/ -universe v u +universe w w' v u namespace CategoryTheory -@[simp] -lemma cardinal_arrow_discrete (S : Type u) : - Cardinal.mk (Arrow (Discrete S)) = Cardinal.mk S := - Cardinal.mk_congr (Arrow.discreteEquiv S) - -@[simp] -lemma cardinal_arrow_op (A : Type u) [Category.{v} A] : - Cardinal.mk (Arrow Aᵒᵖ) = Cardinal.mk (Arrow A) := - Cardinal.mk_congr - { toFun f := Arrow.mk f.hom.unop - invFun g := Arrow.mk g.hom.op - left_inv _ := rfl - right_inv _ := rfl } - -lemma Arrow.finite_iff (A : Type u) [SmallCategory A] : - Finite (Arrow A) ↔ Nonempty (FinCategory A) := by +lemma Arrow.finite_iff (C : Type u) [SmallCategory C] : + Finite (Arrow C) ↔ Nonempty (FinCategory C) := by constructor · intro refine ⟨?_, fun a b ↦ ?_⟩ - · have := Finite.of_injective (fun (a : A) ↦ Arrow.mk (𝟙 a)) + · have := Finite.of_injective (fun (a : C) ↦ Arrow.mk (𝟙 a)) (fun _ _ ↦ congr_arg Comma.left) apply Fintype.ofFinite · have := Finite.of_injective (fun (f : a ⟶ b) ↦ Arrow.mk f) @@ -48,16 +36,86 @@ lemma Arrow.finite_iff (A : Type u) [SmallCategory A] : congr) apply Fintype.ofFinite · rintro ⟨_⟩ - have := Fintype.ofEquiv _ (Arrow.equivSigma A).symm + have := Fintype.ofEquiv _ (Arrow.equivSigma C).symm infer_instance -instance Arrow.finite {A : Type u} [SmallCategory A] [FinCategory A] : - Finite (Arrow A) := by +instance Arrow.finite {C : Type u} [SmallCategory C] [FinCategory C] : + Finite (Arrow C) := by rw [Arrow.finite_iff] exact ⟨inferInstance⟩ -lemma cardinal_le_cardinal_arrow (A : Type u) [SmallCategory A] : - Cardinal.mk A ≤ Cardinal.mk (Arrow A) := - Cardinal.mk_le_of_injective (f := fun a ↦ Arrow.mk (𝟙 a)) (fun _ _ ↦ congr_arg Comma.left) +/-- The bijection `Arrow Cᵒᵖ ≃ Arrow C`. -/ +def Arrow.opEquiv (C : Type u) [Category.{v} C] : Arrow Cᵒᵖ ≃ Arrow C where + toFun f := Arrow.mk f.hom.unop + invFun g := Arrow.mk g.hom.op + left_inv _ := rfl + right_inv _ := rfl + +@[simp] +lemma hasCardinal_arrow_op_iff (C : Type u) [Category.{v} C] (κ : Cardinal.{w}) : + HasCardinalLT (Arrow Cᵒᵖ) κ ↔ HasCardinalLT (Arrow C) κ := + hasCardinalLT_iff_of_equiv (Arrow.opEquiv C) κ + +@[simp] +lemma hasCardinalLT_arrow_discrete_iff {X : Type u} (κ : Cardinal.{w}) : + HasCardinalLT (Arrow (Discrete X)) κ ↔ HasCardinalLT X κ := + hasCardinalLT_iff_of_equiv (Arrow.discreteEquiv X) κ + +lemma small_of_small_arrow (C : Type u) [Category.{v} C] [Small.{w} (Arrow C)] : + Small.{w} C := + small_of_injective (f := fun X ↦ Arrow.mk (𝟙 X)) (fun _ _ h ↦ congr_arg Comma.left h) + +lemma locallySmall_of_small_arrow (C : Type u) [Category.{v} C] [Small.{w} (Arrow C)] : + LocallySmall.{w} C where + hom_small X Y := + small_of_injective (f := fun f ↦ Arrow.mk f) (fun f g h ↦ by + change (Arrow.mk f).hom = (Arrow.mk g).hom + congr) + +/-- The bijection `Arrow.{w} (ShrinkHoms C) ≃ Arrow C`. -/ +noncomputable def Arrow.shrinkHomsEquiv (C : Type u) [Category.{v} C] [LocallySmall.{w} C] : + Arrow.{w} (ShrinkHoms C) ≃ Arrow C where + toFun := (ShrinkHoms.equivalence C).inverse.mapArrow.obj + invFun := (ShrinkHoms.equivalence C).functor.mapArrow.obj + left_inv _ := by simp [Functor.mapArrow]; rfl + right_inv _ := by simp [Functor.mapArrow]; rfl + +-- to be moved +lemma Arrow.ext {C : Type u} [Category.{v} C] {f g : Arrow C} + (h₁ : f.left = g.left) (h₂ : f.right = g.right) + (h₃ : f.hom = eqToHom h₁ ≫ g.hom ≫ eqToHom h₂.symm) : f = g := by + obtain ⟨X, Y, f⟩ := f + obtain ⟨X', Y', g⟩ := g + obtain rfl : X = X' := h₁ + obtain rfl : Y = Y' := h₂ + obtain rfl : f = g := by simpa using h₃ + rfl + +/-- The bijection `Arrow (Shrink C) ≃ Arrow C`. -/ +noncomputable def Arrow.shrinkEquiv (C : Type u) [Category.{v} C] [Small.{w} C] : + Arrow (Shrink.{w} C) ≃ Arrow C where + toFun := (Shrink.equivalence C).inverse.mapArrow.obj + invFun := (Shrink.equivalence C).functor.mapArrow.obj + left_inv f := Arrow.ext (by simp [Shrink.equivalence]) + (by simp [Shrink.equivalence]) (by simp [Shrink.equivalence]; rfl) + right_inv _ := Arrow.ext (by simp [Shrink.equivalence]) + (by simp [Shrink.equivalence]) (by simp [Shrink.equivalence]) + +@[simp] +lemma hasCardinalLT_arrow_shrinkHoms_iff (C : Type u) [Category.{v} C] [LocallySmall.{w'} C] + (κ : Cardinal.{w}) : + HasCardinalLT (Arrow.{w'} (ShrinkHoms C)) κ ↔ HasCardinalLT (Arrow C) κ := + hasCardinalLT_iff_of_equiv (Arrow.shrinkHomsEquiv C) κ + +@[simp] +lemma hasCardinalLT_arrow_shrink_iff (C : Type u) [Category.{v} C] [Small.{w'} C] + (κ : Cardinal.{w}) : + HasCardinalLT (Arrow (Shrink.{w'} C)) κ ↔ HasCardinalLT (Arrow C) κ := + hasCardinalLT_iff_of_equiv (Arrow.shrinkEquiv C) κ + +lemma hasCardinalLT_of_hasCardinalLT_arrow + {C : Type u} [Category.{v} C] {κ : Cardinal.{w}} (h : HasCardinalLT (Arrow C) κ) : + HasCardinalLT C κ := + h.of_injective (fun X ↦ Arrow.mk (𝟙 X)) (fun _ _ h ↦ congr_arg Comma.left h) end CategoryTheory diff --git a/Mathlib/CategoryTheory/EssentiallySmall.lean b/Mathlib/CategoryTheory/EssentiallySmall.lean index 70c065ab24e7b5..1e0ef52122580f 100644 --- a/Mathlib/CategoryTheory/EssentiallySmall.lean +++ b/Mathlib/CategoryTheory/EssentiallySmall.lean @@ -22,7 +22,7 @@ the type `Skeleton C` is `w`-small, and `C` is `w`-locally small. -/ -universe w v v' u u' +universe w w' v v' u u' open CategoryTheory @@ -182,8 +182,32 @@ noncomputable instance [Small.{w} C] : Category.{v} (Shrink.{w} C) := InducedCategory.category (equivShrink C).symm /-- The categorical equivalence between `C` and `Shrink C`, when `C` is small. -/ -noncomputable def equivalence [Small.{w} C] : C ≌ Shrink.{w} C := - (inducedFunctor (equivShrink C).symm).asEquivalence.symm +noncomputable def equivalence [Small.{w} C] : C ≌ Shrink.{w} C where + functor := + { obj := equivShrink C + map {X Y} f := by + change (equivShrink C).symm _ ⟶ (equivShrink C).symm _ + exact eqToHom (by simp) ≫ f ≫ eqToHom (by simp) + map_comp f g := by + dsimp + erw [Category.assoc, Category.assoc, Category.assoc] + rw [eqToHom_trans_assoc, eqToHom_refl, Category.id_comp] } + inverse := inducedFunctor (equivShrink C).symm + unitIso := NatIso.ofComponents (fun X ↦ eqToIso (by simp)) + counitIso := NatIso.ofComponents (fun X ↦ eqToIso (by simp)) (fun {X Y} f ↦ by + dsimp + erw [Category.assoc, Category.assoc, eqToHom_trans, eqToHom_refl, Category.comp_id] + · rfl + · simp) + functor_unitIso_comp X := by + dsimp + simp only [eqToHom_trans] + exact eqToHom_trans (by simp) _ + +instance (C : Type u) [Category.{v} C] [Small.{w'} C] [LocallySmall.{w} C] : + LocallySmall.{w} (Shrink.{w'} C) where + hom_small _ _ := small_of_injective + (fun _ _ h ↦ (Shrink.equivalence.{w'} C).inverse.map_injective h) end Shrink diff --git a/Mathlib/CategoryTheory/Presentable/Basic.lean b/Mathlib/CategoryTheory/Presentable/Basic.lean index 78f1dd09e97b9e..8c8b998b07ee71 100644 --- a/Mathlib/CategoryTheory/Presentable/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/Basic.lean @@ -8,6 +8,7 @@ import Mathlib.CategoryTheory.Filtered.Basic import Mathlib.CategoryTheory.Limits.Preserves.Basic import Mathlib.CategoryTheory.Comma.CardinalArrow import Mathlib.SetTheory.Cardinal.Cofinality +import Mathlib.SetTheory.Cardinal.HasCardinalLT /-! # Presentable objects @@ -27,7 +28,7 @@ if the functor `Hom(X, _)` (i.e. `coyoneda.obj (op X)`) is `κ`-accessible. -/ -universe w w' v' v u' u +universe w w' v'' v' v u'' u' u namespace CategoryTheory @@ -38,60 +39,65 @@ section /-- A category `J` is `κ`-filtered (for a regular cardinal `κ`) is any functor `F : A ⥤ J` from a `κ`-small category (`Cardinal.mk (Arrow A) < κ`) admits a cocone. -/ -class IsCardinalFiltered (J : Type w) [SmallCategory J] +class IsCardinalFiltered (J : Type u') [Category.{v'} J] (κ : Cardinal.{w}) [Fact κ.IsRegular] : Prop where nonempty_cocone {A : Type w} [SmallCategory A] (F : A ⥤ J) - (hA : Cardinal.mk (Arrow A) < κ) : Nonempty (Cocone F) + (hA : HasCardinalLT (Arrow A) κ) : Nonempty (Cocone F) namespace IsCardinalFiltered -variable {J : Type w} [SmallCategory J] {κ : Cardinal.{w}} [hκ : Fact κ.IsRegular] +variable {J : Type u'} [Category.{v'} J] {κ : Cardinal.{w}} [hκ : Fact κ.IsRegular] [IsCardinalFiltered J κ] /-- A choice of cocone for a functor `F : A ⥤ J` such that `Cardinal.mk (Arrow A) < κ` when `J` is a `κ`-filtered category. -/ -noncomputable def cocone {A : Type w} [SmallCategory A] - (F : A ⥤ J) (hA : Cardinal.mk (Arrow A) < κ) : - Cocone F := - (nonempty_cocone (κ := κ) _ hA).some - -/-- When `S : Set J` is of cardinality `< κ` and `J` is `κ`-filtered, this is -a choice of object in `J` which is the target of a map from any object in `S`. -/ -noncomputable def max (S : Set J) (hS : Cardinal.mk S < κ) : J := by - have : Cardinal.mk (Arrow (Discrete S)) < κ := by simpa using hS - exact (cocone (Discrete.functor Subtype.val) this).pt +noncomputable def cocone {A : Type v''} [Category.{u''} A] + (F : A ⥤ J) (hA : HasCardinalLT (Arrow A) κ) : + Cocone F := by + have := hA.small + have := small_of_small_arrow.{w} A + have := locallySmall_of_small_arrow.{w} A + let e := (Shrink.equivalence.{w} A).trans (ShrinkHoms.equivalence.{w} (Shrink.{w} A)) + exact (Cocones.equivalenceOfReindexing e.symm (Iso.refl _)).inverse.obj + (nonempty_cocone (κ := κ) (e.inverse ⋙ F) (by simpa)).some + +--/-- When `S : Set J` is of cardinality `< κ` and `J` is `κ`-filtered, this is +--a choice of object in `J` which is the target of a map from any object in `S`. -/ +noncomputable def max {K : Type v''} (S : K → J) (hS : HasCardinalLT K κ) : J := by + have : HasCardinalLT (Arrow (Discrete K)) κ := by simpa using hS + exact (cocone (Discrete.functor S) this).pt /-- When `S : Set J` is of cardinality `< κ` and `J` is `κ`-filtered, this is a choice of map `s.1 ⟶ max S hS` for any `s : S`. -/ -noncomputable def toMax (S : Set J) (hS : Cardinal.mk S < κ) (s : S) : - s.1 ⟶ max S hS := by - have : Cardinal.mk (Arrow (Discrete S)) < κ := by simpa using hS - exact (cocone (Discrete.functor Subtype.val) this).ι.app ⟨s⟩ +noncomputable def toMax {K : Type v''} (S : K → J) (hS : HasCardinalLT K κ) (k : K) : + S k ⟶ max S hS := by + have : HasCardinalLT (Arrow (Discrete K)) κ := by simpa using hS + exact (cocone (Discrete.functor S) this).ι.app ⟨k⟩ variable (J) lemma of_le {κ' : Cardinal.{w}} [Fact κ'.IsRegular] (h : κ' ≤ κ) : IsCardinalFiltered J κ' where - nonempty_cocone F hA := ⟨cocone F (lt_of_lt_of_le hA h)⟩ + nonempty_cocone F hA := ⟨cocone F (hA.of_le h)⟩ end IsCardinalFiltered open IsCardinalFiltered in -lemma isFiltered_of_isCardinalDirected (J : Type w) [SmallCategory J] +lemma isFiltered_of_isCardinalDirected (J : Type u') [Category.{v'} J] (κ : Cardinal.{w}) [hκ : Fact κ.IsRegular] [IsCardinalFiltered J κ]: IsFiltered J := by rw [IsFiltered.iff_cocone_nonempty.{w}] intro A _ _ F - have hA : Cardinal.mk (Arrow A) < κ := by - refine lt_of_lt_of_le ?_ hκ.out.aleph0_le - rw [Cardinal.mk_lt_aleph0_iff] + have hA : HasCardinalLT (Arrow A) κ := by + refine HasCardinalLT.of_le ?_ hκ.out.aleph0_le + simp only [hasCardinalLT_aleph0] infer_instance exact ⟨cocone F hA⟩ instance : Fact Cardinal.aleph0.IsRegular where out := Cardinal.isRegular_aleph0 -lemma isCardinalFiltered_aleph0_iff (J : Type w) [SmallCategory J] : +lemma isCardinalFiltered_aleph0_iff (J : Type u') [Category.{v'} J] : IsCardinalFiltered J Cardinal.aleph0 ↔ IsFiltered J := by constructor · intro @@ -99,26 +105,20 @@ lemma isCardinalFiltered_aleph0_iff (J : Type w) [SmallCategory J] : · intro constructor intro A _ F hA - rw [Cardinal.mk_lt_aleph0_iff] at hA + rw [hasCardinalLT_aleph0] at hA have := ((Arrow.finite_iff A).1 hA).some exact ⟨IsFiltered.cocone F⟩ lemma isCardinalFiltered_preorder (J : Type w) [Preorder J] (κ : Cardinal.{w}) [Fact κ.IsRegular] - (h : ∀ (S : Set J) (_ : Cardinal.mk S < κ), ∃ (j : J), ∀ (s : S), s.1 ≤ j) : + (h : ∀ ⦃K : Type w⦄ (s : K → J) (_ : Cardinal.mk K < κ), + ∃ (j : J), ∀ (k : K), s k ≤ j) : IsCardinalFiltered J κ where nonempty_cocone {A _ F hA} := by - let S := Set.range F.obj - have hS : Cardinal.mk S < κ := by - let f : A → S := fun a ↦ ⟨F.obj a, ⟨a, rfl⟩⟩ - have hf : Function.Surjective f := by - rintro ⟨_, ⟨a, rfl⟩⟩ - exact ⟨a, rfl⟩ - exact lt_of_le_of_lt (Cardinal.mk_le_of_surjective hf) - (lt_of_le_of_lt (cardinal_le_cardinal_arrow A) hA) - obtain ⟨j, hj⟩ := h S hS - refine ⟨Cocone.mk j - { app a := homOfLE (hj ⟨F.obj a, ⟨a, rfl⟩⟩) + obtain ⟨j, hj⟩ := h F.obj (by simpa only [hasCardinalLT_iff_cardinal_mk_lt] using + hasCardinalLT_of_hasCardinalLT_arrow hA) + exact ⟨Cocone.mk j + { app a := homOfLE (hj a) naturality _ _ _ := rfl }⟩ end diff --git a/Mathlib/SetTheory/Cardinal/HasCardinalLT.lean b/Mathlib/SetTheory/Cardinal/HasCardinalLT.lean new file mode 100644 index 00000000000000..6dbfec5d67a050 --- /dev/null +++ b/Mathlib/SetTheory/Cardinal/HasCardinalLT.lean @@ -0,0 +1,78 @@ +/- +Copyright (c) 2024 Joël Riou. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Joël Riou +-/ +import Mathlib.SetTheory.Cardinal.Basic + +/-! +# The property of being of cardinality less than a cardinal + +Given `X : Type u` and `κ : Cardinal.{v}`, we introduce a predicate +`HasCardinalLT X κ` expressing that +`Cardinal.mk (ULift.{v} X) < Cardinal.lift κ`. + +-/ + +universe w v u u' + +/-- The property that the cardinal of a type `X : Type u` is less than `κ : Cardinal.{v}`. -/ +def HasCardinalLT (X : Type u) (κ : Cardinal.{v}) : Prop := + Cardinal.mk (ULift.{v} X) < Cardinal.lift κ + +lemma hasCardinalLT_iff_cardinal_mk_lt (X : Type u) (κ : Cardinal.{u}) : + HasCardinalLT X κ ↔ Cardinal.mk X < κ := by + simp [HasCardinalLT] + +namespace HasCardinalLT + +section + +variable {X : Type u} {κ : Cardinal.{v}} (h : HasCardinalLT X κ) + +include h + +lemma small : Small.{v} X := by + induction' κ using Cardinal.inductionOn with Y + replace h := (Cardinal.le_def _ _).1 h.le + obtain ⟨f, hf⟩ := h + exact small_of_injective (Function.Injective.comp ULift.down_injective + (Function.Injective.comp hf ULift.up_injective)) + +lemma of_le {κ' : Cardinal.{v}} (hκ' : κ ≤ κ') : + HasCardinalLT X κ' := + lt_of_lt_of_le h (by simpa only [Cardinal.lift_le] using hκ') + +variable {Y : Type u'} + +lemma of_injective (f : Y → X) (hf : Function.Injective f) : + HasCardinalLT Y κ := by + dsimp [HasCardinalLT] at h ⊢ + rw [← Cardinal.lift_lt.{_, u}, Cardinal.lift_lift, Cardinal.lift_lift] + rw [← Cardinal.lift_lt.{_, u'}, Cardinal.lift_lift, Cardinal.lift_lift] at h + exact lt_of_le_of_lt (Cardinal.mk_le_of_injective + (Function.Injective.comp ULift.up_injective + (Function.Injective.comp hf ULift.down_injective))) h + +lemma of_surjective (f : X → Y) (hf : Function.Surjective f) : + HasCardinalLT Y κ := by + dsimp [HasCardinalLT] at h ⊢ + rw [← Cardinal.lift_lt.{_, u}, Cardinal.lift_lift, Cardinal.lift_lift] + rw [← Cardinal.lift_lt.{_, u'}, Cardinal.lift_lift, Cardinal.lift_lift] at h + exact lt_of_le_of_lt (Cardinal.mk_le_of_surjective + (Function.Surjective.comp ULift.up_surjective (Function.Surjective.comp hf + ULift.down_surjective))) h + +end + +end HasCardinalLT + +lemma hasCardinalLT_iff_of_equiv {X : Type u} {Y : Type u'} (e : X ≃ Y) (κ : Cardinal.{v}) : + HasCardinalLT X κ ↔ HasCardinalLT Y κ := + ⟨fun h ↦ h.of_injective _ e.symm.injective, + fun h ↦ h.of_injective _ e.injective⟩ + +@[simp] +lemma hasCardinalLT_aleph0 (X : Type u) : + HasCardinalLT X Cardinal.aleph0.{v} ↔ Finite X := by + simpa [HasCardinalLT] using Cardinal.mk_lt_aleph0_iff From c4c11d56dedb1b91aaf46c49186dd9e41a9ae39a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sat, 14 Dec 2024 15:19:24 +0100 Subject: [PATCH 016/309] wip --- Mathlib.lean | 1 + Mathlib/SetTheory/Cardinal/HasCardinalLT.lean | 78 +++++++++++++++++++ 2 files changed, 79 insertions(+) create mode 100644 Mathlib/SetTheory/Cardinal/HasCardinalLT.lean diff --git a/Mathlib.lean b/Mathlib.lean index f26acaca225ace..91795950702003 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -4660,6 +4660,7 @@ import Mathlib.SetTheory.Cardinal.ENat import Mathlib.SetTheory.Cardinal.Finite import Mathlib.SetTheory.Cardinal.Finsupp import Mathlib.SetTheory.Cardinal.Free +import Mathlib.SetTheory.Cardinal.HasCardinalLT import Mathlib.SetTheory.Cardinal.SchroederBernstein import Mathlib.SetTheory.Cardinal.Subfield import Mathlib.SetTheory.Cardinal.ToNat diff --git a/Mathlib/SetTheory/Cardinal/HasCardinalLT.lean b/Mathlib/SetTheory/Cardinal/HasCardinalLT.lean new file mode 100644 index 00000000000000..6dbfec5d67a050 --- /dev/null +++ b/Mathlib/SetTheory/Cardinal/HasCardinalLT.lean @@ -0,0 +1,78 @@ +/- +Copyright (c) 2024 Joël Riou. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Joël Riou +-/ +import Mathlib.SetTheory.Cardinal.Basic + +/-! +# The property of being of cardinality less than a cardinal + +Given `X : Type u` and `κ : Cardinal.{v}`, we introduce a predicate +`HasCardinalLT X κ` expressing that +`Cardinal.mk (ULift.{v} X) < Cardinal.lift κ`. + +-/ + +universe w v u u' + +/-- The property that the cardinal of a type `X : Type u` is less than `κ : Cardinal.{v}`. -/ +def HasCardinalLT (X : Type u) (κ : Cardinal.{v}) : Prop := + Cardinal.mk (ULift.{v} X) < Cardinal.lift κ + +lemma hasCardinalLT_iff_cardinal_mk_lt (X : Type u) (κ : Cardinal.{u}) : + HasCardinalLT X κ ↔ Cardinal.mk X < κ := by + simp [HasCardinalLT] + +namespace HasCardinalLT + +section + +variable {X : Type u} {κ : Cardinal.{v}} (h : HasCardinalLT X κ) + +include h + +lemma small : Small.{v} X := by + induction' κ using Cardinal.inductionOn with Y + replace h := (Cardinal.le_def _ _).1 h.le + obtain ⟨f, hf⟩ := h + exact small_of_injective (Function.Injective.comp ULift.down_injective + (Function.Injective.comp hf ULift.up_injective)) + +lemma of_le {κ' : Cardinal.{v}} (hκ' : κ ≤ κ') : + HasCardinalLT X κ' := + lt_of_lt_of_le h (by simpa only [Cardinal.lift_le] using hκ') + +variable {Y : Type u'} + +lemma of_injective (f : Y → X) (hf : Function.Injective f) : + HasCardinalLT Y κ := by + dsimp [HasCardinalLT] at h ⊢ + rw [← Cardinal.lift_lt.{_, u}, Cardinal.lift_lift, Cardinal.lift_lift] + rw [← Cardinal.lift_lt.{_, u'}, Cardinal.lift_lift, Cardinal.lift_lift] at h + exact lt_of_le_of_lt (Cardinal.mk_le_of_injective + (Function.Injective.comp ULift.up_injective + (Function.Injective.comp hf ULift.down_injective))) h + +lemma of_surjective (f : X → Y) (hf : Function.Surjective f) : + HasCardinalLT Y κ := by + dsimp [HasCardinalLT] at h ⊢ + rw [← Cardinal.lift_lt.{_, u}, Cardinal.lift_lift, Cardinal.lift_lift] + rw [← Cardinal.lift_lt.{_, u'}, Cardinal.lift_lift, Cardinal.lift_lift] at h + exact lt_of_le_of_lt (Cardinal.mk_le_of_surjective + (Function.Surjective.comp ULift.up_surjective (Function.Surjective.comp hf + ULift.down_surjective))) h + +end + +end HasCardinalLT + +lemma hasCardinalLT_iff_of_equiv {X : Type u} {Y : Type u'} (e : X ≃ Y) (κ : Cardinal.{v}) : + HasCardinalLT X κ ↔ HasCardinalLT Y κ := + ⟨fun h ↦ h.of_injective _ e.symm.injective, + fun h ↦ h.of_injective _ e.injective⟩ + +@[simp] +lemma hasCardinalLT_aleph0 (X : Type u) : + HasCardinalLT X Cardinal.aleph0.{v} ↔ Finite X := by + simpa [HasCardinalLT] using Cardinal.mk_lt_aleph0_iff From 79630b30d705cdb20b8a2cbd905448fc3cccbbf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sat, 14 Dec 2024 15:25:34 +0100 Subject: [PATCH 017/309] wip --- .../CategoryTheory/Comma/CardinalArrow.lean | 110 +++++++++++++----- Mathlib/CategoryTheory/EssentiallySmall.lean | 30 ++++- 2 files changed, 111 insertions(+), 29 deletions(-) diff --git a/Mathlib/CategoryTheory/Comma/CardinalArrow.lean b/Mathlib/CategoryTheory/Comma/CardinalArrow.lean index 4b18733ffb239c..ecd7fc1d8b5d7e 100644 --- a/Mathlib/CategoryTheory/Comma/CardinalArrow.lean +++ b/Mathlib/CategoryTheory/Comma/CardinalArrow.lean @@ -6,40 +6,28 @@ Authors: Joël Riou import Mathlib.CategoryTheory.Comma.Arrow import Mathlib.CategoryTheory.FinCategory.Basic +import Mathlib.CategoryTheory.EssentiallySmall import Mathlib.Data.Set.Finite.Basic -import Mathlib.SetTheory.Cardinal.Basic +import Mathlib.SetTheory.Cardinal.HasCardinalLT /-! # Cardinal of Arrow -If `A` is a (small) category, `Arrow A` is finite iff `FinCategory A` holds. +We obtain various results about the cardinality of `Arrow C`. For example, +If `A` is a (small) category, `Arrow C` is finite iff `FinCategory C` holds. -/ -universe v u +universe w w' v u namespace CategoryTheory -@[simp] -lemma cardinal_arrow_discrete (S : Type u) : - Cardinal.mk (Arrow (Discrete S)) = Cardinal.mk S := - Cardinal.mk_congr (Arrow.discreteEquiv S) - -@[simp] -lemma cardinal_arrow_op (A : Type u) [Category.{v} A] : - Cardinal.mk (Arrow Aᵒᵖ) = Cardinal.mk (Arrow A) := - Cardinal.mk_congr - { toFun f := Arrow.mk f.hom.unop - invFun g := Arrow.mk g.hom.op - left_inv _ := rfl - right_inv _ := rfl } - -lemma Arrow.finite_iff (A : Type u) [SmallCategory A] : - Finite (Arrow A) ↔ Nonempty (FinCategory A) := by +lemma Arrow.finite_iff (C : Type u) [SmallCategory C] : + Finite (Arrow C) ↔ Nonempty (FinCategory C) := by constructor · intro refine ⟨?_, fun a b ↦ ?_⟩ - · have := Finite.of_injective (fun (a : A) ↦ Arrow.mk (𝟙 a)) + · have := Finite.of_injective (fun (a : C) ↦ Arrow.mk (𝟙 a)) (fun _ _ ↦ congr_arg Comma.left) apply Fintype.ofFinite · have := Finite.of_injective (fun (f : a ⟶ b) ↦ Arrow.mk f) @@ -48,16 +36,86 @@ lemma Arrow.finite_iff (A : Type u) [SmallCategory A] : congr) apply Fintype.ofFinite · rintro ⟨_⟩ - have := Fintype.ofEquiv _ (Arrow.equivSigma A).symm + have := Fintype.ofEquiv _ (Arrow.equivSigma C).symm infer_instance -instance Arrow.finite {A : Type u} [SmallCategory A] [FinCategory A] : - Finite (Arrow A) := by +instance Arrow.finite {C : Type u} [SmallCategory C] [FinCategory C] : + Finite (Arrow C) := by rw [Arrow.finite_iff] exact ⟨inferInstance⟩ -lemma cardinal_le_cardinal_arrow (A : Type u) [SmallCategory A] : - Cardinal.mk A ≤ Cardinal.mk (Arrow A) := - Cardinal.mk_le_of_injective (f := fun a ↦ Arrow.mk (𝟙 a)) (fun _ _ ↦ congr_arg Comma.left) +/-- The bijection `Arrow Cᵒᵖ ≃ Arrow C`. -/ +def Arrow.opEquiv (C : Type u) [Category.{v} C] : Arrow Cᵒᵖ ≃ Arrow C where + toFun f := Arrow.mk f.hom.unop + invFun g := Arrow.mk g.hom.op + left_inv _ := rfl + right_inv _ := rfl + +@[simp] +lemma hasCardinal_arrow_op_iff (C : Type u) [Category.{v} C] (κ : Cardinal.{w}) : + HasCardinalLT (Arrow Cᵒᵖ) κ ↔ HasCardinalLT (Arrow C) κ := + hasCardinalLT_iff_of_equiv (Arrow.opEquiv C) κ + +@[simp] +lemma hasCardinalLT_arrow_discrete_iff {X : Type u} (κ : Cardinal.{w}) : + HasCardinalLT (Arrow (Discrete X)) κ ↔ HasCardinalLT X κ := + hasCardinalLT_iff_of_equiv (Arrow.discreteEquiv X) κ + +lemma small_of_small_arrow (C : Type u) [Category.{v} C] [Small.{w} (Arrow C)] : + Small.{w} C := + small_of_injective (f := fun X ↦ Arrow.mk (𝟙 X)) (fun _ _ h ↦ congr_arg Comma.left h) + +lemma locallySmall_of_small_arrow (C : Type u) [Category.{v} C] [Small.{w} (Arrow C)] : + LocallySmall.{w} C where + hom_small X Y := + small_of_injective (f := fun f ↦ Arrow.mk f) (fun f g h ↦ by + change (Arrow.mk f).hom = (Arrow.mk g).hom + congr) + +/-- The bijection `Arrow.{w} (ShrinkHoms C) ≃ Arrow C`. -/ +noncomputable def Arrow.shrinkHomsEquiv (C : Type u) [Category.{v} C] [LocallySmall.{w} C] : + Arrow.{w} (ShrinkHoms C) ≃ Arrow C where + toFun := (ShrinkHoms.equivalence C).inverse.mapArrow.obj + invFun := (ShrinkHoms.equivalence C).functor.mapArrow.obj + left_inv _ := by simp [Functor.mapArrow]; rfl + right_inv _ := by simp [Functor.mapArrow]; rfl + +-- to be moved +lemma Arrow.ext {C : Type u} [Category.{v} C] {f g : Arrow C} + (h₁ : f.left = g.left) (h₂ : f.right = g.right) + (h₃ : f.hom = eqToHom h₁ ≫ g.hom ≫ eqToHom h₂.symm) : f = g := by + obtain ⟨X, Y, f⟩ := f + obtain ⟨X', Y', g⟩ := g + obtain rfl : X = X' := h₁ + obtain rfl : Y = Y' := h₂ + obtain rfl : f = g := by simpa using h₃ + rfl + +/-- The bijection `Arrow (Shrink C) ≃ Arrow C`. -/ +noncomputable def Arrow.shrinkEquiv (C : Type u) [Category.{v} C] [Small.{w} C] : + Arrow (Shrink.{w} C) ≃ Arrow C where + toFun := (Shrink.equivalence C).inverse.mapArrow.obj + invFun := (Shrink.equivalence C).functor.mapArrow.obj + left_inv f := Arrow.ext (by simp [Shrink.equivalence]) + (by simp [Shrink.equivalence]) (by simp [Shrink.equivalence]; rfl) + right_inv _ := Arrow.ext (by simp [Shrink.equivalence]) + (by simp [Shrink.equivalence]) (by simp [Shrink.equivalence]) + +@[simp] +lemma hasCardinalLT_arrow_shrinkHoms_iff (C : Type u) [Category.{v} C] [LocallySmall.{w'} C] + (κ : Cardinal.{w}) : + HasCardinalLT (Arrow.{w'} (ShrinkHoms C)) κ ↔ HasCardinalLT (Arrow C) κ := + hasCardinalLT_iff_of_equiv (Arrow.shrinkHomsEquiv C) κ + +@[simp] +lemma hasCardinalLT_arrow_shrink_iff (C : Type u) [Category.{v} C] [Small.{w'} C] + (κ : Cardinal.{w}) : + HasCardinalLT (Arrow (Shrink.{w'} C)) κ ↔ HasCardinalLT (Arrow C) κ := + hasCardinalLT_iff_of_equiv (Arrow.shrinkEquiv C) κ + +lemma hasCardinalLT_of_hasCardinalLT_arrow + {C : Type u} [Category.{v} C] {κ : Cardinal.{w}} (h : HasCardinalLT (Arrow C) κ) : + HasCardinalLT C κ := + h.of_injective (fun X ↦ Arrow.mk (𝟙 X)) (fun _ _ h ↦ congr_arg Comma.left h) end CategoryTheory diff --git a/Mathlib/CategoryTheory/EssentiallySmall.lean b/Mathlib/CategoryTheory/EssentiallySmall.lean index 70c065ab24e7b5..1e0ef52122580f 100644 --- a/Mathlib/CategoryTheory/EssentiallySmall.lean +++ b/Mathlib/CategoryTheory/EssentiallySmall.lean @@ -22,7 +22,7 @@ the type `Skeleton C` is `w`-small, and `C` is `w`-locally small. -/ -universe w v v' u u' +universe w w' v v' u u' open CategoryTheory @@ -182,8 +182,32 @@ noncomputable instance [Small.{w} C] : Category.{v} (Shrink.{w} C) := InducedCategory.category (equivShrink C).symm /-- The categorical equivalence between `C` and `Shrink C`, when `C` is small. -/ -noncomputable def equivalence [Small.{w} C] : C ≌ Shrink.{w} C := - (inducedFunctor (equivShrink C).symm).asEquivalence.symm +noncomputable def equivalence [Small.{w} C] : C ≌ Shrink.{w} C where + functor := + { obj := equivShrink C + map {X Y} f := by + change (equivShrink C).symm _ ⟶ (equivShrink C).symm _ + exact eqToHom (by simp) ≫ f ≫ eqToHom (by simp) + map_comp f g := by + dsimp + erw [Category.assoc, Category.assoc, Category.assoc] + rw [eqToHom_trans_assoc, eqToHom_refl, Category.id_comp] } + inverse := inducedFunctor (equivShrink C).symm + unitIso := NatIso.ofComponents (fun X ↦ eqToIso (by simp)) + counitIso := NatIso.ofComponents (fun X ↦ eqToIso (by simp)) (fun {X Y} f ↦ by + dsimp + erw [Category.assoc, Category.assoc, eqToHom_trans, eqToHom_refl, Category.comp_id] + · rfl + · simp) + functor_unitIso_comp X := by + dsimp + simp only [eqToHom_trans] + exact eqToHom_trans (by simp) _ + +instance (C : Type u) [Category.{v} C] [Small.{w'} C] [LocallySmall.{w} C] : + LocallySmall.{w} (Shrink.{w'} C) where + hom_small _ _ := small_of_injective + (fun _ _ h ↦ (Shrink.equivalence.{w'} C).inverse.map_injective h) end Shrink From 872779e2d73a308f9e6e0d05d74cc8624c190e7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sat, 14 Dec 2024 15:38:01 +0100 Subject: [PATCH 018/309] wip --- .../CategoryTheory/Presentable/Limits.lean | 38 +++++++++---------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/Limits.lean b/Mathlib/CategoryTheory/Presentable/Limits.lean index 072a826ab2a272..597d0dc0950a27 100644 --- a/Mathlib/CategoryTheory/Presentable/Limits.lean +++ b/Mathlib/CategoryTheory/Presentable/Limits.lean @@ -14,14 +14,14 @@ import Mathlib.CategoryTheory.Presentable.Basic # Colimits of presentable objects In this file, we show that `κ`-accessible functors (to the category of types) -are stable under limits indexed by a small category `K` such that -`Cardinal.mk (Arrow K) < κ`. +are stable under limits indexed by a category `K` such that +`HasCardinalLT (Arrow K) κ`. In particular, `κ`-presentable objects are stable by colimits indexed -by a small category `K` such that `Cardinal.mk (Arrow K) < κ`. +by a category `K` such that `HasCardinalLT (Arrow K) κ`. -/ -universe w w' v u +universe w w' v' v u' u namespace CategoryTheory @@ -59,10 +59,10 @@ namespace Limits section -variable {K : Type w} [SmallCategory K] {F : K ⥤ C ⥤ Type w'} +variable {K : Type u'} [Category.{v'} K] {F : K ⥤ C ⥤ Type w'} (c : Cone F) (hc : ∀ (Y : C), IsLimit (((evaluation _ _).obj Y).mapCone c)) (κ : Cardinal.{w}) [Fact κ.IsRegular] - (hK : Cardinal.mk (Arrow K) < κ) + (hK : HasCardinalLT (Arrow K) κ) {J : Type w} [SmallCategory J] [IsCardinalFiltered J κ] {X : J ⥤ C} (cX : Cocone X) (hcX : IsColimit cX) (hF : ∀ (k : K), IsColimit ((F.obj k).mapCocone cX)) @@ -70,9 +70,6 @@ variable {K : Type w} [SmallCategory K] {F : K ⥤ C ⥤ Type w'} def isColimitMapCocone : IsColimit (c.pt.mapCocone cX) := by have := isFiltered_of_isCardinalDirected J κ have := hcX - have := hc - have := hF - have := hK apply Types.FilteredColimit.isColimit_mk · intro x obtain ⟨y, hy⟩ := (Types.isLimitEquivSections (hc cX.pt)).symm.surjective x @@ -81,10 +78,10 @@ def isColimitMapCocone : IsColimit (c.pt.mapCocone cX) := by let z (k : K) : (F.obj k).obj (X.obj (j k)) := (H k).choose_spec.choose have hz (k : K) : (F.obj k).map (cX.ι.app (j k)) (z k) = y.1 k := (H k).choose_spec.choose_spec - have h : Cardinal.mk (Set.range j) < κ := - lt_of_le_of_lt Cardinal.mk_range_le (lt_of_le_of_lt (cardinal_le_cardinal_arrow K) hK) - let j₀ := IsCardinalFiltered.max (Set.range j) h - let α (k : K) : j k ⟶ j₀ := IsCardinalFiltered.toMax (Set.range j) h ⟨j k, k, rfl⟩ + have hK' := hasCardinalLT_of_hasCardinalLT_arrow hK + have pif := IsCardinalFiltered.max j hK' + let j₀ : J := IsCardinalFiltered.max j hK' + let α (k : K) : j k ⟶ j₀ := IsCardinalFiltered.toMax j hK' k have j₁ : J := sorry have β : j₀ ⟶ j₁ := sorry let s : (F ⋙ (evaluation C (Type w')).obj (X.obj j₁)).sections := @@ -108,10 +105,10 @@ end Limits end Accessible -lemma accessible_of_isLimit {K : Type w} [SmallCategory K] {F : K ⥤ C ⥤ Type w'} +lemma accessible_of_isLimit {K : Type u'} [Category.{v'} K] {F : K ⥤ C ⥤ Type w'} (c : Cone F) (hc : IsLimit c) (κ : Cardinal.{w}) [Fact κ.IsRegular] - (hK : Cardinal.mk (Arrow K) < κ) - [HasLimitsOfSize.{w, w} (Type w')] + (hK : HasCardinalLT (Arrow K) κ) + [HasLimitsOfShape K (Type w')] [∀ k, (F.obj k).IsAccessible κ] : c.pt.IsAccessible κ where preservesColimitOfShape {J _ _} := ⟨fun {X} ↦ ⟨fun {cX} hcX ↦ by @@ -124,17 +121,16 @@ lemma accessible_of_isLimit {K : Type w} [SmallCategory K] {F : K ⥤ C ⥤ Type end Functor lemma isPresentable_of_isColimit - {K : Type w} [SmallCategory K] {Y : K ⥤ C} + {K : Type u'} [Category.{v'} K] {Y : K ⥤ C} (c : Cocone Y) (hc : IsColimit c) (κ : Cardinal.{w}) [Fact κ.IsRegular] - (hK : Cardinal.mk (Arrow K) < κ) - [HasLimitsOfSize.{w, w} (Type v)] + (hK : HasCardinalLT (Arrow K) κ) + [HasLimitsOfShape Kᵒᵖ (Type v)] [∀ k, IsPresentable (Y.obj k) κ] : IsPresentable c.pt κ := by have : ∀ (k : Kᵒᵖ), ((Y.op ⋙ coyoneda).obj k).IsAccessible κ := fun k ↦ by dsimp infer_instance exact Functor.accessible_of_isLimit - (coyoneda.mapCone c.op) (isLimitOfPreserves _ hc.op) κ - (by simpa only [cardinal_arrow_op] using hK) + (coyoneda.mapCone c.op) (isLimitOfPreserves _ hc.op) κ (by simpa) end CategoryTheory From 7551261629de28aedf0f60408d0645cf9190a385 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sat, 14 Dec 2024 15:42:12 +0100 Subject: [PATCH 019/309] better docstrings --- Mathlib/CategoryTheory/Presentable/Basic.lean | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/Basic.lean b/Mathlib/CategoryTheory/Presentable/Basic.lean index 8c8b998b07ee71..ec658c8a2845c1 100644 --- a/Mathlib/CategoryTheory/Presentable/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/Basic.lean @@ -36,8 +36,8 @@ open Limits Opposite section -/-- A category `J` is `κ`-filtered (for a regular cardinal `κ`) is -any functor `F : A ⥤ J` from a `κ`-small category (`Cardinal.mk (Arrow A) < κ`) +/-- A category `J` is `κ`-filtered (for a regular cardinal `κ`) if +any functor `F : A ⥤ J` from a category `A` such that `HasCardinalLT (Arrow A) κ` admits a cocone. -/ class IsCardinalFiltered (J : Type u') [Category.{v'} J] (κ : Cardinal.{w}) [Fact κ.IsRegular] : Prop where @@ -49,7 +49,7 @@ namespace IsCardinalFiltered variable {J : Type u'} [Category.{v'} J] {κ : Cardinal.{w}} [hκ : Fact κ.IsRegular] [IsCardinalFiltered J κ] -/-- A choice of cocone for a functor `F : A ⥤ J` such that `Cardinal.mk (Arrow A) < κ` +/-- A choice of cocone for a functor `F : A ⥤ J` such that `HasCardinatLT (Arrow A) κ` when `J` is a `κ`-filtered category. -/ noncomputable def cocone {A : Type v''} [Category.{u''} A] (F : A ⥤ J) (hA : HasCardinalLT (Arrow A) κ) : @@ -61,14 +61,15 @@ noncomputable def cocone {A : Type v''} [Category.{u''} A] exact (Cocones.equivalenceOfReindexing e.symm (Iso.refl _)).inverse.obj (nonempty_cocone (κ := κ) (e.inverse ⋙ F) (by simpa)).some ---/-- When `S : Set J` is of cardinality `< κ` and `J` is `κ`-filtered, this is ---a choice of object in `J` which is the target of a map from any object in `S`. -/ +/-- If `S : K → J` is a family of objects of cardinality `< κ` in a `κ`-filtered category, +this is a choice of object in `J` which is the target of a map from any of +the objects `S k`. -/ noncomputable def max {K : Type v''} (S : K → J) (hS : HasCardinalLT K κ) : J := by have : HasCardinalLT (Arrow (Discrete K)) κ := by simpa using hS exact (cocone (Discrete.functor S) this).pt -/-- When `S : Set J` is of cardinality `< κ` and `J` is `κ`-filtered, -this is a choice of map `s.1 ⟶ max S hS` for any `s : S`. -/ +/-- If `S : K → J` is a family of objects of cardinality `< κ` in a `κ`-filtered category, +this is a choice of map `S k ⟶ max S hS` for any `k : K`. -/ noncomputable def toMax {K : Type v''} (S : K → J) (hS : HasCardinalLT K κ) (k : K) : S k ⟶ max S hS := by have : HasCardinalLT (Arrow (Discrete K)) κ := by simpa using hS From 710c427c85c6a13bdd9fb58e661995caed2b8576 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sat, 14 Dec 2024 20:40:41 +0100 Subject: [PATCH 020/309] wip --- .../CategoryTheory/Limits/TypesFiltered.lean | 7 ++- .../CategoryTheory/Presentable/Limits.lean | 44 +++++++------------ 2 files changed, 20 insertions(+), 31 deletions(-) diff --git a/Mathlib/CategoryTheory/Limits/TypesFiltered.lean b/Mathlib/CategoryTheory/Limits/TypesFiltered.lean index 05dec6451b29c0..bab33b7fb53064 100644 --- a/Mathlib/CategoryTheory/Limits/TypesFiltered.lean +++ b/Mathlib/CategoryTheory/Limits/TypesFiltered.lean @@ -99,9 +99,7 @@ protected theorem rel_eq_eqvGen_quot_rel : · rw [← (FilteredColimit.rel_equiv F).eqvGen_iff] exact Relation.EqvGen.mono (rel_of_quot_rel F) -variable [HasColimit F] - -theorem colimit_eq_iff_aux {i j : J} {xi : F.obj i} {xj : F.obj j} : +theorem colimit_eq_iff_aux [HasColimit F] {i j : J} {xi : F.obj i} {xj : F.obj j} : (colimitCocone F).ι.app i xi = (colimitCocone F).ι.app j xj ↔ FilteredColimit.Rel.{v, u} F ⟨i, xi⟩ ⟨j, xj⟩ := by dsimp @@ -110,6 +108,7 @@ theorem colimit_eq_iff_aux {i j : J} {xi : F.obj i} {xj : F.obj j} : theorem isColimit_eq_iff {t : Cocone F} (ht : IsColimit t) {i j : J} {xi : F.obj i} {xj : F.obj j} : t.ι.app i xi = t.ι.app j xj ↔ ∃ (k : _) (f : i ⟶ k) (g : j ⟶ k), F.map f xi = F.map g xj := by + have : HasColimit F := ⟨_, ht⟩ refine Iff.trans ?_ (colimit_eq_iff_aux F) rw [← (IsColimit.coconePointUniqueUpToIso ht (colimitCoconeIsColimit F)).toEquiv.injective.eq_iff] convert Iff.rfl @@ -118,7 +117,7 @@ theorem isColimit_eq_iff {t : Cocone F} (ht : IsColimit t) {i j : J} {xi : F.obj · exact (congrFun (IsColimit.comp_coconePointUniqueUpToIso_hom ht (colimitCoconeIsColimit F) _) xj).symm -theorem colimit_eq_iff {i j : J} {xi : F.obj i} {xj : F.obj j} : +theorem colimit_eq_iff [HasColimit F] {i j : J} {xi : F.obj i} {xj : F.obj j} : colimit.ι F i xi = colimit.ι F j xj ↔ ∃ (k : _) (f : i ⟶ k) (g : j ⟶ k), F.map f xi = F.map g xj := isColimit_eq_iff _ (colimit.isColimit F) diff --git a/Mathlib/CategoryTheory/Presentable/Limits.lean b/Mathlib/CategoryTheory/Presentable/Limits.lean index 597d0dc0950a27..880d59a4396ab9 100644 --- a/Mathlib/CategoryTheory/Presentable/Limits.lean +++ b/Mathlib/CategoryTheory/Presentable/Limits.lean @@ -5,7 +5,7 @@ Authors: Joël Riou -/ import Mathlib.CategoryTheory.Limits.Preserves.Basic -import Mathlib.CategoryTheory.Limits.Types +import Mathlib.CategoryTheory.Limits.TypesFiltered import Mathlib.CategoryTheory.Limits.Yoneda import Mathlib.CategoryTheory.Limits.FunctorCategory.Basic import Mathlib.CategoryTheory.Presentable.Basic @@ -27,28 +27,6 @@ namespace CategoryTheory open Opposite Limits -namespace Limits - -namespace Types - -namespace FilteredColimit - -variable {J : Type u} [Category.{v} J] [IsFiltered J] {F : J ⥤ Type w} - (c : Cocone F) - -def isColimit_mk (hc₁ : ∀ (x : c.pt), ∃ (j : J) (y : F.obj j), c.ι.app j y = x) - (hc₂ : ∀ (j : J) (y₁ y₂ : F.obj j) (hy : c.ι.app j y₁ = c.ι.app j y₂), - ∃ (j' : J) (k : j ⟶ j'), F.map k y₁ = F.map k y₂) : - IsColimit c := by - have : IsFiltered J := inferInstance - sorry - -end FilteredColimit - -end Types - -end Limits - variable {C : Type u} [Category.{v} C] namespace Functor @@ -67,27 +45,39 @@ variable {K : Type u'} [Category.{v'} K] {F : K ⥤ C ⥤ Type w'} {X : J ⥤ C} (cX : Cocone X) (hcX : IsColimit cX) (hF : ∀ (k : K), IsColimit ((F.obj k).mapCocone cX)) -def isColimitMapCocone : IsColimit (c.pt.mapCocone cX) := by +noncomputable def isColimitMapCocone : IsColimit (c.pt.mapCocone cX) := by have := isFiltered_of_isCardinalDirected J κ have := hcX - apply Types.FilteredColimit.isColimit_mk + apply Types.FilteredColimit.isColimitOf · intro x obtain ⟨y, hy⟩ := (Types.isLimitEquivSections (hc cX.pt)).symm.surjective x have H := fun k ↦ Types.jointly_surjective_of_isColimit (hF k) (y.1 k) + dsimp at H let j (k : K) : J := (H k).choose let z (k : K) : (F.obj k).obj (X.obj (j k)) := (H k).choose_spec.choose have hz (k : K) : (F.obj k).map (cX.ι.app (j k)) (z k) = y.1 k := (H k).choose_spec.choose_spec + have H' {k k' : K} (φ : k ⟶ k') := + (Types.FilteredColimit.isColimit_eq_iff (ht := hF k') + (xi := (F.map φ).app _ (z k)) (xj := z k')).1 (by + dsimp + simpa only [← FunctorToTypes.naturality, hz] using y.2 φ) + dsimp at H' have hK' := hasCardinalLT_of_hasCardinalLT_arrow hK - have pif := IsCardinalFiltered.max j hK' let j₀ : J := IsCardinalFiltered.max j hK' let α (k : K) : j k ⟶ j₀ := IsCardinalFiltered.toMax j hK' k have j₁ : J := sorry have β : j₀ ⟶ j₁ := sorry + have hβ {k k'} (φ : k ⟶ k') : + (F.obj k').map (X.map β) ((F.obj k').map (X.map (α k)) ((F.map φ).app (X.obj (j k)) (z k))) = + (F.obj k').map (X.map β) ((F.obj k').map (X.map (α k')) (z k')) := sorry let s : (F ⋙ (evaluation C (Type w')).obj (X.obj j₁)).sections := { val k := (F.obj k).map (X.map (α k ≫ β)) (z k) property {k k'} φ := by - sorry } + dsimp + simp only [FunctorToTypes.naturality, Functor.map_comp, + types_comp_apply] + apply hβ } refine ⟨j₁, (Types.isLimitEquivSections (hc (X.obj j₁))).symm s, ?_⟩ apply (Types.isLimitEquivSections (hc cX.pt)).injective rw [← hy, Equiv.apply_symm_apply] From d8e0d6e4ca642cfba6da7caf8ab2b468e336965d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sun, 15 Dec 2024 17:27:05 +0100 Subject: [PATCH 021/309] wip --- Mathlib/CategoryTheory/Presentable/Basic.lean | 94 ++++++++++++++++ .../CategoryTheory/Presentable/Limits.lean | 101 +++++++++++------- 2 files changed, 159 insertions(+), 36 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/Basic.lean b/Mathlib/CategoryTheory/Presentable/Basic.lean index ec658c8a2845c1..2b656e4dbc2bb9 100644 --- a/Mathlib/CategoryTheory/Presentable/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/Basic.lean @@ -9,6 +9,7 @@ import Mathlib.CategoryTheory.Limits.Preserves.Basic import Mathlib.CategoryTheory.Comma.CardinalArrow import Mathlib.SetTheory.Cardinal.Cofinality import Mathlib.SetTheory.Cardinal.HasCardinalLT +import Mathlib.SetTheory.Cardinal.Arithmetic /-! # Presentable objects @@ -75,6 +76,99 @@ noncomputable def toMax {K : Type v''} (S : K → J) (hS : HasCardinalLT K κ) ( have : HasCardinalLT (Arrow (Discrete K)) κ := by simpa using hS exact (cocone (Discrete.functor S) this).ι.app ⟨k⟩ +section + +section + +inductive ParallelMaps (T : Type u'') : Type + | zero + | one + +namespace ParallelMaps + +variable {T : Type u''} + +inductive Hom : ParallelMaps T → ParallelMaps T → Type u'' + | id (X : ParallelMaps T) : Hom X X + | map (t : T) : Hom zero one + +def Hom.comp : + ∀ {X Y Z : ParallelMaps T}, Hom X Y → Hom Y Z → Hom X Z + | _, _, _, id _, g => g + | _, _, _, f, id _ => f + +instance : Category (ParallelMaps T) where + Hom := Hom + id := Hom.id + comp := Hom.comp + id_comp := by rintro _ _ (_ | _); all_goals rfl + comp_id := by rintro _ _ (_ | _); all_goals rfl + assoc := by rintro _ _ _ _ (_ | _) (_ | _) (_ | _); all_goals rfl + +@[simps] +def mkFunctor {C : Type u} [Category.{v} C] {X Y : C} (f : T → (X ⟶ Y)) : + ParallelMaps T ⥤ C where + obj a := match a with + | zero => X + | one => Y + map φ := match φ with + | .id _ => 𝟙 _ + | .map t => f t + map_comp := by + rintro _ _ _ (_ | _) (_ | _) <;> simp <;> rfl + +variable (T) in +def arrowEquiv : Arrow (ParallelMaps T) ≃ Option (Option T) where + toFun f := match f.left, f.right, f.hom with + | zero, _, .id _ => none + | one, _, .id _ => some none + | zero, one, .map t => some (some t) + invFun x := match x with + | none => Arrow.mk (𝟙 zero) + | some none => Arrow.mk (𝟙 one) + | some (some t) => Arrow.mk (.map t) + left_inv := by rintro ⟨(_ | _), _, (_ | _)⟩ <;> rfl + right_inv := by rintro (_ | (_ | _)) <;> rfl + +lemma _root_.hasCardinalLT_option_iff (X : Type u) (κ' : Cardinal.{w}) + (hκ' : Cardinal.aleph0 ≤ κ') : + HasCardinalLT (Option X) κ' ↔ HasCardinalLT X κ' := by + constructor + · intro h + exact h.of_injective _ (Option.some_injective _) + · intro h + dsimp [HasCardinalLT] at h ⊢ + simp only [Cardinal.mk_option, Cardinal.lift_add, Cardinal.lift_one] + exact Cardinal.add_lt_of_lt (by simpa using hκ') h + (lt_of_lt_of_le Cardinal.one_lt_aleph0 (by simpa using hκ')) + +lemma hasCardinalLT {κ' : Cardinal.{w}} (hT : HasCardinalLT T κ') (hκ' : Cardinal.aleph0 ≤ κ') : + HasCardinalLT (Arrow (ParallelMaps T)) κ' := by + simpa only [hasCardinalLT_iff_of_equiv (arrowEquiv T), + hasCardinalLT_option_iff _ _ hκ'] using hT + +end ParallelMaps + +end + +variable {K : Type u''} {j j' : J} (f : K → (j ⟶ j')) (hK : HasCardinalLT K κ) + +noncomputable def coeq : J := + (cocone (ParallelMaps.mkFunctor f) (ParallelMaps.hasCardinalLT hK hκ.out.aleph0_le)).pt + +noncomputable def coeqHom : j' ⟶ coeq f hK := + (cocone (ParallelMaps.mkFunctor f) (ParallelMaps.hasCardinalLT hK hκ.out.aleph0_le)).ι.app .one + +noncomputable def toCoeq : j ⟶ coeq f hK := + (cocone (ParallelMaps.mkFunctor f) (ParallelMaps.hasCardinalLT hK hκ.out.aleph0_le)).ι.app .zero + +@[reassoc] +lemma coeq_condition (k : K) : f k ≫ coeqHom f hK = toCoeq f hK := + (cocone (ParallelMaps.mkFunctor f) (ParallelMaps.hasCardinalLT hK hκ.out.aleph0_le)).w + (ParallelMaps.Hom.map k) + +end + variable (J) lemma of_le {κ' : Cardinal.{w}} [Fact κ'.IsRegular] (h : κ' ≤ κ) : diff --git a/Mathlib/CategoryTheory/Presentable/Limits.lean b/Mathlib/CategoryTheory/Presentable/Limits.lean index 880d59a4396ab9..e07c70d9dedbe8 100644 --- a/Mathlib/CategoryTheory/Presentable/Limits.lean +++ b/Mathlib/CategoryTheory/Presentable/Limits.lean @@ -45,49 +45,78 @@ variable {K : Type u'} [Category.{v'} K] {F : K ⥤ C ⥤ Type w'} {X : J ⥤ C} (cX : Cocone X) (hcX : IsColimit cX) (hF : ∀ (k : K), IsColimit ((F.obj k).mapCocone cX)) -noncomputable def isColimitMapCocone : IsColimit (c.pt.mapCocone cX) := by +namespace isColimitMapCocone + +include hc hF hK + +lemma surjective (x : c.pt.obj cX.pt) : + ∃ (j : J) (x' : c.pt.obj (X.obj j)), x = (c.pt.mapCocone cX).ι.app j x' := by have := isFiltered_of_isCardinalDirected J κ - have := hcX - apply Types.FilteredColimit.isColimitOf - · intro x - obtain ⟨y, hy⟩ := (Types.isLimitEquivSections (hc cX.pt)).symm.surjective x - have H := fun k ↦ Types.jointly_surjective_of_isColimit (hF k) (y.1 k) - dsimp at H + obtain ⟨y, hy⟩ := (Types.isLimitEquivSections (hc cX.pt)).symm.surjective x + obtain ⟨j₀, z, hz⟩ : ∃ (j₀ : J) (z : (k : K) → (F.obj k).obj (X.obj j₀)), + ∀ (k : K), y.1 k = (F.obj k).map (cX.ι.app j₀) (z k) := by + have H (k : K) := Types.jointly_surjective_of_isColimit (hF k) (y.1 k) let j (k : K) : J := (H k).choose let z (k : K) : (F.obj k).obj (X.obj (j k)) := (H k).choose_spec.choose have hz (k : K) : (F.obj k).map (cX.ι.app (j k)) (z k) = y.1 k := (H k).choose_spec.choose_spec - have H' {k k' : K} (φ : k ⟶ k') := + refine ⟨IsCardinalFiltered.max j (hasCardinalLT_of_hasCardinalLT_arrow hK), fun k ↦ + (F.obj k).map (X.map (IsCardinalFiltered.toMax j _ k)) (z k), + fun k ↦ by rw [← hz, ← FunctorToTypes.map_comp_apply, cX.w]⟩ + obtain ⟨j₁, α, hα⟩ : ∃ (j₁ : J) (α : j₀ ⟶ j₁), ∀ ⦃k k' : K⦄ (φ : k ⟶ k'), + (F.obj k').map (X.map α) ((F.map φ).app _ (z k)) = + (F.obj k').map (X.map α) (z k') := by + have H {k k' : K} (φ : k ⟶ k') := (Types.FilteredColimit.isColimit_eq_iff (ht := hF k') - (xi := (F.map φ).app _ (z k)) (xj := z k')).1 (by + (xi := (F.map φ).app _ (z k)) (xj := z k')).1 (by dsimp - simpa only [← FunctorToTypes.naturality, hz] using y.2 φ) - dsimp at H' - have hK' := hasCardinalLT_of_hasCardinalLT_arrow hK - let j₀ : J := IsCardinalFiltered.max j hK' - let α (k : K) : j k ⟶ j₀ := IsCardinalFiltered.toMax j hK' k - have j₁ : J := sorry - have β : j₀ ⟶ j₁ := sorry - have hβ {k k'} (φ : k ⟶ k') : - (F.obj k').map (X.map β) ((F.obj k').map (X.map (α k)) ((F.map φ).app (X.obj (j k)) (z k))) = - (F.obj k').map (X.map β) ((F.obj k').map (X.map (α k')) (z k')) := sorry - let s : (F ⋙ (evaluation C (Type w')).obj (X.obj j₁)).sections := - { val k := (F.obj k).map (X.map (α k ≫ β)) (z k) - property {k k'} φ := by - dsimp - simp only [FunctorToTypes.naturality, Functor.map_comp, - types_comp_apply] - apply hβ } - refine ⟨j₁, (Types.isLimitEquivSections (hc (X.obj j₁))).symm s, ?_⟩ - apply (Types.isLimitEquivSections (hc cX.pt)).injective - rw [← hy, Equiv.apply_symm_apply] - ext k - have h₁ := Types.isLimitEquivSections_apply (hc cX.pt) k - (c.pt.map (cX.ι.app j₁) ((Types.isLimitEquivSections (hc (X.obj j₁))).symm s)) - have h₂ := Types.isLimitEquivSections_symm_apply (hc (X.obj j₁)) s k - dsimp at h₁ h₂ ⊢ - rw [h₁, ← hz k, FunctorToTypes.naturality, h₂, ← FunctorToTypes.map_comp_apply, cX.w] - · sorry + simpa only [← FunctorToTypes.naturality, ← hz] using y.2 φ) + let j {k k' : K} (φ : k ⟶ k') : J := (H φ).choose + let f₁ {k k' : K} (φ : k ⟶ k') : j₀ ⟶ j φ := (H φ).choose_spec.choose + let f₂ {k k' : K} (φ : k ⟶ k') : j₀ ⟶ j φ := (H φ).choose_spec.choose_spec.choose + have hf {k k' : K} (φ : k ⟶ k') : + (F.obj k').map (X.map (f₁ φ)) ((F.map φ).app _ (z k)) = + (F.obj k').map (X.map (f₂ φ)) (z k') := (H φ).choose_spec.choose_spec.choose_spec + let j' {k k' : K} (φ : k ⟶ k') := IsFiltered.coeq (f₁ φ) (f₂ φ) + let g {k k' : K} (φ : k ⟶ k') : j₀ ⟶ j' φ := f₁ φ ≫ IsFiltered.coeqHom (f₁ φ) (f₂ φ) + have hg {k k' : K} (φ : k ⟶ k') : + (F.obj k').map (X.map (g φ)) ((F.map φ).app _ (z k)) = + (F.obj k').map (X.map (g φ)) (z k') := by + dsimp [g] + conv_rhs => rw [IsFiltered.coeq_condition] + simp only [map_comp, FunctorToTypes.map_comp_apply, hf] + obtain ⟨j₁, α, β, hα⟩ : ∃ (j₁ : J) (α : j₀ ⟶ j₁) + (β : ∀ ⦃k k' : K⦄ (φ : k ⟶ k'), j' φ ⟶ j₁), + ∀ ⦃k k' : K⦄ (φ : k ⟶ k'), α = g φ ≫ β φ := by + let j'' (f : Arrow K) : J := j' f.hom + let ψ (f : Arrow K) : j₀ ⟶ IsCardinalFiltered.max j'' hK := + g f.hom ≫ IsCardinalFiltered.toMax j'' hK f + refine ⟨IsCardinalFiltered.coeq ψ hK, IsCardinalFiltered.toCoeq ψ hK, + fun k k' φ ↦ IsCardinalFiltered.toMax j'' hK φ ≫ IsCardinalFiltered.coeqHom ψ hK, + fun k k' φ ↦ ?_⟩ + simpa [ψ] using (IsCardinalFiltered.coeq_condition ψ hK (Arrow.mk φ)).symm + exact ⟨j₁, α, fun k k' φ ↦ by simp [hα φ, hg]⟩ + let s : (F ⋙ (evaluation C (Type w')).obj (X.obj j₁)).sections := + { val k := (F.obj k).map (X.map α) (z k) + property {k k'} φ := by + dsimp + rw [FunctorToTypes.naturality, ← hα φ] } + refine ⟨j₁, (Types.isLimitEquivSections (hc (X.obj j₁))).symm s, ?_⟩ + apply (Types.isLimitEquivSections (hc cX.pt)).injective + rw [← hy, Equiv.apply_symm_apply] + ext k + have h₁ := Types.isLimitEquivSections_apply (hc cX.pt) k + (c.pt.map (cX.ι.app j₁) ((Types.isLimitEquivSections (hc (X.obj j₁))).symm s)) + have h₂ := Types.isLimitEquivSections_symm_apply (hc (X.obj j₁)) s k + dsimp at h₁ h₂ ⊢ + rw [h₁, hz, FunctorToTypes.naturality, h₂, ← FunctorToTypes.map_comp_apply, cX.w] + +end isColimitMapCocone + +noncomputable def isColimitMapCocone : IsColimit (c.pt.mapCocone cX) := by + have := hcX + exact Types.FilteredColimit.isColimitOf _ _ + (isColimitMapCocone.surjective c hc κ hK cX hF) sorry end From c6e5a947602f948bdb99a39ef00d0a4082f3482f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sun, 15 Dec 2024 18:41:13 +0100 Subject: [PATCH 022/309] wip --- .../CategoryTheory/Limits/TypesFiltered.lean | 22 ++++++ .../CategoryTheory/Presentable/Limits.lean | 67 +++++++++++++------ 2 files changed, 68 insertions(+), 21 deletions(-) diff --git a/Mathlib/CategoryTheory/Limits/TypesFiltered.lean b/Mathlib/CategoryTheory/Limits/TypesFiltered.lean index bab33b7fb53064..b761d6214cd69d 100644 --- a/Mathlib/CategoryTheory/Limits/TypesFiltered.lean +++ b/Mathlib/CategoryTheory/Limits/TypesFiltered.lean @@ -75,6 +75,16 @@ noncomputable def isColimitOf (t : Cocone F) (hsurj : ∀ x : t.pt, ∃ i xi, x variable [IsFilteredOrEmpty J] +/-- Recognizing filtered colimits of types. The injectivity condition here is +slightly easier to check as compared to `isColimitOf`. -/ +noncomputable def isColimitOf' (t : Cocone F) (hsurj : ∀ x : t.pt, ∃ i xi, x = t.ι.app i xi) + (hinj : ∀ i x y, t.ι.app i x = t.ι.app i y → ∃ (k : _) (f : i ⟶ k), F.map f x = F.map f y) : + IsColimit t := + isColimitOf _ _ hsurj (fun i j xi xj h ↦ by + obtain ⟨k, g, hg⟩ := hinj (IsFiltered.max i j) (F.map (IsFiltered.leftToMax i j) xi) + (F.map (IsFiltered.rightToMax i j) xj) (by simp [FunctorToTypes.naturality, h]) + exact ⟨k, IsFiltered.leftToMax i j ≫ g, IsFiltered.rightToMax i j ≫ g, by simpa using hg⟩) + protected theorem rel_equiv : _root_.Equivalence (FilteredColimit.Rel.{v, u} F) where refl x := ⟨x.1, 𝟙 x.1, 𝟙 x.1, rfl⟩ symm := fun ⟨k, f, g, h⟩ => ⟨k, g, f, h.symm⟩ @@ -117,6 +127,18 @@ theorem isColimit_eq_iff {t : Cocone F} (ht : IsColimit t) {i j : J} {xi : F.obj · exact (congrFun (IsColimit.comp_coconePointUniqueUpToIso_hom ht (colimitCoconeIsColimit F) _) xj).symm +variable {F} in +theorem isColimit_eq_iff' {t : Cocone F} (ht : IsColimit t) {i : J} (x y : F.obj i) : + t.ι.app i x = t.ι.app i y ↔ ∃ (j : _) (f : i ⟶ j), F.map f x = F.map f y := by + rw [isColimit_eq_iff _ ht] + constructor + · rintro ⟨k, f, g, h⟩ + refine ⟨IsFiltered.coeq f g, f ≫ IsFiltered.coeqHom f g, ?_⟩ + conv_rhs => rw [IsFiltered.coeq_condition] + simp only [FunctorToTypes.map_comp_apply, h] + · rintro ⟨j, f, h⟩ + exact ⟨j, f, f, h⟩ + theorem colimit_eq_iff [HasColimit F] {i j : J} {xi : F.obj i} {xj : F.obj j} : colimit.ι F i xi = colimit.ι F j xj ↔ ∃ (k : _) (f : i ⟶ k) (g : j ⟶ k), F.map f xi = F.map g xj := diff --git a/Mathlib/CategoryTheory/Presentable/Limits.lean b/Mathlib/CategoryTheory/Presentable/Limits.lean index e07c70d9dedbe8..f0a83b412ffbed 100644 --- a/Mathlib/CategoryTheory/Presentable/Limits.lean +++ b/Mathlib/CategoryTheory/Presentable/Limits.lean @@ -42,7 +42,7 @@ variable {K : Type u'} [Category.{v'} K] {F : K ⥤ C ⥤ Type w'} (κ : Cardinal.{w}) [Fact κ.IsRegular] (hK : HasCardinalLT (Arrow K) κ) {J : Type w} [SmallCategory J] [IsCardinalFiltered J κ] - {X : J ⥤ C} (cX : Cocone X) (hcX : IsColimit cX) + {X : J ⥤ C} (cX : Cocone X) (hF : ∀ (k : K), IsColimit ((F.obj k).mapCocone cX)) namespace isColimitMapCocone @@ -67,28 +67,19 @@ lemma surjective (x : c.pt.obj cX.pt) : (F.obj k').map (X.map α) ((F.map φ).app _ (z k)) = (F.obj k').map (X.map α) (z k') := by have H {k k' : K} (φ : k ⟶ k') := - (Types.FilteredColimit.isColimit_eq_iff (ht := hF k') - (xi := (F.map φ).app _ (z k)) (xj := z k')).1 (by + (Types.FilteredColimit.isColimit_eq_iff' (ht := hF k') + (x := (F.map φ).app _ (z k)) (y := z k')).1 (by dsimp simpa only [← FunctorToTypes.naturality, ← hz] using y.2 φ) let j {k k' : K} (φ : k ⟶ k') : J := (H φ).choose - let f₁ {k k' : K} (φ : k ⟶ k') : j₀ ⟶ j φ := (H φ).choose_spec.choose - let f₂ {k k' : K} (φ : k ⟶ k') : j₀ ⟶ j φ := (H φ).choose_spec.choose_spec.choose - have hf {k k' : K} (φ : k ⟶ k') : - (F.obj k').map (X.map (f₁ φ)) ((F.map φ).app _ (z k)) = - (F.obj k').map (X.map (f₂ φ)) (z k') := (H φ).choose_spec.choose_spec.choose_spec - let j' {k k' : K} (φ : k ⟶ k') := IsFiltered.coeq (f₁ φ) (f₂ φ) - let g {k k' : K} (φ : k ⟶ k') : j₀ ⟶ j' φ := f₁ φ ≫ IsFiltered.coeqHom (f₁ φ) (f₂ φ) + let g {k k' : K} (φ : k ⟶ k') : j₀ ⟶ j φ := (H φ).choose_spec.choose have hg {k k' : K} (φ : k ⟶ k') : (F.obj k').map (X.map (g φ)) ((F.map φ).app _ (z k)) = - (F.obj k').map (X.map (g φ)) (z k') := by - dsimp [g] - conv_rhs => rw [IsFiltered.coeq_condition] - simp only [map_comp, FunctorToTypes.map_comp_apply, hf] + (F.obj k').map (X.map (g φ)) (z k') := (H φ).choose_spec.choose_spec obtain ⟨j₁, α, β, hα⟩ : ∃ (j₁ : J) (α : j₀ ⟶ j₁) - (β : ∀ ⦃k k' : K⦄ (φ : k ⟶ k'), j' φ ⟶ j₁), + (β : ∀ ⦃k k' : K⦄ (φ : k ⟶ k'), j φ ⟶ j₁), ∀ ⦃k k' : K⦄ (φ : k ⟶ k'), α = g φ ≫ β φ := by - let j'' (f : Arrow K) : J := j' f.hom + let j'' (f : Arrow K) : J := j f.hom let ψ (f : Arrow K) : j₀ ⟶ IsCardinalFiltered.max j'' hK := g f.hom ≫ IsCardinalFiltered.toMax j'' hK f refine ⟨IsCardinalFiltered.coeq ψ hK, IsCardinalFiltered.toCoeq ψ hK, @@ -111,12 +102,47 @@ lemma surjective (x : c.pt.obj cX.pt) : dsimp at h₁ h₂ ⊢ rw [h₁, hz, FunctorToTypes.naturality, h₂, ← FunctorToTypes.map_comp_apply, cX.w] +lemma injective (j : J) (x₁ x₂ : c.pt.obj (X.obj j)) + (h : c.pt.map (cX.ι.app j) x₁ = c.pt.map (cX.ι.app j) x₂) : + ∃ (j' : J) (α : j ⟶ j'), + c.pt.map (X.map α) x₁ = c.pt.map (X.map α) x₂ := by + have := isFiltered_of_isCardinalDirected J κ + let y₁ := Types.isLimitEquivSections (hc (X.obj j)) x₁ + let y₂ := Types.isLimitEquivSections (hc (X.obj j)) x₂ + have hy₁ : (Types.isLimitEquivSections (hc (X.obj j))).symm y₁ = x₁ := by simp [y₁] + have hy₂ : (Types.isLimitEquivSections (hc (X.obj j))).symm y₂ = x₂ := by simp [y₂] + have H (k : K) := (Types.FilteredColimit.isColimit_eq_iff' (ht := hF k) + (x := y₁.1 k) (y := y₂.1 k)).1 (by + simp only [y₁, y₂, Types.isLimitEquivSections_apply] + dsimp + simp only [← FunctorToTypes.naturality, h]) + let j₁ (k : K) : J := (H k).choose + let f (k : K) : j ⟶ j₁ k := (H k).choose_spec.choose + have hf (k : K) : (F.obj k).map (X.map (f k)) (y₁.1 k) = + (F.obj k).map (X.map (f k)) (y₂.1 k) := + (H k).choose_spec.choose_spec + have hK' := hasCardinalLT_of_hasCardinalLT_arrow hK + let ψ (k : K) : j ⟶ IsCardinalFiltered.max j₁ hK' := + f k ≫ IsCardinalFiltered.toMax j₁ hK' k + refine ⟨IsCardinalFiltered.coeq ψ hK', IsCardinalFiltered.toCoeq ψ hK', ?_⟩ + apply (Types.isLimitEquivSections (hc _)).injective + ext k + simp only [Types.isLimitEquivSections_apply, ← hy₁, ← hy₂] + have h₁ := Types.isLimitEquivSections_symm_apply (hc (X.obj j)) y₁ k + have h₂ := Types.isLimitEquivSections_symm_apply (hc (X.obj j)) y₂ k + dsimp at h₁ h₂ ⊢ + simp only [FunctorToTypes.naturality, h₁, h₂, + ← IsCardinalFiltered.coeq_condition ψ hK' k, + map_comp, FunctorToTypes.map_comp_apply, ψ, hf] + end isColimitMapCocone +/-- Auxiliary definition of `accessible_of_isLimit`. -/ noncomputable def isColimitMapCocone : IsColimit (c.pt.mapCocone cX) := by - have := hcX - exact Types.FilteredColimit.isColimitOf _ _ - (isColimitMapCocone.surjective c hc κ hK cX hF) sorry + have := isFiltered_of_isCardinalDirected J κ + apply Types.FilteredColimit.isColimitOf' + · exact isColimitMapCocone.surjective c hc κ hK cX hF + · exact isColimitMapCocone.injective c hc κ hK cX hF end @@ -133,10 +159,9 @@ lemma accessible_of_isLimit {K : Type u'} [Category.{v'} K] {F : K ⥤ C ⥤ Typ preservesColimitOfShape {J _ _} := ⟨fun {X} ↦ ⟨fun {cX} hcX ↦ by have := fun k ↦ preservesColimitsOfShape_of_isAccessible (F.obj k) κ J exact ⟨Accessible.Limits.isColimitMapCocone c - (fun Y ↦ isLimitOfPreserves ((evaluation C (Type w')).obj Y) hc) κ hK cX hcX + (fun Y ↦ isLimitOfPreserves ((evaluation C (Type w')).obj Y) hc) κ hK cX (fun k ↦ isColimitOfPreserves (F.obj k) hcX)⟩⟩⟩ - end Functor lemma isPresentable_of_isColimit From 24891ac7a9a9f6a107c642a50eff6703b878f759 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sun, 15 Dec 2024 18:55:40 +0100 Subject: [PATCH 023/309] better name --- Mathlib/SetTheory/Cardinal/HasCardinalLT.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/SetTheory/Cardinal/HasCardinalLT.lean b/Mathlib/SetTheory/Cardinal/HasCardinalLT.lean index 6dbfec5d67a050..e979249c119c8d 100644 --- a/Mathlib/SetTheory/Cardinal/HasCardinalLT.lean +++ b/Mathlib/SetTheory/Cardinal/HasCardinalLT.lean @@ -73,6 +73,6 @@ lemma hasCardinalLT_iff_of_equiv {X : Type u} {Y : Type u'} (e : X ≃ Y) (κ : fun h ↦ h.of_injective _ e.injective⟩ @[simp] -lemma hasCardinalLT_aleph0 (X : Type u) : +lemma hasCardinalLT_aleph0_iff (X : Type u) : HasCardinalLT X Cardinal.aleph0.{v} ↔ Finite X := by simpa [HasCardinalLT] using Cardinal.mk_lt_aleph0_iff From ec18456d52363309619603083c07b9c9c628f8e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Mon, 16 Dec 2024 13:08:24 +0100 Subject: [PATCH 024/309] better proof --- Mathlib/SetTheory/Cardinal/HasCardinalLT.lean | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Mathlib/SetTheory/Cardinal/HasCardinalLT.lean b/Mathlib/SetTheory/Cardinal/HasCardinalLT.lean index e979249c119c8d..4b26ac76b3c8f7 100644 --- a/Mathlib/SetTheory/Cardinal/HasCardinalLT.lean +++ b/Mathlib/SetTheory/Cardinal/HasCardinalLT.lean @@ -3,7 +3,7 @@ Copyright (c) 2024 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ -import Mathlib.SetTheory.Cardinal.Basic +import Mathlib.SetTheory.Cardinal.UnivLE /-! # The property of being of cardinality less than a cardinal @@ -18,7 +18,7 @@ universe w v u u' /-- The property that the cardinal of a type `X : Type u` is less than `κ : Cardinal.{v}`. -/ def HasCardinalLT (X : Type u) (κ : Cardinal.{v}) : Prop := - Cardinal.mk (ULift.{v} X) < Cardinal.lift κ + Cardinal.lift.{v} (Cardinal.mk X) < Cardinal.lift κ lemma hasCardinalLT_iff_cardinal_mk_lt (X : Type u) (κ : Cardinal.{u}) : HasCardinalLT X κ ↔ Cardinal.mk X < κ := by @@ -33,11 +33,9 @@ variable {X : Type u} {κ : Cardinal.{v}} (h : HasCardinalLT X κ) include h lemma small : Small.{v} X := by - induction' κ using Cardinal.inductionOn with Y - replace h := (Cardinal.le_def _ _).1 h.le - obtain ⟨f, hf⟩ := h - exact small_of_injective (Function.Injective.comp ULift.down_injective - (Function.Injective.comp hf ULift.up_injective)) + dsimp [HasCardinalLT] at h + rw [← Cardinal.lift_lt.{_, v + 1}, Cardinal.lift_lift, Cardinal.lift_lift] at h + simpa only [Cardinal.small_iff_lift_mk_lt_univ] using h.trans (Cardinal.lift_lt_univ' κ) lemma of_le {κ' : Cardinal.{v}} (hκ' : κ ≤ κ') : HasCardinalLT X κ' := From aa6308d6a305dc97b60fa6e269f9f69f7958d984 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Mon, 16 Dec 2024 13:11:06 +0100 Subject: [PATCH 025/309] better docstring --- Mathlib/SetTheory/Cardinal/HasCardinalLT.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/SetTheory/Cardinal/HasCardinalLT.lean b/Mathlib/SetTheory/Cardinal/HasCardinalLT.lean index 4b26ac76b3c8f7..9e38c272b9d0a4 100644 --- a/Mathlib/SetTheory/Cardinal/HasCardinalLT.lean +++ b/Mathlib/SetTheory/Cardinal/HasCardinalLT.lean @@ -10,7 +10,7 @@ import Mathlib.SetTheory.Cardinal.UnivLE Given `X : Type u` and `κ : Cardinal.{v}`, we introduce a predicate `HasCardinalLT X κ` expressing that -`Cardinal.mk (ULift.{v} X) < Cardinal.lift κ`. +`Cardinal.lift.{v} (Cardinal.mk X) < Cardinal.lift κ`. -/ From 8adce59337b9ab4886e62e6c7da7cfdcfc62e42e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Mon, 16 Dec 2024 13:56:07 +0100 Subject: [PATCH 026/309] fixing imports --- Mathlib/SetTheory/Cardinal/HasCardinalLT.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/SetTheory/Cardinal/HasCardinalLT.lean b/Mathlib/SetTheory/Cardinal/HasCardinalLT.lean index 9e38c272b9d0a4..b14bed334c1f09 100644 --- a/Mathlib/SetTheory/Cardinal/HasCardinalLT.lean +++ b/Mathlib/SetTheory/Cardinal/HasCardinalLT.lean @@ -3,7 +3,7 @@ Copyright (c) 2024 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ -import Mathlib.SetTheory.Cardinal.UnivLE +import Mathlib.SetTheory.Ordinal.Basic /-! # The property of being of cardinality less than a cardinal From 544c9238f16ebffe6747fd4927e18c89a26cdd1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Mon, 16 Dec 2024 16:28:59 +0100 Subject: [PATCH 027/309] fix --- Mathlib/CategoryTheory/Presentable/Basic.lean | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/Basic.lean b/Mathlib/CategoryTheory/Presentable/Basic.lean index 2b656e4dbc2bb9..ef5723b9aa4b6e 100644 --- a/Mathlib/CategoryTheory/Presentable/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/Basic.lean @@ -185,7 +185,7 @@ lemma isFiltered_of_isCardinalDirected (J : Type u') [Category.{v'} J] intro A _ _ F have hA : HasCardinalLT (Arrow A) κ := by refine HasCardinalLT.of_le ?_ hκ.out.aleph0_le - simp only [hasCardinalLT_aleph0] + simp only [hasCardinalLT_aleph0_iff] infer_instance exact ⟨cocone F hA⟩ @@ -200,7 +200,7 @@ lemma isCardinalFiltered_aleph0_iff (J : Type u') [Category.{v'} J] : · intro constructor intro A _ F hA - rw [hasCardinalLT_aleph0] at hA + rw [hasCardinalLT_aleph0_iff] at hA have := ((Arrow.finite_iff A).1 hA).some exact ⟨IsFiltered.cocone F⟩ From e5199dcbc6f6e7317b456b46ebeb8b529ab902f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Mon, 16 Dec 2024 16:57:32 +0100 Subject: [PATCH 028/309] wip --- Mathlib.lean | 1 + .../Presentable/IsCardinalFiltered.lean | 155 ++++++++++++++++++ .../Presentable/ParallelMaps.lean | 88 ++++++++++ Mathlib/SetTheory/Cardinal/HasCardinalLT.lean | 14 +- 4 files changed, 257 insertions(+), 1 deletion(-) create mode 100644 Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean create mode 100644 Mathlib/CategoryTheory/Presentable/ParallelMaps.lean diff --git a/Mathlib.lean b/Mathlib.lean index 1f724cdf2d2e9a..7c5975545e859a 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -2050,6 +2050,7 @@ import Mathlib.CategoryTheory.Preadditive.Yoneda.Basic import Mathlib.CategoryTheory.Preadditive.Yoneda.Injective import Mathlib.CategoryTheory.Preadditive.Yoneda.Limits import Mathlib.CategoryTheory.Preadditive.Yoneda.Projective +import Mathlib.CategoryTheory.Presentable.IsCardinalFiltered import Mathlib.CategoryTheory.Products.Associator import Mathlib.CategoryTheory.Products.Basic import Mathlib.CategoryTheory.Products.Bifunctor diff --git a/Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean b/Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean new file mode 100644 index 00000000000000..cab25808f57793 --- /dev/null +++ b/Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean @@ -0,0 +1,155 @@ +/- +Copyright (c) 2024 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.ParallelMaps +import Mathlib.CategoryTheory.Filtered.Basic +import Mathlib.CategoryTheory.Limits.Preserves.Basic +import Mathlib.CategoryTheory.Comma.CardinalArrow +import Mathlib.SetTheory.Cardinal.Cofinality +import Mathlib.SetTheory.Cardinal.HasCardinalLT +import Mathlib.SetTheory.Cardinal.Arithmetic + +/-! # κ-filtered category + +If `κ` is a regular cardinal, we introduce the notion of `κ`-filtered +category, which generalizes the notion of filtered category. +Indeed, we obtain the equivalence `IsCardinalFiltered J ℵ₀ ↔ IsFiltered J`. + +A preordered type `J` is a `κ`-filtered category (or a `κ`-directed set) +if any subset of `J` of cardinality `< κ` has an upper bound. + +## References +* [Adámek, J. and Rosický, J., *Locally presentable and accessible categories*][Adamek_Rosicky_1994] + +-/ + +universe w v'' v' v u'' u' u + +namespace CategoryTheory + +open Limits Opposite + +/-- A category `J` is `κ`-filtered (for a regular cardinal `κ`) if +any functor `F : A ⥤ J` from a category `A` such that `HasCardinalLT (Arrow A) κ` +admits a cocone. -/ +class IsCardinalFiltered (J : Type u) [Category.{v} J] + (κ : Cardinal.{w}) [Fact κ.IsRegular] : Prop where + nonempty_cocone {A : Type w} [SmallCategory A] (F : A ⥤ J) + (hA : HasCardinalLT (Arrow A) κ) : Nonempty (Cocone F) + +namespace IsCardinalFiltered + +variable {J : Type u} [Category.{v} J] {κ : Cardinal.{w}} [hκ : Fact κ.IsRegular] + [IsCardinalFiltered J κ] + +/-- A choice of cocone for a functor `F : A ⥤ J` such that `HasCardinatLT (Arrow A) κ` +when `J` is a `κ`-filtered category, and `Arrow A` has cardinality `< κ`. -/ +noncomputable def cocone {A : Type v'} [Category.{u'} A] + (F : A ⥤ J) (hA : HasCardinalLT (Arrow A) κ) : + Cocone F := by + have := hA.small + have := small_of_small_arrow.{w} A + have := locallySmall_of_small_arrow.{w} A + let e := (Shrink.equivalence.{w} A).trans (ShrinkHoms.equivalence.{w} (Shrink.{w} A)) + exact (Cocones.equivalenceOfReindexing e.symm (Iso.refl _)).inverse.obj + (nonempty_cocone (κ := κ) (e.inverse ⋙ F) (by simpa)).some + +variable (J) in +lemma of_le {κ' : Cardinal.{w}} [Fact κ'.IsRegular] (h : κ' ≤ κ) : + IsCardinalFiltered J κ' where + nonempty_cocone F hA := ⟨cocone F (hA.of_le h)⟩ + +section max + +variable {K : Type u'} (S : K → J) (hS : HasCardinalLT K κ) + +/-- If `S : K → J` is a family of objects of cardinality `< κ` in a `κ`-filtered category, +this is a choice of objects in `J` which is the target of a map from any of +the objects `S k`. -/ +noncomputable def max : J := + (cocone (Discrete.functor S) (by simpa using hS)).pt + +/-- If `S : K → J` is a family of objects of cardinality `< κ` in a `κ`-filtered category, +this is a choice of map `S k ⟶ max S hS` for any `k : K`. -/ +noncomputable def toMax (k : K) : + S k ⟶ max S hS := + (cocone (Discrete.functor S) (by simpa using hS)).ι.app ⟨k⟩ + +end max + +section coeq + +variable {K : Type v'} {j j' : J} (f : K → (j ⟶ j')) (hK : HasCardinalLT K κ) + +/-- Given a family of maps `f : K → (j ⟶ j')` in a `κ`-filtered category `J`, +with `HasCardinalLT K κ`, this is an object of `J` where these morphisms +shall be equalized. -/ +noncomputable def coeq : J := + (cocone (ParallelMaps.mkFunctor f) + (ParallelMaps.hasCardinalLT hK hκ.out.aleph0_le)).pt + +/-- Given a family of maps `f : K → (j ⟶ j')` in a `κ`-filtered category `J`, +with `HasCardinalLT K κ`, and `k : K`, this is a choice of morphism `j' ⟶ coeq f hK`. -/ +noncomputable def coeqHom : j' ⟶ coeq f hK := + (cocone (ParallelMaps.mkFunctor f) + (ParallelMaps.hasCardinalLT hK hκ.out.aleph0_le)).ι.app .one + +/-- Given a family of maps `f : K → (j ⟶ j')` in a `κ`-filtered category `J`, +with `HasCardinalLT K κ`, this is a morphism `j ⟶ coeq f hK` which is equal +to all compositions `f k ≫ coeqHom f hK` for `k : K`. -/ +noncomputable def toCoeq : j ⟶ coeq f hK := + (cocone (ParallelMaps.mkFunctor f) + (ParallelMaps.hasCardinalLT hK hκ.out.aleph0_le)).ι.app .zero + +@[reassoc] +lemma coeq_condition (k : K) : f k ≫ coeqHom f hK = toCoeq f hK := + (cocone (ParallelMaps.mkFunctor f) + (ParallelMaps.hasCardinalLT hK hκ.out.aleph0_le)).w (ParallelMaps.Hom.map k) + +end coeq + +end IsCardinalFiltered + +open IsCardinalFiltered in +lemma isFiltered_of_isCardinalDirected (J : Type u) [Category.{v} J] + (κ : Cardinal.{w}) [hκ : Fact κ.IsRegular] [IsCardinalFiltered J κ]: + IsFiltered J := by + rw [IsFiltered.iff_cocone_nonempty.{w}] + intro A _ _ F + have hA : HasCardinalLT (Arrow A) κ := by + refine HasCardinalLT.of_le ?_ hκ.out.aleph0_le + simp only [hasCardinalLT_aleph0_iff] + infer_instance + exact ⟨cocone F hA⟩ + +instance : Fact Cardinal.aleph0.IsRegular where + out := Cardinal.isRegular_aleph0 + +lemma isCardinalFiltered_aleph0_iff (J : Type u) [Category.{v} J] : + IsCardinalFiltered J Cardinal.aleph0.{w} ↔ IsFiltered J := by + constructor + · intro + exact isFiltered_of_isCardinalDirected J Cardinal.aleph0 + · intro + constructor + intro A _ F hA + rw [hasCardinalLT_aleph0_iff] at hA + have := ((Arrow.finite_iff A).1 hA).some + exact ⟨IsFiltered.cocone F⟩ + +lemma isCardinalFiltered_preorder (J : Type w) [Preorder J] + (κ : Cardinal.{w}) [Fact κ.IsRegular] + (h : ∀ ⦃K : Type w⦄ (s : K → J) (_ : Cardinal.mk K < κ), + ∃ (j : J), ∀ (k : K), s k ≤ j) : + IsCardinalFiltered J κ where + nonempty_cocone {A _ F hA} := by + obtain ⟨j, hj⟩ := h F.obj (by simpa only [hasCardinalLT_iff_cardinal_mk_lt] using + hasCardinalLT_of_hasCardinalLT_arrow hA) + exact ⟨Cocone.mk j + { app a := homOfLE (hj a) + naturality _ _ _ := rfl }⟩ + +end CategoryTheory diff --git a/Mathlib/CategoryTheory/Presentable/ParallelMaps.lean b/Mathlib/CategoryTheory/Presentable/ParallelMaps.lean new file mode 100644 index 00000000000000..4bf4dd675d7f9f --- /dev/null +++ b/Mathlib/CategoryTheory/Presentable/ParallelMaps.lean @@ -0,0 +1,88 @@ +/- +Copyright (c) 2024 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.Comma.CardinalArrow + +/-! +# The category ParallelMaps + +Given a type `T`, we introduce a category with two objects `zero` and `one`, +such that `(zero ⟶ one) ≃ T`, and other morphisms are identities. + +This category is used in order to show that it is possible to coequalize +a suitable family of morphisms in a `κ`-filtered category +(see `CategoryTheory.Presentable.IsCardinalFiltered`.) + +-/ + +universe w v u u₀ + +namespace CategoryTheory + +/-- Given a type `T`, which is the category with two objects `zero` and `one`, +such that `(zero ⟶ one) ≃ T`, and other morphisms are identities. -/ +inductive ParallelMaps (T : Type u₀) : Type + | zero + | one + +namespace ParallelMaps + +variable {T : Type u₀} + +/-- The type of morphisms in the category `ParallelMaps T`: identities, and morphisms +`zero ⟶ one` attached to any `t : T`. -/ +inductive Hom : ParallelMaps T → ParallelMaps T → Type u₀ + | id (X : ParallelMaps T) : Hom X X + | map (t : T) : Hom zero one + +/-- The composition of morphisms in the category `ParallelMaps T`. -/ +def Hom.comp : ∀ {X Y Z : ParallelMaps T}, Hom X Y → Hom Y Z → Hom X Z + | _, _, _, id _, g => g + | _, _, _, f, id _ => f + +instance : Category (ParallelMaps T) where + Hom := Hom + id := Hom.id + comp := Hom.comp + id_comp := by rintro _ _ (_ | _); all_goals rfl + comp_id := by rintro _ _ (_ | _); all_goals rfl + assoc := by rintro _ _ _ _ (_ | _) (_ | _) (_ | _); all_goals rfl + +/-- Constructor for functors from the category `ParallelMaps T`. -/ +@[simps] +def mkFunctor {C : Type u} [Category.{v} C] {X Y : C} (f : T → (X ⟶ Y)) : + ParallelMaps T ⥤ C where + obj a := match a with + | zero => X + | one => Y + map φ := match φ with + | .id _ => 𝟙 _ + | .map t => f t + map_comp := by + rintro _ _ _ (_ | _) (_ | _) <;> simp <;> rfl + +variable (T) in +/-- `Arrow (ParallelMaps T)` identify to the type obtained by adding two elements to `T`. -/ +def arrowEquiv : Arrow (ParallelMaps T) ≃ Option (Option T) where + toFun f := match f.left, f.right, f.hom with + | zero, _, .id _ => none + | one, _, .id _ => some none + | zero, one, .map t => some (some t) + invFun x := match x with + | none => Arrow.mk (𝟙 zero) + | some none => Arrow.mk (𝟙 one) + | some (some t) => Arrow.mk (.map t) + left_inv := by rintro ⟨(_ | _), _, (_ | _)⟩ <;> rfl + right_inv := by rintro (_ | (_ | _)) <;> rfl + +lemma hasCardinalLT {κ' : Cardinal.{w}} (hT : HasCardinalLT T κ') (hκ' : Cardinal.aleph0 ≤ κ') : + HasCardinalLT (Arrow (ParallelMaps T)) κ' := by + simpa only [hasCardinalLT_iff_of_equiv (arrowEquiv T), + hasCardinalLT_option_iff _ _ hκ'] using hT + +end ParallelMaps + +end CategoryTheory diff --git a/Mathlib/SetTheory/Cardinal/HasCardinalLT.lean b/Mathlib/SetTheory/Cardinal/HasCardinalLT.lean index b14bed334c1f09..85c95a6267a4d6 100644 --- a/Mathlib/SetTheory/Cardinal/HasCardinalLT.lean +++ b/Mathlib/SetTheory/Cardinal/HasCardinalLT.lean @@ -3,7 +3,7 @@ Copyright (c) 2024 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ -import Mathlib.SetTheory.Ordinal.Basic +import Mathlib.SetTheory.Cardinal.Arithmetic /-! # The property of being of cardinality less than a cardinal @@ -74,3 +74,15 @@ lemma hasCardinalLT_iff_of_equiv {X : Type u} {Y : Type u'} (e : X ≃ Y) (κ : lemma hasCardinalLT_aleph0_iff (X : Type u) : HasCardinalLT X Cardinal.aleph0.{v} ↔ Finite X := by simpa [HasCardinalLT] using Cardinal.mk_lt_aleph0_iff + +lemma hasCardinalLT_option_iff (X : Type u) (κ' : Cardinal.{w}) + (hκ' : Cardinal.aleph0 ≤ κ') : + HasCardinalLT (Option X) κ' ↔ HasCardinalLT X κ' := by + constructor + · intro h + exact h.of_injective _ (Option.some_injective _) + · intro h + dsimp [HasCardinalLT] at h ⊢ + simp only [Cardinal.mk_option, Cardinal.lift_add, Cardinal.lift_one] + exact Cardinal.add_lt_of_lt (by simpa using hκ') h + (lt_of_lt_of_le Cardinal.one_lt_aleph0 (by simpa using hκ')) From c5b79feef9271c5f05e9cb792c2b038b5e932a8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Mon, 16 Dec 2024 17:01:29 +0100 Subject: [PATCH 029/309] cleaing up --- .../CategoryTheory/Presentable/IsCardinalFiltered.lean | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean b/Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean index cab25808f57793..1ba4ff3cd10f06 100644 --- a/Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean +++ b/Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean @@ -15,10 +15,13 @@ import Mathlib.SetTheory.Cardinal.Arithmetic /-! # κ-filtered category If `κ` is a regular cardinal, we introduce the notion of `κ`-filtered -category, which generalizes the notion of filtered category. +category `J`: it means that any functor `A ⥤ J` from a small category such +that `Arrow A` is of cardinality `< κ` admits a cocone. +This notion generalizes the notion of filtered category. Indeed, we obtain the equivalence `IsCardinalFiltered J ℵ₀ ↔ IsFiltered J`. +The API is mostly parallel to that of filtered categories. -A preordered type `J` is a `κ`-filtered category (or a `κ`-directed set) +A preordered type `J` is a `κ`-filtered category (i.e. `κ`-directed set) if any subset of `J` of cardinality `< κ` has an upper bound. ## References @@ -26,7 +29,7 @@ if any subset of `J` of cardinality `< κ` has an upper bound. -/ -universe w v'' v' v u'' u' u +universe w v' v u' u namespace CategoryTheory From aa56c74c07fcdfd67bb8f8dcd22eaadb25261d68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Mon, 16 Dec 2024 17:02:54 +0100 Subject: [PATCH 030/309] wip --- Mathlib.lean | 1 + .../Preadditive/Presentable/ParallelMaps.lean | 88 +++++++++++++++++++ 2 files changed, 89 insertions(+) create mode 100644 Mathlib/CategoryTheory/Preadditive/Presentable/ParallelMaps.lean diff --git a/Mathlib.lean b/Mathlib.lean index 1f724cdf2d2e9a..19a5b54c80a6e8 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -2042,6 +2042,7 @@ import Mathlib.CategoryTheory.Preadditive.LeftExact import Mathlib.CategoryTheory.Preadditive.Mat import Mathlib.CategoryTheory.Preadditive.OfBiproducts import Mathlib.CategoryTheory.Preadditive.Opposite +import Mathlib.CategoryTheory.Preadditive.Presentable.ParallelMaps import Mathlib.CategoryTheory.Preadditive.Projective import Mathlib.CategoryTheory.Preadditive.ProjectiveResolution import Mathlib.CategoryTheory.Preadditive.Schur diff --git a/Mathlib/CategoryTheory/Preadditive/Presentable/ParallelMaps.lean b/Mathlib/CategoryTheory/Preadditive/Presentable/ParallelMaps.lean new file mode 100644 index 00000000000000..4bf4dd675d7f9f --- /dev/null +++ b/Mathlib/CategoryTheory/Preadditive/Presentable/ParallelMaps.lean @@ -0,0 +1,88 @@ +/- +Copyright (c) 2024 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.Comma.CardinalArrow + +/-! +# The category ParallelMaps + +Given a type `T`, we introduce a category with two objects `zero` and `one`, +such that `(zero ⟶ one) ≃ T`, and other morphisms are identities. + +This category is used in order to show that it is possible to coequalize +a suitable family of morphisms in a `κ`-filtered category +(see `CategoryTheory.Presentable.IsCardinalFiltered`.) + +-/ + +universe w v u u₀ + +namespace CategoryTheory + +/-- Given a type `T`, which is the category with two objects `zero` and `one`, +such that `(zero ⟶ one) ≃ T`, and other morphisms are identities. -/ +inductive ParallelMaps (T : Type u₀) : Type + | zero + | one + +namespace ParallelMaps + +variable {T : Type u₀} + +/-- The type of morphisms in the category `ParallelMaps T`: identities, and morphisms +`zero ⟶ one` attached to any `t : T`. -/ +inductive Hom : ParallelMaps T → ParallelMaps T → Type u₀ + | id (X : ParallelMaps T) : Hom X X + | map (t : T) : Hom zero one + +/-- The composition of morphisms in the category `ParallelMaps T`. -/ +def Hom.comp : ∀ {X Y Z : ParallelMaps T}, Hom X Y → Hom Y Z → Hom X Z + | _, _, _, id _, g => g + | _, _, _, f, id _ => f + +instance : Category (ParallelMaps T) where + Hom := Hom + id := Hom.id + comp := Hom.comp + id_comp := by rintro _ _ (_ | _); all_goals rfl + comp_id := by rintro _ _ (_ | _); all_goals rfl + assoc := by rintro _ _ _ _ (_ | _) (_ | _) (_ | _); all_goals rfl + +/-- Constructor for functors from the category `ParallelMaps T`. -/ +@[simps] +def mkFunctor {C : Type u} [Category.{v} C] {X Y : C} (f : T → (X ⟶ Y)) : + ParallelMaps T ⥤ C where + obj a := match a with + | zero => X + | one => Y + map φ := match φ with + | .id _ => 𝟙 _ + | .map t => f t + map_comp := by + rintro _ _ _ (_ | _) (_ | _) <;> simp <;> rfl + +variable (T) in +/-- `Arrow (ParallelMaps T)` identify to the type obtained by adding two elements to `T`. -/ +def arrowEquiv : Arrow (ParallelMaps T) ≃ Option (Option T) where + toFun f := match f.left, f.right, f.hom with + | zero, _, .id _ => none + | one, _, .id _ => some none + | zero, one, .map t => some (some t) + invFun x := match x with + | none => Arrow.mk (𝟙 zero) + | some none => Arrow.mk (𝟙 one) + | some (some t) => Arrow.mk (.map t) + left_inv := by rintro ⟨(_ | _), _, (_ | _)⟩ <;> rfl + right_inv := by rintro (_ | (_ | _)) <;> rfl + +lemma hasCardinalLT {κ' : Cardinal.{w}} (hT : HasCardinalLT T κ') (hκ' : Cardinal.aleph0 ≤ κ') : + HasCardinalLT (Arrow (ParallelMaps T)) κ' := by + simpa only [hasCardinalLT_iff_of_equiv (arrowEquiv T), + hasCardinalLT_option_iff _ _ hκ'] using hT + +end ParallelMaps + +end CategoryTheory From a1dce350a46fcaeeedd161d8ee2308fb0ca7fd64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Mon, 16 Dec 2024 17:06:20 +0100 Subject: [PATCH 031/309] fix --- Mathlib.lean | 2 +- .../{Preadditive => }/Presentable/ParallelMaps.lean | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename Mathlib/CategoryTheory/{Preadditive => }/Presentable/ParallelMaps.lean (100%) diff --git a/Mathlib.lean b/Mathlib.lean index 19a5b54c80a6e8..ff66039132d953 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -2042,7 +2042,6 @@ import Mathlib.CategoryTheory.Preadditive.LeftExact import Mathlib.CategoryTheory.Preadditive.Mat import Mathlib.CategoryTheory.Preadditive.OfBiproducts import Mathlib.CategoryTheory.Preadditive.Opposite -import Mathlib.CategoryTheory.Preadditive.Presentable.ParallelMaps import Mathlib.CategoryTheory.Preadditive.Projective import Mathlib.CategoryTheory.Preadditive.ProjectiveResolution import Mathlib.CategoryTheory.Preadditive.Schur @@ -2051,6 +2050,7 @@ import Mathlib.CategoryTheory.Preadditive.Yoneda.Basic import Mathlib.CategoryTheory.Preadditive.Yoneda.Injective import Mathlib.CategoryTheory.Preadditive.Yoneda.Limits import Mathlib.CategoryTheory.Preadditive.Yoneda.Projective +import Mathlib.CategoryTheory.Presentable.ParallelMaps import Mathlib.CategoryTheory.Products.Associator import Mathlib.CategoryTheory.Products.Basic import Mathlib.CategoryTheory.Products.Bifunctor diff --git a/Mathlib/CategoryTheory/Preadditive/Presentable/ParallelMaps.lean b/Mathlib/CategoryTheory/Presentable/ParallelMaps.lean similarity index 100% rename from Mathlib/CategoryTheory/Preadditive/Presentable/ParallelMaps.lean rename to Mathlib/CategoryTheory/Presentable/ParallelMaps.lean From bb53a92be4f32df78e241016f07fc14a5129af7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Mon, 16 Dec 2024 17:07:31 +0100 Subject: [PATCH 032/309] fix --- Mathlib/SetTheory/Cardinal/HasCardinalLT.lean | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Mathlib/SetTheory/Cardinal/HasCardinalLT.lean b/Mathlib/SetTheory/Cardinal/HasCardinalLT.lean index b14bed334c1f09..85c95a6267a4d6 100644 --- a/Mathlib/SetTheory/Cardinal/HasCardinalLT.lean +++ b/Mathlib/SetTheory/Cardinal/HasCardinalLT.lean @@ -3,7 +3,7 @@ Copyright (c) 2024 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ -import Mathlib.SetTheory.Ordinal.Basic +import Mathlib.SetTheory.Cardinal.Arithmetic /-! # The property of being of cardinality less than a cardinal @@ -74,3 +74,15 @@ lemma hasCardinalLT_iff_of_equiv {X : Type u} {Y : Type u'} (e : X ≃ Y) (κ : lemma hasCardinalLT_aleph0_iff (X : Type u) : HasCardinalLT X Cardinal.aleph0.{v} ↔ Finite X := by simpa [HasCardinalLT] using Cardinal.mk_lt_aleph0_iff + +lemma hasCardinalLT_option_iff (X : Type u) (κ' : Cardinal.{w}) + (hκ' : Cardinal.aleph0 ≤ κ') : + HasCardinalLT (Option X) κ' ↔ HasCardinalLT X κ' := by + constructor + · intro h + exact h.of_injective _ (Option.some_injective _) + · intro h + dsimp [HasCardinalLT] at h ⊢ + simp only [Cardinal.mk_option, Cardinal.lift_add, Cardinal.lift_one] + exact Cardinal.add_lt_of_lt (by simpa using hκ') h + (lt_of_lt_of_le Cardinal.one_lt_aleph0 (by simpa using hκ')) From c66fd0f3d30cfc0cee7a5d7ce401b682ee77b52c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Mon, 16 Dec 2024 17:32:37 +0100 Subject: [PATCH 033/309] wip --- Mathlib/CategoryTheory/EssentiallySmall.lean | 3 + Mathlib/CategoryTheory/Presentable/Basic.lean | 121 ++++-------------- .../Presentable/IsCardinalFiltered.lean | 5 + Mathlib/SetTheory/Cardinal/HasCardinalLT.lean | 20 --- 4 files changed, 31 insertions(+), 118 deletions(-) diff --git a/Mathlib/CategoryTheory/EssentiallySmall.lean b/Mathlib/CategoryTheory/EssentiallySmall.lean index 1e0ef52122580f..9990afcdb57b37 100644 --- a/Mathlib/CategoryTheory/EssentiallySmall.lean +++ b/Mathlib/CategoryTheory/EssentiallySmall.lean @@ -79,6 +79,9 @@ theorem Discrete.essentiallySmallOfSmall {α : Type u} [Small.{w} α] : theorem essentiallySmallSelf : EssentiallySmall.{max w v u} C := EssentiallySmall.mk' (AsSmall.equiv : C ≌ AsSmall.{w} C) +instance (C : Type w) [SmallCategory C] : EssentiallySmall.{w} C where + equiv_smallCategory := ⟨C, inferInstance, ⟨Equivalence.refl⟩⟩ + /-- A category is `w`-locally small if every hom set is `w`-small. See `ShrinkHoms C` for a category instance where every hom set has been replaced by a small model. diff --git a/Mathlib/CategoryTheory/Presentable/Basic.lean b/Mathlib/CategoryTheory/Presentable/Basic.lean index ec658c8a2845c1..7be052142105a9 100644 --- a/Mathlib/CategoryTheory/Presentable/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/Basic.lean @@ -6,7 +6,7 @@ Authors: Joël Riou import Mathlib.CategoryTheory.Filtered.Basic import Mathlib.CategoryTheory.Limits.Preserves.Basic -import Mathlib.CategoryTheory.Comma.CardinalArrow +import Mathlib.CategoryTheory.Presentable.IsCardinalFiltered import Mathlib.SetTheory.Cardinal.Cofinality import Mathlib.SetTheory.Cardinal.HasCardinalLT @@ -34,112 +34,25 @@ namespace CategoryTheory open Limits Opposite -section - -/-- A category `J` is `κ`-filtered (for a regular cardinal `κ`) if -any functor `F : A ⥤ J` from a category `A` such that `HasCardinalLT (Arrow A) κ` -admits a cocone. -/ -class IsCardinalFiltered (J : Type u') [Category.{v'} J] - (κ : Cardinal.{w}) [Fact κ.IsRegular] : Prop where - nonempty_cocone {A : Type w} [SmallCategory A] (F : A ⥤ J) - (hA : HasCardinalLT (Arrow A) κ) : Nonempty (Cocone F) - -namespace IsCardinalFiltered - -variable {J : Type u'} [Category.{v'} J] {κ : Cardinal.{w}} [hκ : Fact κ.IsRegular] - [IsCardinalFiltered J κ] - -/-- A choice of cocone for a functor `F : A ⥤ J` such that `HasCardinatLT (Arrow A) κ` -when `J` is a `κ`-filtered category. -/ -noncomputable def cocone {A : Type v''} [Category.{u''} A] - (F : A ⥤ J) (hA : HasCardinalLT (Arrow A) κ) : - Cocone F := by - have := hA.small - have := small_of_small_arrow.{w} A - have := locallySmall_of_small_arrow.{w} A - let e := (Shrink.equivalence.{w} A).trans (ShrinkHoms.equivalence.{w} (Shrink.{w} A)) - exact (Cocones.equivalenceOfReindexing e.symm (Iso.refl _)).inverse.obj - (nonempty_cocone (κ := κ) (e.inverse ⋙ F) (by simpa)).some - -/-- If `S : K → J` is a family of objects of cardinality `< κ` in a `κ`-filtered category, -this is a choice of object in `J` which is the target of a map from any of -the objects `S k`. -/ -noncomputable def max {K : Type v''} (S : K → J) (hS : HasCardinalLT K κ) : J := by - have : HasCardinalLT (Arrow (Discrete K)) κ := by simpa using hS - exact (cocone (Discrete.functor S) this).pt - -/-- If `S : K → J` is a family of objects of cardinality `< κ` in a `κ`-filtered category, -this is a choice of map `S k ⟶ max S hS` for any `k : K`. -/ -noncomputable def toMax {K : Type v''} (S : K → J) (hS : HasCardinalLT K κ) (k : K) : - S k ⟶ max S hS := by - have : HasCardinalLT (Arrow (Discrete K)) κ := by simpa using hS - exact (cocone (Discrete.functor S) this).ι.app ⟨k⟩ - -variable (J) - -lemma of_le {κ' : Cardinal.{w}} [Fact κ'.IsRegular] (h : κ' ≤ κ) : - IsCardinalFiltered J κ' where - nonempty_cocone F hA := ⟨cocone F (hA.of_le h)⟩ - -end IsCardinalFiltered - -open IsCardinalFiltered in -lemma isFiltered_of_isCardinalDirected (J : Type u') [Category.{v'} J] - (κ : Cardinal.{w}) [hκ : Fact κ.IsRegular] [IsCardinalFiltered J κ]: - IsFiltered J := by - rw [IsFiltered.iff_cocone_nonempty.{w}] - intro A _ _ F - have hA : HasCardinalLT (Arrow A) κ := by - refine HasCardinalLT.of_le ?_ hκ.out.aleph0_le - simp only [hasCardinalLT_aleph0] - infer_instance - exact ⟨cocone F hA⟩ - -instance : Fact Cardinal.aleph0.IsRegular where - out := Cardinal.isRegular_aleph0 - -lemma isCardinalFiltered_aleph0_iff (J : Type u') [Category.{v'} J] : - IsCardinalFiltered J Cardinal.aleph0 ↔ IsFiltered J := by - constructor - · intro - exact isFiltered_of_isCardinalDirected J Cardinal.aleph0 - · intro - constructor - intro A _ F hA - rw [hasCardinalLT_aleph0] at hA - have := ((Arrow.finite_iff A).1 hA).some - exact ⟨IsFiltered.cocone F⟩ - -lemma isCardinalFiltered_preorder (J : Type w) [Preorder J] - (κ : Cardinal.{w}) [Fact κ.IsRegular] - (h : ∀ ⦃K : Type w⦄ (s : K → J) (_ : Cardinal.mk K < κ), - ∃ (j : J), ∀ (k : K), s k ≤ j) : - IsCardinalFiltered J κ where - nonempty_cocone {A _ F hA} := by - obtain ⟨j, hj⟩ := h F.obj (by simpa only [hasCardinalLT_iff_cardinal_mk_lt] using - hasCardinalLT_of_hasCardinalLT_arrow hA) - exact ⟨Cocone.mk j - { app a := homOfLE (hj a) - naturality _ _ _ := rfl }⟩ - -end - variable {C : Type u} [Category.{v} C] {D : Type u'} [Category.{v'} D] namespace Functor -variable (F : C ⥤ D) (κ : Cardinal.{w}) [Fact κ.IsRegular] +variable (F G : C ⥤ D) (e : F ≅ G) (κ : Cardinal.{w}) [Fact κ.IsRegular] /-- A functor is `κ`-accessible (with `κ` a regular cardinal) if it preserves colimits of shape `J` where `J` is any `κ`-filtered category. -/ class IsAccessible : Prop where - preservesColimitOfShape {J : Type w} [SmallCategory J] [IsCardinalFiltered J κ] : + preservesColimitOfShape (J : Type w) [SmallCategory J] [IsCardinalFiltered J κ] : PreservesColimitsOfShape J F lemma preservesColimitsOfShape_of_isAccessible [F.IsAccessible κ] - (J : Type w) [SmallCategory J] [IsCardinalFiltered J κ] : - PreservesColimitsOfShape J F := - IsAccessible.preservesColimitOfShape κ + (J : Type u'') [Category.{v''} J] [EssentiallySmall.{w} J] [IsCardinalFiltered J κ] : + PreservesColimitsOfShape J F := by + have := IsCardinalFiltered.of_equivalence κ (equivSmallModel.{w} J) + have : PreservesColimitsOfShape (SmallModel.{w} J) F := + IsAccessible.preservesColimitOfShape κ _ + exact preservesColimitsOfShape_of_equiv (equivSmallModel.{w} J).symm F variable {κ} in lemma isAccessible_of_le @@ -149,9 +62,16 @@ lemma isAccessible_of_le have := IsCardinalFiltered.of_le J h exact F.preservesColimitsOfShape_of_isAccessible κ J +include e in +variable {F G} in +lemma isAccessible_of_iso [F.IsAccessible κ] : G.IsAccessible κ where + preservesColimitOfShape J _ hκ := by + have := F.preservesColimitsOfShape_of_isAccessible κ J + exact preservesColimitsOfShape_of_natIso e + end Functor -variable (X : C) (κ : Cardinal.{w}) [Fact κ.IsRegular] +variable (X : C) (Y : C) (e : X ≅ Y) (κ : Cardinal.{w}) [Fact κ.IsRegular] /-- An object `X` in a category is `κ`-presentable (for `κ` a regular cardinal) when the functor `Hom(X, _)` preserves colimits indexed by @@ -159,7 +79,7 @@ when the functor `Hom(X, _)` preserves colimits indexed by abbrev IsPresentable : Prop := (coyoneda.obj (op X)).IsAccessible κ lemma preservesColimitsOfShape_of_isPresentable [IsPresentable X κ] - (J : Type w) [SmallCategory J] [IsCardinalFiltered J κ] : + (J : Type u'') [Category.{v''} J] [EssentiallySmall.{w} J] [IsCardinalFiltered J κ] : PreservesColimitsOfShape J (coyoneda.obj (op X)) := (coyoneda.obj (op X)).preservesColimitsOfShape_of_isAccessible κ J @@ -169,4 +89,9 @@ lemma isPresentable_of_le [IsPresentable X κ] IsPresentable X κ' := (coyoneda.obj (op X)).isAccessible_of_le h +include e in +variable {X Y} in +lemma isPresentable_of_iso [IsPresentable X κ] : IsPresentable Y κ := + Functor.isAccessible_of_iso (coyoneda.mapIso e.symm.op) κ + end CategoryTheory diff --git a/Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean b/Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean index 1ba4ff3cd10f06..972d2d489dc5b3 100644 --- a/Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean +++ b/Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean @@ -65,6 +65,11 @@ lemma of_le {κ' : Cardinal.{w}} [Fact κ'.IsRegular] (h : κ' ≤ κ) : IsCardinalFiltered J κ' where nonempty_cocone F hA := ⟨cocone F (hA.of_le h)⟩ +variable (κ) in +lemma of_equivalence {J' : Type u'} [Category.{v'} J'] (e : J ≌ J') : + IsCardinalFiltered J' κ where + nonempty_cocone F hA := ⟨e.inverse.mapCoconeInv (cocone (F ⋙ e.inverse) hA)⟩ + section max variable {K : Type u'} (S : K → J) (hS : HasCardinalLT K κ) diff --git a/Mathlib/SetTheory/Cardinal/HasCardinalLT.lean b/Mathlib/SetTheory/Cardinal/HasCardinalLT.lean index 281372fe99724b..85c95a6267a4d6 100644 --- a/Mathlib/SetTheory/Cardinal/HasCardinalLT.lean +++ b/Mathlib/SetTheory/Cardinal/HasCardinalLT.lean @@ -3,22 +3,14 @@ Copyright (c) 2024 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ -<<<<<<< HEAD -import Mathlib.SetTheory.Cardinal.Basic -======= import Mathlib.SetTheory.Cardinal.Arithmetic ->>>>>>> origin/category-theory-is-cardinal-filtered /-! # The property of being of cardinality less than a cardinal Given `X : Type u` and `κ : Cardinal.{v}`, we introduce a predicate `HasCardinalLT X κ` expressing that -<<<<<<< HEAD -`Cardinal.mk (ULift.{v} X) < Cardinal.lift κ`. -======= `Cardinal.lift.{v} (Cardinal.mk X) < Cardinal.lift κ`. ->>>>>>> origin/category-theory-is-cardinal-filtered -/ @@ -26,11 +18,7 @@ universe w v u u' /-- The property that the cardinal of a type `X : Type u` is less than `κ : Cardinal.{v}`. -/ def HasCardinalLT (X : Type u) (κ : Cardinal.{v}) : Prop := -<<<<<<< HEAD - Cardinal.mk (ULift.{v} X) < Cardinal.lift κ -======= Cardinal.lift.{v} (Cardinal.mk X) < Cardinal.lift κ ->>>>>>> origin/category-theory-is-cardinal-filtered lemma hasCardinalLT_iff_cardinal_mk_lt (X : Type u) (κ : Cardinal.{u}) : HasCardinalLT X κ ↔ Cardinal.mk X < κ := by @@ -45,17 +33,9 @@ variable {X : Type u} {κ : Cardinal.{v}} (h : HasCardinalLT X κ) include h lemma small : Small.{v} X := by -<<<<<<< HEAD - induction' κ using Cardinal.inductionOn with Y - replace h := (Cardinal.le_def _ _).1 h.le - obtain ⟨f, hf⟩ := h - exact small_of_injective (Function.Injective.comp ULift.down_injective - (Function.Injective.comp hf ULift.up_injective)) -======= dsimp [HasCardinalLT] at h rw [← Cardinal.lift_lt.{_, v + 1}, Cardinal.lift_lift, Cardinal.lift_lift] at h simpa only [Cardinal.small_iff_lift_mk_lt_univ] using h.trans (Cardinal.lift_lt_univ' κ) ->>>>>>> origin/category-theory-is-cardinal-filtered lemma of_le {κ' : Cardinal.{v}} (hκ' : κ ≤ κ') : HasCardinalLT X κ' := From 6471fa0ce80df80d8380cdb5b9bda6f26c382d2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Mon, 16 Dec 2024 17:33:05 +0100 Subject: [PATCH 034/309] fix --- Mathlib.lean | 1 + 1 file changed, 1 insertion(+) diff --git a/Mathlib.lean b/Mathlib.lean index 7c5975545e859a..bec6adbcdfaf9d 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -2051,6 +2051,7 @@ import Mathlib.CategoryTheory.Preadditive.Yoneda.Injective import Mathlib.CategoryTheory.Preadditive.Yoneda.Limits import Mathlib.CategoryTheory.Preadditive.Yoneda.Projective import Mathlib.CategoryTheory.Presentable.IsCardinalFiltered +import Mathlib.CategoryTheory.Presentable.ParallelMaps import Mathlib.CategoryTheory.Products.Associator import Mathlib.CategoryTheory.Products.Basic import Mathlib.CategoryTheory.Products.Bifunctor From 08ee1bc936561b1a4800265a68cfd7fd85991b84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Mon, 16 Dec 2024 17:34:25 +0100 Subject: [PATCH 035/309] fixing imports --- Mathlib/CategoryTheory/Presentable/ParallelMaps.lean | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Presentable/ParallelMaps.lean b/Mathlib/CategoryTheory/Presentable/ParallelMaps.lean index 4bf4dd675d7f9f..718a706dd0bfbb 100644 --- a/Mathlib/CategoryTheory/Presentable/ParallelMaps.lean +++ b/Mathlib/CategoryTheory/Presentable/ParallelMaps.lean @@ -4,7 +4,8 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ -import Mathlib.CategoryTheory.Comma.CardinalArrow +import Mathlib.CategoryTheory.Comma.Arrow +import Mathlib.SetTheory.Cardinal.HasCardinalLT /-! # The category ParallelMaps From c41fdabd5d2160eff01b1274508fbd29a820a000 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Mon, 16 Dec 2024 17:38:56 +0100 Subject: [PATCH 036/309] better docstring --- Mathlib/CategoryTheory/Presentable/Basic.lean | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/Basic.lean b/Mathlib/CategoryTheory/Presentable/Basic.lean index 7be052142105a9..0887364abfbbb9 100644 --- a/Mathlib/CategoryTheory/Presentable/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/Basic.lean @@ -12,13 +12,9 @@ import Mathlib.SetTheory.Cardinal.HasCardinalLT /-! # Presentable objects -If `κ` is a regular cardinal, we introduce the notion of `κ`-filtered -category, which generalizes the notion of filtered category. -Indeed, we obtain the equivalence -`IsCardinalFiltered J ℵ₀ ↔ IsFiltered J`. - A functor `F : C ⥤ D` is `κ`-accessible (`Functor.IsAccessible`) -if it commutes with colimits of shape `J` where `J` is any `κ`-filtered category. +if it commutes with colimits of shape `J` where `J` is any `κ`-filtered category +(that is essentially small relative to the universe `w` such that `κ : Cardinal.{w}`.). An object `X` of a category is `κ`-presentable (`IsPresentable`) if the functor `Hom(X, _)` (i.e. `coyoneda.obj (op X)`) is `κ`-accessible. From 6736d81d1e78e1e190b7ac69651c90f51e74c82f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Mon, 16 Dec 2024 17:49:58 +0100 Subject: [PATCH 037/309] fix --- Mathlib/CategoryTheory/EssentiallySmall.lean | 3 --- Mathlib/CategoryTheory/Presentable/Basic.lean | 15 ++++++++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Mathlib/CategoryTheory/EssentiallySmall.lean b/Mathlib/CategoryTheory/EssentiallySmall.lean index 9990afcdb57b37..1e0ef52122580f 100644 --- a/Mathlib/CategoryTheory/EssentiallySmall.lean +++ b/Mathlib/CategoryTheory/EssentiallySmall.lean @@ -79,9 +79,6 @@ theorem Discrete.essentiallySmallOfSmall {α : Type u} [Small.{w} α] : theorem essentiallySmallSelf : EssentiallySmall.{max w v u} C := EssentiallySmall.mk' (AsSmall.equiv : C ≌ AsSmall.{w} C) -instance (C : Type w) [SmallCategory C] : EssentiallySmall.{w} C where - equiv_smallCategory := ⟨C, inferInstance, ⟨Equivalence.refl⟩⟩ - /-- A category is `w`-locally small if every hom set is `w`-small. See `ShrinkHoms C` for a category instance where every hom set has been replaced by a small model. diff --git a/Mathlib/CategoryTheory/Presentable/Basic.lean b/Mathlib/CategoryTheory/Presentable/Basic.lean index 0887364abfbbb9..05a5ee58c72957 100644 --- a/Mathlib/CategoryTheory/Presentable/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/Basic.lean @@ -43,11 +43,15 @@ class IsAccessible : Prop where PreservesColimitsOfShape J F lemma preservesColimitsOfShape_of_isAccessible [F.IsAccessible κ] + (J : Type w) [SmallCategory J] [IsCardinalFiltered J κ] : + PreservesColimitsOfShape J F := + IsAccessible.preservesColimitOfShape κ _ + +lemma preservesColimitsOfShape_of_isAccessible_of_essentiallySmall [F.IsAccessible κ] (J : Type u'') [Category.{v''} J] [EssentiallySmall.{w} J] [IsCardinalFiltered J κ] : PreservesColimitsOfShape J F := by have := IsCardinalFiltered.of_equivalence κ (equivSmallModel.{w} J) - have : PreservesColimitsOfShape (SmallModel.{w} J) F := - IsAccessible.preservesColimitOfShape κ _ + have := F.preservesColimitsOfShape_of_isAccessible κ (SmallModel.{w} J) exact preservesColimitsOfShape_of_equiv (equivSmallModel.{w} J).symm F variable {κ} in @@ -75,10 +79,15 @@ when the functor `Hom(X, _)` preserves colimits indexed by abbrev IsPresentable : Prop := (coyoneda.obj (op X)).IsAccessible κ lemma preservesColimitsOfShape_of_isPresentable [IsPresentable X κ] - (J : Type u'') [Category.{v''} J] [EssentiallySmall.{w} J] [IsCardinalFiltered J κ] : + (J : Type w) [SmallCategory.{w} J] [IsCardinalFiltered J κ] : PreservesColimitsOfShape J (coyoneda.obj (op X)) := (coyoneda.obj (op X)).preservesColimitsOfShape_of_isAccessible κ J +lemma preservesColimitsOfShape_of_isPresentable_of_essentiallySmall [IsPresentable X κ] + (J : Type u'') [Category.{v''} J] [EssentiallySmall.{w} J] [IsCardinalFiltered J κ] : + PreservesColimitsOfShape J (coyoneda.obj (op X)) := + (coyoneda.obj (op X)).preservesColimitsOfShape_of_isAccessible_of_essentiallySmall κ J + variable {κ} in lemma isPresentable_of_le [IsPresentable X κ] {κ' : Cardinal.{w}} [Fact κ'.IsRegular] (h : κ ≤ κ') : From 2e4ae0d48c34f09b026c54a3853a42870b20171b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Mon, 16 Dec 2024 17:53:20 +0100 Subject: [PATCH 038/309] fixing imports --- Mathlib/CategoryTheory/Presentable/Basic.lean | 1 - 1 file changed, 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Presentable/Basic.lean b/Mathlib/CategoryTheory/Presentable/Basic.lean index 05a5ee58c72957..3ef5e705d37edd 100644 --- a/Mathlib/CategoryTheory/Presentable/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/Basic.lean @@ -5,7 +5,6 @@ Authors: Joël Riou -/ import Mathlib.CategoryTheory.Filtered.Basic -import Mathlib.CategoryTheory.Limits.Preserves.Basic import Mathlib.CategoryTheory.Presentable.IsCardinalFiltered import Mathlib.SetTheory.Cardinal.Cofinality import Mathlib.SetTheory.Cardinal.HasCardinalLT From df79ff12fd16e337176f465237ac7d8fe3996dda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 26 Dec 2024 19:34:23 +0100 Subject: [PATCH 039/309] fix --- Mathlib/CategoryTheory/Presentable/Basic.lean | 1 + Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Presentable/Basic.lean b/Mathlib/CategoryTheory/Presentable/Basic.lean index 3ef5e705d37edd..05a5ee58c72957 100644 --- a/Mathlib/CategoryTheory/Presentable/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/Basic.lean @@ -5,6 +5,7 @@ Authors: Joël Riou -/ import Mathlib.CategoryTheory.Filtered.Basic +import Mathlib.CategoryTheory.Limits.Preserves.Basic import Mathlib.CategoryTheory.Presentable.IsCardinalFiltered import Mathlib.SetTheory.Cardinal.Cofinality import Mathlib.SetTheory.Cardinal.HasCardinalLT diff --git a/Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean b/Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean index 972d2d489dc5b3..43c1393a10dc3f 100644 --- a/Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean +++ b/Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean @@ -6,7 +6,6 @@ Authors: Joël Riou import Mathlib.CategoryTheory.Presentable.ParallelMaps import Mathlib.CategoryTheory.Filtered.Basic -import Mathlib.CategoryTheory.Limits.Preserves.Basic import Mathlib.CategoryTheory.Comma.CardinalArrow import Mathlib.SetTheory.Cardinal.Cofinality import Mathlib.SetTheory.Cardinal.HasCardinalLT From 4713c29c5ac4345773280ef376e5d1253b45cf44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 26 Dec 2024 20:47:17 +0100 Subject: [PATCH 040/309] wip --- Mathlib.lean | 2 + .../CardinalFilteredPresentation.lean | 82 +++++++++++++++++++ .../CategoryTheory/Presentable/Limits.lean | 2 +- .../Presentable/LocallyPresentable.lean | 65 +++++++++++++++ 4 files changed, 150 insertions(+), 1 deletion(-) create mode 100644 Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean create mode 100644 Mathlib/CategoryTheory/Presentable/LocallyPresentable.lean diff --git a/Mathlib.lean b/Mathlib.lean index 65045f2584c688..5fddcdf9972a73 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -2082,8 +2082,10 @@ import Mathlib.CategoryTheory.Preadditive.Yoneda.Injective 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.IsCardinalFiltered import Mathlib.CategoryTheory.Presentable.Limits +import Mathlib.CategoryTheory.Presentable.LocallyPresentable import Mathlib.CategoryTheory.Presentable.ParallelMaps import Mathlib.CategoryTheory.Products.Associator import Mathlib.CategoryTheory.Products.Basic diff --git a/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean b/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean new file mode 100644 index 00000000000000..bc30953da11d07 --- /dev/null +++ b/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean @@ -0,0 +1,82 @@ +/- +Copyright (c) 2024 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.Limits + +/-! +# Presentable generators + +-/ + +universe w v u + +namespace CategoryTheory + +open Limits + +variable {C : Type u} [Category.{v} C] + +structure CardinalFilteredPresentation (X : C) (κ : Cardinal.{w}) [Fact κ.IsRegular] where + J : Type w + category : Category.{w} J := by infer_instance + isCardinalFiltered : IsCardinalFiltered J κ := by infer_instance + F : J ⥤ C + ι : F ⟶ (Functor.const _).obj X + isColimit : IsColimit (Cocone.mk _ ι) + +namespace CardinalFilteredPresentation + +attribute [instance] category isCardinalFiltered + +variable {X : C} {κ : Cardinal.{w}} [Fact κ.IsRegular] + +variable (p : CardinalFilteredPresentation X κ) + +lemma isPresentable_pt (h : ∀ (j : p.J), IsPresentable (p.F.obj j) κ) + (hJ : HasCardinalLT (Arrow p.J) κ) + [HasLimitsOfShape p.Jᵒᵖ (Type v)] : + IsPresentable X κ := + isPresentable_of_isColimit _ p.isColimit κ hJ + +end CardinalFilteredPresentation + +@[simps J F ι isColimit] +def CardinalFilteredPresentation.ofIsColimit {J : Type w} [Category.{w} J] + {F : J ⥤ C} (c : Cocone F) (hc : IsColimit c) + (κ : Cardinal.{w}) [Fact κ.IsRegular] + [IsCardinalFiltered J κ] : + CardinalFilteredPresentation c.pt κ where + J := J + F := F + ι := c.ι + isColimit := hc + +variable {ι : Type w} (G : ι → C) (κ : Cardinal.{w}) [Fact κ.IsRegular] + +structure AreCardinalFilteredGenerators : Prop where + nonempty_cardinalFilteredPresentation (X : C) : + ∃ (p : CardinalFilteredPresentation X κ), + ∀ (j : p.J), ∃ (i : ι), Nonempty (p.F.obj j ≅ G i) + +namespace AreCardinalFilteredGenerators + +variable {G κ} (h : AreCardinalFilteredGenerators G κ) (X : C) + +noncomputable def presentation : CardinalFilteredPresentation X κ := + (h.nonempty_cardinalFilteredPresentation X).choose + +lemma exists_presentation_obj_iso (j : (h.presentation X).J) : + ∃ (i : ι), Nonempty ((h.presentation X).F.obj j ≅ G i) := + (h.nonempty_cardinalFilteredPresentation X).choose_spec j + +instance (j : (h.presentation X).J) [∀ i, IsPresentable (G i) κ] : + IsPresentable ((h.presentation X).F.obj j) κ := by + obtain ⟨i, ⟨e⟩⟩ := (h.exists_presentation_obj_iso X j) + exact isPresentable_of_iso e.symm κ + +end AreCardinalFilteredGenerators + +end CategoryTheory diff --git a/Mathlib/CategoryTheory/Presentable/Limits.lean b/Mathlib/CategoryTheory/Presentable/Limits.lean index f0a83b412ffbed..4eb35224b897e3 100644 --- a/Mathlib/CategoryTheory/Presentable/Limits.lean +++ b/Mathlib/CategoryTheory/Presentable/Limits.lean @@ -153,7 +153,7 @@ end Accessible lemma accessible_of_isLimit {K : Type u'} [Category.{v'} K] {F : K ⥤ C ⥤ Type w'} (c : Cone F) (hc : IsLimit c) (κ : Cardinal.{w}) [Fact κ.IsRegular] (hK : HasCardinalLT (Arrow K) κ) - [HasLimitsOfShape K (Type w')] + [HasLimitsOfShape K (Type w')] -- is it possible to get rid of this? [∀ k, (F.obj k).IsAccessible κ] : c.pt.IsAccessible κ where preservesColimitOfShape {J _ _} := ⟨fun {X} ↦ ⟨fun {cX} hcX ↦ by diff --git a/Mathlib/CategoryTheory/Presentable/LocallyPresentable.lean b/Mathlib/CategoryTheory/Presentable/LocallyPresentable.lean new file mode 100644 index 00000000000000..30f56a67f19d8d --- /dev/null +++ b/Mathlib/CategoryTheory/Presentable/LocallyPresentable.lean @@ -0,0 +1,65 @@ +/- +Copyright (c) 2024 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.CardinalFilteredPresentation + +/-! +# Locally presentable and accessible categories + +-/ + +universe w v u + +namespace CategoryTheory + +open Limits + +variable (C : Type u) [Category.{v} C] + +section + +variable (κ : Cardinal.{w}) [Fact κ.IsRegular] + +class HasCardinalFilteredGenerators extends LocallySmall.{w} C : Prop where + exists_generators : ∃ (ι : Type w) (G : ι → C), + AreCardinalFilteredGenerators G κ + +class IsCardinalLocallyPresentable + extends HasCardinalFilteredGenerators C κ, HasColimitsOfSize.{w, w} C : Prop where + +class HasCardinalFilteredColimits : Prop where + hasColimitsOfShape (J : Type w) [Category.{w} J] [IsCardinalFiltered J κ] : + HasColimitsOfShape J C := by intros; infer_instance + +attribute [instance] HasCardinalFilteredColimits.hasColimitsOfShape + +instance [HasColimitsOfSize.{w, w} C] : HasCardinalFilteredColimits.{w} C κ where + +class IsCardinalAccessibleCategory + extends HasCardinalFilteredGenerators C κ, HasCardinalFilteredColimits.{w} C κ : Prop where + +instance [IsCardinalLocallyPresentable C κ] : IsCardinalAccessibleCategory C κ where + +end + +section + +class IsLocallyPresentable : Prop where + exists_cardinal : ∃ (κ : Cardinal.{w}) (_ : Fact κ.IsRegular), + IsCardinalLocallyPresentable C κ + +class IsAccessibleCategory : Prop where + exists_cardinal : ∃ (κ : Cardinal.{w}) (_ : Fact κ.IsRegular), + IsCardinalAccessibleCategory C κ + +instance [h : IsLocallyPresentable.{w} C] : IsAccessibleCategory.{w} C where + exists_cardinal := by + obtain ⟨κ, hκ, h'⟩ := h.exists_cardinal + exact ⟨κ, hκ, inferInstance⟩ + +end + +end CategoryTheory From 724ab4a70e38263eae385d4c2c9720603839b886 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 26 Dec 2024 22:23:41 +0100 Subject: [PATCH 041/309] s/IsAccessible/IsCardinalAccessible/ --- Mathlib/CategoryTheory/Presentable/Basic.lean | 51 ++++++++++--------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/Basic.lean b/Mathlib/CategoryTheory/Presentable/Basic.lean index 05a5ee58c72957..41a24bf6e7b753 100644 --- a/Mathlib/CategoryTheory/Presentable/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/Basic.lean @@ -12,12 +12,15 @@ import Mathlib.SetTheory.Cardinal.HasCardinalLT /-! # Presentable objects -A functor `F : C ⥤ D` is `κ`-accessible (`Functor.IsAccessible`) +A functor `F : C ⥤ D` is `κ`-accessible (`Functor.IsCardinalAccessible`) if it commutes with colimits of shape `J` where `J` is any `κ`-filtered category (that is essentially small relative to the universe `w` such that `κ : Cardinal.{w}`.). +We also introduce another typeclass `Functor.IsAccessible` saying that there exists +a regular cardinal `κ` such that `Functor.IsCardinalAccessible`. -An object `X` of a category is `κ`-presentable (`IsPresentable`) +An object `X` of a category is `κ`-presentable (`IsCardinalPresentable`) if the functor `Hom(X, _)` (i.e. `coyoneda.obj (op X)`) is `κ`-accessible. +Similar as for accessible functors, we define a type class `IsAccessible`. ## References * [Adámek, J. and Rosický, J., *Locally presentable and accessible categories*][Adamek_Rosicky_1994] @@ -38,35 +41,36 @@ variable (F G : C ⥤ D) (e : F ≅ G) (κ : Cardinal.{w}) [Fact κ.IsRegular] /-- A functor is `κ`-accessible (with `κ` a regular cardinal) if it preserves colimits of shape `J` where `J` is any `κ`-filtered category. -/ -class IsAccessible : Prop where +class IsCardinalAccessible : Prop where preservesColimitOfShape (J : Type w) [SmallCategory J] [IsCardinalFiltered J κ] : PreservesColimitsOfShape J F -lemma preservesColimitsOfShape_of_isAccessible [F.IsAccessible κ] +lemma preservesColimitsOfShape_of_isCardinalAccessible [F.IsCardinalAccessible κ] (J : Type w) [SmallCategory J] [IsCardinalFiltered J κ] : PreservesColimitsOfShape J F := - IsAccessible.preservesColimitOfShape κ _ + IsCardinalAccessible.preservesColimitOfShape κ _ -lemma preservesColimitsOfShape_of_isAccessible_of_essentiallySmall [F.IsAccessible κ] +lemma preservesColimitsOfShape_of_isCardinalAccessible_of_essentiallySmall + [F.IsCardinalAccessible κ] (J : Type u'') [Category.{v''} J] [EssentiallySmall.{w} J] [IsCardinalFiltered J κ] : PreservesColimitsOfShape J F := by have := IsCardinalFiltered.of_equivalence κ (equivSmallModel.{w} J) - have := F.preservesColimitsOfShape_of_isAccessible κ (SmallModel.{w} J) + have := F.preservesColimitsOfShape_of_isCardinalAccessible κ (SmallModel.{w} J) exact preservesColimitsOfShape_of_equiv (equivSmallModel.{w} J).symm F variable {κ} in -lemma isAccessible_of_le - [F.IsAccessible κ] {κ' : Cardinal.{w}} [Fact κ'.IsRegular] (h : κ ≤ κ') : - F.IsAccessible κ' where +lemma isCardinalAccessible_of_le + [F.IsCardinalAccessible κ] {κ' : Cardinal.{w}} [Fact κ'.IsRegular] (h : κ ≤ κ') : + F.IsCardinalAccessible κ' where preservesColimitOfShape {J _ _} := by have := IsCardinalFiltered.of_le J h - exact F.preservesColimitsOfShape_of_isAccessible κ J + exact F.preservesColimitsOfShape_of_isCardinalAccessible κ J include e in variable {F G} in -lemma isAccessible_of_iso [F.IsAccessible κ] : G.IsAccessible κ where +lemma isCardinalAccessible_of_iso [F.IsCardinalAccessible κ] : G.IsCardinalAccessible κ where preservesColimitOfShape J _ hκ := by - have := F.preservesColimitsOfShape_of_isAccessible κ J + have := F.preservesColimitsOfShape_of_isCardinalAccessible κ J exact preservesColimitsOfShape_of_natIso e end Functor @@ -76,27 +80,28 @@ variable (X : C) (Y : C) (e : X ≅ Y) (κ : Cardinal.{w}) [Fact κ.IsRegular] /-- An object `X` in a category is `κ`-presentable (for `κ` a regular cardinal) when the functor `Hom(X, _)` preserves colimits indexed by `κ`-filtered categories. -/ -abbrev IsPresentable : Prop := (coyoneda.obj (op X)).IsAccessible κ +abbrev IsCardinalPresentable : Prop := (coyoneda.obj (op X)).IsCardinalAccessible κ -lemma preservesColimitsOfShape_of_isPresentable [IsPresentable X κ] +lemma preservesColimitsOfShape_of_isCardinalPresentable [IsCardinalPresentable X κ] (J : Type w) [SmallCategory.{w} J] [IsCardinalFiltered J κ] : PreservesColimitsOfShape J (coyoneda.obj (op X)) := - (coyoneda.obj (op X)).preservesColimitsOfShape_of_isAccessible κ J + (coyoneda.obj (op X)).preservesColimitsOfShape_of_isCardinalAccessible κ J -lemma preservesColimitsOfShape_of_isPresentable_of_essentiallySmall [IsPresentable X κ] +lemma preservesColimitsOfShape_of_isCardinalPresentable_of_essentiallySmall + [IsCardinalPresentable X κ] (J : Type u'') [Category.{v''} J] [EssentiallySmall.{w} J] [IsCardinalFiltered J κ] : PreservesColimitsOfShape J (coyoneda.obj (op X)) := - (coyoneda.obj (op X)).preservesColimitsOfShape_of_isAccessible_of_essentiallySmall κ J + (coyoneda.obj (op X)).preservesColimitsOfShape_of_isCardinalAccessible_of_essentiallySmall κ J variable {κ} in -lemma isPresentable_of_le [IsPresentable X κ] +lemma isCardinalPresentable_of_le [IsCardinalPresentable X κ] {κ' : Cardinal.{w}} [Fact κ'.IsRegular] (h : κ ≤ κ') : - IsPresentable X κ' := - (coyoneda.obj (op X)).isAccessible_of_le h + IsCardinalPresentable X κ' := + (coyoneda.obj (op X)).isCardinalAccessible_of_le h include e in variable {X Y} in -lemma isPresentable_of_iso [IsPresentable X κ] : IsPresentable Y κ := - Functor.isAccessible_of_iso (coyoneda.mapIso e.symm.op) κ +lemma isCardinalPresentable_of_iso [IsCardinalPresentable X κ] : IsCardinalPresentable Y κ := + Functor.isCardinalAccessible_of_iso (coyoneda.mapIso e.symm.op) κ end CategoryTheory From 8304643b3e2a825b0541ee702d1f590b57bb6aa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 26 Dec 2024 22:26:56 +0100 Subject: [PATCH 042/309] fix --- .../CategoryTheory/Presentable/Limits.lean | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/Limits.lean b/Mathlib/CategoryTheory/Presentable/Limits.lean index f0a83b412ffbed..a1fbb60f2f1d53 100644 --- a/Mathlib/CategoryTheory/Presentable/Limits.lean +++ b/Mathlib/CategoryTheory/Presentable/Limits.lean @@ -137,7 +137,7 @@ lemma injective (j : J) (x₁ x₂ : c.pt.obj (X.obj j)) end isColimitMapCocone -/-- Auxiliary definition of `accessible_of_isLimit`. -/ +/-- Auxiliary definition for `isCardinalAccessible_of_isLimit`. -/ noncomputable def isColimitMapCocone : IsColimit (c.pt.mapCocone cX) := by have := isFiltered_of_isCardinalDirected J κ apply Types.FilteredColimit.isColimitOf' @@ -150,31 +150,31 @@ end Limits end Accessible -lemma accessible_of_isLimit {K : Type u'} [Category.{v'} K] {F : K ⥤ C ⥤ Type w'} +lemma isCardinalAccessible_of_isLimit {K : Type u'} [Category.{v'} K] {F : K ⥤ C ⥤ Type w'} (c : Cone F) (hc : IsLimit c) (κ : Cardinal.{w}) [Fact κ.IsRegular] (hK : HasCardinalLT (Arrow K) κ) [HasLimitsOfShape K (Type w')] - [∀ k, (F.obj k).IsAccessible κ] : - c.pt.IsAccessible κ where + [∀ k, (F.obj k).IsCardinalAccessible κ] : + c.pt.IsCardinalAccessible κ where preservesColimitOfShape {J _ _} := ⟨fun {X} ↦ ⟨fun {cX} hcX ↦ by - have := fun k ↦ preservesColimitsOfShape_of_isAccessible (F.obj k) κ J + have := fun k ↦ preservesColimitsOfShape_of_isCardinalAccessible (F.obj k) κ J exact ⟨Accessible.Limits.isColimitMapCocone c (fun Y ↦ isLimitOfPreserves ((evaluation C (Type w')).obj Y) hc) κ hK cX (fun k ↦ isColimitOfPreserves (F.obj k) hcX)⟩⟩⟩ end Functor -lemma isPresentable_of_isColimit +lemma isCardinalPresentable_of_isColimit {K : Type u'} [Category.{v'} K] {Y : K ⥤ C} (c : Cocone Y) (hc : IsColimit c) (κ : Cardinal.{w}) [Fact κ.IsRegular] (hK : HasCardinalLT (Arrow K) κ) [HasLimitsOfShape Kᵒᵖ (Type v)] - [∀ k, IsPresentable (Y.obj k) κ] : - IsPresentable c.pt κ := by - have : ∀ (k : Kᵒᵖ), ((Y.op ⋙ coyoneda).obj k).IsAccessible κ := fun k ↦ by + [∀ k, IsCardinalPresentable (Y.obj k) κ] : + IsCardinalPresentable c.pt κ := by + have : ∀ (k : Kᵒᵖ), ((Y.op ⋙ coyoneda).obj k).IsCardinalAccessible κ := fun k ↦ by dsimp infer_instance - exact Functor.accessible_of_isLimit + exact Functor.isCardinalAccessible_of_isLimit (coyoneda.mapCone c.op) (isLimitOfPreserves _ hc.op) κ (by simpa) end CategoryTheory From 7cce429129e3f18c0a9fdf7af954965378e86bf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 26 Dec 2024 22:32:19 +0100 Subject: [PATCH 043/309] HasCardinalFilteredColimits --- Mathlib/CategoryTheory/Presentable/Basic.lean | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Mathlib/CategoryTheory/Presentable/Basic.lean b/Mathlib/CategoryTheory/Presentable/Basic.lean index 41a24bf6e7b753..4aa024d0f71876 100644 --- a/Mathlib/CategoryTheory/Presentable/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/Basic.lean @@ -104,4 +104,18 @@ variable {X Y} in lemma isCardinalPresentable_of_iso [IsCardinalPresentable X κ] : IsCardinalPresentable Y κ := Functor.isCardinalAccessible_of_iso (coyoneda.mapIso e.symm.op) κ +section + +variable (C) (κ : Cardinal.{w}) [Fact κ.IsRegular] + +class HasCardinalFilteredColimits : Prop where + hasColimitsOfShape (J : Type w) [Category.{w} J] [IsCardinalFiltered J κ] : + HasColimitsOfShape J C := by intros; infer_instance + +attribute [instance] HasCardinalFilteredColimits.hasColimitsOfShape + +instance [HasColimitsOfSize.{w, w} C] : HasCardinalFilteredColimits.{w} C κ where + +end + end CategoryTheory From b4b5e7038da034f0d2cef1bfd33100b84e0a0650 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 26 Dec 2024 22:34:03 +0100 Subject: [PATCH 044/309] fix --- .../CategoryTheory/Presentable/LocallyPresentable.lean | 8 -------- 1 file changed, 8 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/LocallyPresentable.lean b/Mathlib/CategoryTheory/Presentable/LocallyPresentable.lean index 30f56a67f19d8d..d784abe65fd539 100644 --- a/Mathlib/CategoryTheory/Presentable/LocallyPresentable.lean +++ b/Mathlib/CategoryTheory/Presentable/LocallyPresentable.lean @@ -30,14 +30,6 @@ class HasCardinalFilteredGenerators extends LocallySmall.{w} C : Prop where class IsCardinalLocallyPresentable extends HasCardinalFilteredGenerators C κ, HasColimitsOfSize.{w, w} C : Prop where -class HasCardinalFilteredColimits : Prop where - hasColimitsOfShape (J : Type w) [Category.{w} J] [IsCardinalFiltered J κ] : - HasColimitsOfShape J C := by intros; infer_instance - -attribute [instance] HasCardinalFilteredColimits.hasColimitsOfShape - -instance [HasColimitsOfSize.{w, w} C] : HasCardinalFilteredColimits.{w} C κ where - class IsCardinalAccessibleCategory extends HasCardinalFilteredGenerators C κ, HasCardinalFilteredColimits.{w} C κ : Prop where From bcf2d2fef3f0fd08342098d477c17bc5bb55bee9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 27 Dec 2024 00:38:06 +0100 Subject: [PATCH 045/309] fixed universes --- Mathlib/CategoryTheory/Presentable/Basic.lean | 121 +++++++++++++++++- .../CategoryTheory/Presentable/Limits.lean | 23 +++- 2 files changed, 135 insertions(+), 9 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/Basic.lean b/Mathlib/CategoryTheory/Presentable/Basic.lean index 1f8e5fdc7e5f44..a76f57c70ec2c9 100644 --- a/Mathlib/CategoryTheory/Presentable/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/Basic.lean @@ -6,6 +6,8 @@ Authors: Joël Riou import Mathlib.CategoryTheory.Filtered.Basic import Mathlib.CategoryTheory.Limits.Preserves.Basic +import Mathlib.CategoryTheory.Limits.Types +import Mathlib.CategoryTheory.Adjunction.Limits import Mathlib.CategoryTheory.Presentable.IsCardinalFiltered import Mathlib.SetTheory.Cardinal.Cofinality import Mathlib.SetTheory.Cardinal.HasCardinalLT @@ -28,16 +30,81 @@ Similar as for accessible functors, we define a type class `IsAccessible`. -/ -universe w w' v'' v' v u'' u' u +universe w w' v'' v₁ v₂ v₃ v₄ u₁ u₂ u₃ u₄ namespace CategoryTheory open Limits Opposite -variable {C : Type u} [Category.{v} C] {D : Type u'} [Category.{v'} D] +namespace Limits + +namespace Types + +variable {J : Type u₁} [Category.{v₁} J] + +namespace uliftFunctor + +variable {F : J ⥤ Type w'} (c : Cocone F) + +variable (F) in +def quotEquiv : Quot F ≃ Quot (F ⋙ uliftFunctor.{w}) where + toFun := Quot.lift (fun ⟨j, x⟩ ↦ Quot.ι _ j (ULift.up x)) (by + rintro ⟨j₁, x₁⟩ ⟨j₂, x₂⟩ ⟨f, h⟩ + dsimp at f h + exact Quot.sound ⟨f, by simp [h]⟩) + invFun := Quot.lift (fun ⟨j, x⟩ ↦ Quot.ι _ j (ULift.down x)) (by + rintro ⟨j₁, ⟨x₁⟩⟩ ⟨j₂, ⟨x₂⟩⟩ ⟨f, h⟩ + dsimp at f h ⊢ + refine Quot.sound ⟨f, by simpa using h⟩) + left_inv := by rintro ⟨_, _⟩; rfl + right_inv := by rintro ⟨_, _⟩; rfl + +lemma quotEquiv_comm : + Quot.desc (uliftFunctor.{w}.mapCocone c) ∘ quotEquiv F = + ULift.up ∘ Quot.desc c := by + ext ⟨j, x⟩ + simp [quotEquiv] + rfl + +lemma isColimit_cocone_iff : + Nonempty (IsColimit c) ↔ Nonempty (IsColimit (uliftFunctor.{w}.mapCocone c)) := by + simp only [isColimit_iff_bijective_desc] + rw [← Function.Bijective.of_comp_iff _ ((quotEquiv F).bijective), quotEquiv_comm.{w} c, + ← Function.Bijective.of_comp_iff' Equiv.ulift.symm.bijective] + rfl + +noncomputable def isColimitEquiv : + IsColimit c ≃ IsColimit (uliftFunctor.{w}.mapCocone c) where + toFun hc := ((isColimit_cocone_iff c).1 ⟨hc⟩).some + invFun hc := ((isColimit_cocone_iff c).2 ⟨hc⟩).some + left_inv _ := Subsingleton.elim _ _ + right_inv _ := Subsingleton.elim _ _ + +instance : PreservesColimit F (uliftFunctor.{w, w'}) where + preserves {c} hc := ⟨isColimitEquiv c hc⟩ + +instance : ReflectsColimit F (uliftFunctor.{w, w'}) where + reflects {c} hc := ⟨(isColimitEquiv c).symm hc⟩ + +instance : PreservesColimitsOfShape J (uliftFunctor.{w, w'}) where + +instance : ReflectsColimitsOfShape J (uliftFunctor.{w, w'}) where + +end uliftFunctor + +instance : PreservesColimitsOfSize.{v₁, u₁} (uliftFunctor.{w, w'}) where +instance : ReflectsColimitsOfSize.{v₁, u₁} (uliftFunctor.{w, w'}) where + +end Types + +end Limits + +variable {C : Type u₁} [Category.{v₁} C] {D : Type u₂} [Category.{v₂} D] namespace Functor +section + variable (F G : C ⥤ D) (e : F ≅ G) (κ : Cardinal.{w}) [Fact κ.IsRegular] /-- A functor is `κ`-accessible (with `κ` a regular cardinal) @@ -53,7 +120,7 @@ lemma preservesColimitsOfShape_of_isCardinalAccessible [F.IsCardinalAccessible lemma preservesColimitsOfShape_of_isCardinalAccessible_of_essentiallySmall [F.IsCardinalAccessible κ] - (J : Type u'') [Category.{v''} J] [EssentiallySmall.{w} J] [IsCardinalFiltered J κ] : + (J : Type u₃) [Category.{v₃} J] [EssentiallySmall.{w} J] [IsCardinalFiltered J κ] : PreservesColimitsOfShape J F := by have := IsCardinalFiltered.of_equivalence κ (equivSmallModel.{w} J) have := F.preservesColimitsOfShape_of_isCardinalAccessible κ (SmallModel.{w} J) @@ -74,6 +141,8 @@ lemma isCardinalAccessible_of_iso [F.IsCardinalAccessible κ] : G.IsCardinalAcce have := F.preservesColimitsOfShape_of_isCardinalAccessible κ J exact preservesColimitsOfShape_of_natIso e +end + end Functor variable (X : C) (Y : C) (e : X ≅ Y) (κ : Cardinal.{w}) [Fact κ.IsRegular] @@ -90,7 +159,7 @@ lemma preservesColimitsOfShape_of_isCardinalPresentable [IsCardinalPresentable X lemma preservesColimitsOfShape_of_isCardinalPresentable_of_essentiallySmall [IsCardinalPresentable X κ] - (J : Type u'') [Category.{v''} J] [EssentiallySmall.{w} J] [IsCardinalFiltered J κ] : + (J : Type u₃) [Category.{v₃} J] [EssentiallySmall.{w} J] [IsCardinalFiltered J κ] : PreservesColimitsOfShape J (coyoneda.obj (op X)) := (coyoneda.obj (op X)).preservesColimitsOfShape_of_isCardinalAccessible_of_essentiallySmall κ J @@ -107,6 +176,50 @@ lemma isCardinalPresentable_of_iso [IsCardinalPresentable X κ] : IsCardinalPres section +lemma isCardinalPresentable_of_equivalence + {C' : Type u₃} [Category.{v₃} C'] [IsCardinalPresentable X κ] (e : C ≌ C') : + IsCardinalPresentable (e.functor.obj X) κ := by + refine ⟨fun J _ _ ↦ ⟨fun {Y} ↦ ?_⟩⟩ + have := preservesColimitsOfShape_of_isCardinalPresentable X κ J + suffices PreservesColimit Y (coyoneda.obj (op (e.functor.obj X)) ⋙ uliftFunctor.{v₁}) from + ⟨fun {c} hc ↦ ⟨isColimitOfReflects uliftFunctor.{v₁} + (isColimitOfPreserves (coyoneda.obj (op (e.functor.obj X)) ⋙ uliftFunctor.{v₁}) hc)⟩⟩ + have iso : coyoneda.obj (op (e.functor.obj X)) ⋙ uliftFunctor.{v₁} ≅ + e.inverse ⋙ coyoneda.obj (op X) ⋙ uliftFunctor.{v₃} := + NatIso.ofComponents (fun Z ↦ + (Equiv.ulift.trans ((e.toAdjunction.homEquiv X Z).trans Equiv.ulift.symm)).toIso) (by + intro _ _ f + ext ⟨g⟩ + apply Equiv.ulift.injective + simp [Adjunction.homEquiv_unit]) + exact preservesColimit_of_natIso Y iso.symm + +instance isCardinalPresentable_of_isEquivalence + {C' : Type u₃} [Category.{v₃} C'] [IsCardinalPresentable X κ] (F : C ⥤ C') + [F.IsEquivalence] : + IsCardinalPresentable (F.obj X) κ := + isCardinalPresentable_of_equivalence X κ F.asEquivalence + +@[simp] +lemma isCardinalPresentable_iff_of_isEquivalence + {C' : Type u₃} [Category.{v₃} C'] (F : C ⥤ C') + [F.IsEquivalence] : + IsCardinalPresentable (F.obj X) κ ↔ IsCardinalPresentable X κ := by + constructor + · intro + exact isCardinalPresentable_of_iso + (show F.inv.obj (F.obj X) ≅ X from F.asEquivalence.unitIso.symm.app X : ) κ + · intro + infer_instance + +lemma isCardinalPresentable_shrinkHoms_iff [LocallySmall.{w} C] : + IsCardinalPresentable ((ShrinkHoms.functor.{w} C).obj X) κ ↔ IsCardinalPresentable X κ := + isCardinalPresentable_iff_of_isEquivalence X κ _ + +end + +section + variable (C) (κ : Cardinal.{w}) [Fact κ.IsRegular] class HasCardinalFilteredColimits : Prop where diff --git a/Mathlib/CategoryTheory/Presentable/Limits.lean b/Mathlib/CategoryTheory/Presentable/Limits.lean index a1fbb60f2f1d53..d6e13e3d856c34 100644 --- a/Mathlib/CategoryTheory/Presentable/Limits.lean +++ b/Mathlib/CategoryTheory/Presentable/Limits.lean @@ -152,8 +152,8 @@ end Accessible lemma isCardinalAccessible_of_isLimit {K : Type u'} [Category.{v'} K] {F : K ⥤ C ⥤ Type w'} (c : Cone F) (hc : IsLimit c) (κ : Cardinal.{w}) [Fact κ.IsRegular] - (hK : HasCardinalLT (Arrow K) κ) [HasLimitsOfShape K (Type w')] + (hK : HasCardinalLT (Arrow K) κ) [∀ k, (F.obj k).IsCardinalAccessible κ] : c.pt.IsCardinalAccessible κ where preservesColimitOfShape {J _ _} := ⟨fun {X} ↦ ⟨fun {cX} hcX ↦ by @@ -164,11 +164,11 @@ lemma isCardinalAccessible_of_isLimit {K : Type u'} [Category.{v'} K] {F : K ⥤ end Functor -lemma isCardinalPresentable_of_isColimit - {K : Type u'} [Category.{v'} K] {Y : K ⥤ C} - (c : Cocone Y) (hc : IsColimit c) (κ : Cardinal.{w}) [Fact κ.IsRegular] +/-- This is `isCardinalPresentable_of_isColimit` in the particular case `w = v`. -/ +lemma isCardinalPresentable_of_isColimit' + {K : Type v} [Category.{v} K] {Y : K ⥤ C} + (c : Cocone Y) (hc : IsColimit c) (κ : Cardinal.{v}) [Fact κ.IsRegular] (hK : HasCardinalLT (Arrow K) κ) - [HasLimitsOfShape Kᵒᵖ (Type v)] [∀ k, IsCardinalPresentable (Y.obj k) κ] : IsCardinalPresentable c.pt κ := by have : ∀ (k : Kᵒᵖ), ((Y.op ⋙ coyoneda).obj k).IsCardinalAccessible κ := fun k ↦ by @@ -177,4 +177,17 @@ lemma isCardinalPresentable_of_isColimit exact Functor.isCardinalAccessible_of_isLimit (coyoneda.mapCone c.op) (isLimitOfPreserves _ hc.op) κ (by simpa) +lemma isCardinalPresentable_of_isColimit + [LocallySmall.{w} C] + {K : Type w} [Category.{w} K] {Y : K ⥤ C} + (c : Cocone Y) (hc : IsColimit c) (κ : Cardinal.{w}) [Fact κ.IsRegular] + (hK : HasCardinalLT (Arrow K) κ) + [∀ k, IsCardinalPresentable (Y.obj k) κ] : + IsCardinalPresentable c.pt κ := by + rw [← isCardinalPresentable_shrinkHoms_iff.{w}] + let e := ShrinkHoms.equivalence C + have : ∀ (k : K), IsCardinalPresentable ((Y ⋙ e.functor).obj k) κ := by + dsimp; infer_instance + exact isCardinalPresentable_of_isColimit' _ (isColimitOfPreserves e.functor hc) κ hK + end CategoryTheory From 6881b3b68f817a71108af6e1a45cae88f6c2f93d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 27 Dec 2024 01:01:45 +0100 Subject: [PATCH 046/309] wip --- Mathlib/CategoryTheory/Presentable/Basic.lean | 34 +++++++++++++++++-- .../CardinalFilteredPresentation.lean | 10 +++--- 2 files changed, 38 insertions(+), 6 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/Basic.lean b/Mathlib/CategoryTheory/Presentable/Basic.lean index a76f57c70ec2c9..6e74fc89de828b 100644 --- a/Mathlib/CategoryTheory/Presentable/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/Basic.lean @@ -143,8 +143,25 @@ lemma isCardinalAccessible_of_iso [F.IsCardinalAccessible κ] : G.IsCardinalAcce end +section + +variable (F : C ⥤ D) + +/-- A functor is accessible relative to a universe `w` if +it is `κ`-accessible for some regular `κ : Cardinal.{w}`. -/ +class IsAccessible : Prop where + exists_cardinal : ∃ (κ : Cardinal.{w}) (_ : Fact κ.IsRegular), IsCardinalAccessible F κ + +lemma isAccessible_of_isCardinalAccessible (κ : Cardinal.{w}) [Fact κ.IsRegular] + [IsCardinalAccessible F κ] : IsAccessible.{w} F where + exists_cardinal := ⟨κ, inferInstance, inferInstance⟩ + +end + end Functor +section + variable (X : C) (Y : C) (e : X ≅ Y) (κ : Cardinal.{w}) [Fact κ.IsRegular] /-- An object `X` in a category is `κ`-presentable (for `κ` a regular cardinal) @@ -174,8 +191,6 @@ variable {X Y} in lemma isCardinalPresentable_of_iso [IsCardinalPresentable X κ] : IsCardinalPresentable Y κ := Functor.isCardinalAccessible_of_iso (coyoneda.mapIso e.symm.op) κ -section - lemma isCardinalPresentable_of_equivalence {C' : Type u₃} [Category.{v₃} C'] [IsCardinalPresentable X κ] (e : C ≌ C') : IsCardinalPresentable (e.functor.obj X) κ := by @@ -220,6 +235,21 @@ end section +variable (X : C) + +/-- An object of a category is presentable relative to a universe `w` +if it is `κ`-presentable for some regular `κ : Cardinal.{w}`. -/ +abbrev IsPresentable (X : C) : Prop := + Functor.IsAccessible.{w} (coyoneda.obj (op X)) + +lemma isPresentable_of_isCardinalPresentable (κ : Cardinal.{w}) [Fact κ.IsRegular] + [IsCardinalPresentable X κ] : IsPresentable.{w} X where + exists_cardinal := ⟨κ, inferInstance, inferInstance⟩ + +end + +section + variable (C) (κ : Cardinal.{w}) [Fact κ.IsRegular] class HasCardinalFilteredColimits : Prop where diff --git a/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean b/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean index 8f55f496ca85e6..86f688a4d34e27 100644 --- a/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean +++ b/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean @@ -37,10 +37,12 @@ variable (p : CardinalFilteredPresentation X κ) lemma isCardinalPresentable_pt (h : ∀ (j : p.J), IsCardinalPresentable (p.F.obj j) κ) [LocallySmall.{w} C] - (hJ : HasCardinalLT (Arrow p.J) κ) - [HasLimitsOfShape p.Jᵒᵖ (Type v)] : - IsCardinalPresentable X κ := - isCardinalPresentable_of_isColimit _ p.isColimit κ hJ + (κ' : Cardinal.{w}) [Fact κ'.IsRegular] (h : κ ≤ κ') + (hJ : HasCardinalLT (Arrow p.J) κ') : + IsCardinalPresentable X κ' := by + have : ∀ (k : p.J), IsCardinalPresentable (p.F.obj k) κ' := + fun _ ↦ isCardinalPresentable_of_le _ h + exact isCardinalPresentable_of_isColimit _ p.isColimit κ' hJ end CardinalFilteredPresentation From 159e05d284058ba3694a823f41c5b62ad134711a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 27 Dec 2024 01:12:01 +0100 Subject: [PATCH 047/309] wip --- .../CardinalFilteredPresentation.lean | 5 +++ .../Presentable/LocallyPresentable.lean | 31 ++++++++++++++++--- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean b/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean index 86f688a4d34e27..8d7e60a849e8a2 100644 --- a/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean +++ b/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean @@ -80,6 +80,11 @@ instance (j : (h.presentation X).J) [∀ i, IsCardinalPresentable (G i) κ] : obtain ⟨i, ⟨e⟩⟩ := (h.exists_presentation_obj_iso X j) exact isCardinalPresentable_of_iso e.symm κ +include h in +lemma presentable [LocallySmall.{w} C] (X : C) : IsPresentable.{w} X := by + have := h + sorry + end AreCardinalFilteredGenerators end CategoryTheory diff --git a/Mathlib/CategoryTheory/Presentable/LocallyPresentable.lean b/Mathlib/CategoryTheory/Presentable/LocallyPresentable.lean index d784abe65fd539..6ac2a214c35265 100644 --- a/Mathlib/CategoryTheory/Presentable/LocallyPresentable.lean +++ b/Mathlib/CategoryTheory/Presentable/LocallyPresentable.lean @@ -24,9 +24,17 @@ section variable (κ : Cardinal.{w}) [Fact κ.IsRegular] class HasCardinalFilteredGenerators extends LocallySmall.{w} C : Prop where - exists_generators : ∃ (ι : Type w) (G : ι → C), + exists_generators' : ∃ (ι : Type w) (G : ι → C), AreCardinalFilteredGenerators G κ +namespace HasCardinalFilteredGenerators + +lemma exists_generators [HasCardinalFilteredGenerators.{w} C κ] : + ∃ (ι : Type w) (G : ι → C), AreCardinalFilteredGenerators G κ := + HasCardinalFilteredGenerators.exists_generators' + +end HasCardinalFilteredGenerators + class IsCardinalLocallyPresentable extends HasCardinalFilteredGenerators C κ, HasColimitsOfSize.{w, w} C : Prop where @@ -40,18 +48,33 @@ end section class IsLocallyPresentable : Prop where - exists_cardinal : ∃ (κ : Cardinal.{w}) (_ : Fact κ.IsRegular), + exists_cardinal' : ∃ (κ : Cardinal.{w}) (_ : Fact κ.IsRegular), IsCardinalLocallyPresentable C κ +lemma IsLocallyPresentable.exists_cardinal [IsLocallyPresentable.{w} C] : + ∃ (κ : Cardinal.{w}) (_ : Fact κ.IsRegular), + IsCardinalLocallyPresentable C κ := + exists_cardinal' + class IsAccessibleCategory : Prop where - exists_cardinal : ∃ (κ : Cardinal.{w}) (_ : Fact κ.IsRegular), + exists_cardinal' : ∃ (κ : Cardinal.{w}) (_ : Fact κ.IsRegular), IsCardinalAccessibleCategory C κ +lemma IsAccessibleCategory.exists_cardinal [IsAccessibleCategory.{w} C] : + ∃ (κ : Cardinal.{w}) (_ : Fact κ.IsRegular), + IsCardinalAccessibleCategory C κ := + exists_cardinal' + instance [h : IsLocallyPresentable.{w} C] : IsAccessibleCategory.{w} C where - exists_cardinal := by + exists_cardinal' := by obtain ⟨κ, hκ, h'⟩ := h.exists_cardinal exact ⟨κ, hκ, inferInstance⟩ +instance [IsAccessibleCategory.{w} C] (X : C) : IsPresentable.{w} X := by + obtain ⟨κ, _, _⟩ := IsAccessibleCategory.exists_cardinal C + obtain ⟨ι, G, h⟩ := HasCardinalFilteredGenerators.exists_generators C κ + apply h.presentable + end end CategoryTheory From e71fceb0ef10aada64d33d02e240f91f60fd356c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 27 Dec 2024 01:39:55 +0100 Subject: [PATCH 048/309] wip --- .../CardinalFilteredPresentation.lean | 33 ++++++++++++++----- Mathlib/SetTheory/Cardinal/HasCardinalLT.lean | 18 ++++++++++ 2 files changed, 43 insertions(+), 8 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean b/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean index 8d7e60a849e8a2..2509660edc9277 100644 --- a/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean +++ b/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean @@ -60,7 +60,8 @@ def CardinalFilteredPresentation.ofIsColimit {J : Type w} [Category.{w} J] variable {ι : Type w} (G : ι → C) (κ : Cardinal.{w}) [Fact κ.IsRegular] structure AreCardinalFilteredGenerators : Prop where - nonempty_cardinalFilteredPresentation (X : C) : + isCardinalPresentable (i : ι) : IsCardinalPresentable (G i) κ + exists_cardinalFilteredPresentation (X : C) : ∃ (p : CardinalFilteredPresentation X κ), ∀ (j : p.J), ∃ (i : ι), Nonempty (p.F.obj j ≅ G i) @@ -69,21 +70,37 @@ namespace AreCardinalFilteredGenerators variable {G κ} (h : AreCardinalFilteredGenerators G κ) (X : C) noncomputable def presentation : CardinalFilteredPresentation X κ := - (h.nonempty_cardinalFilteredPresentation X).choose + (h.exists_cardinalFilteredPresentation X).choose lemma exists_presentation_obj_iso (j : (h.presentation X).J) : ∃ (i : ι), Nonempty ((h.presentation X).F.obj j ≅ G i) := - (h.nonempty_cardinalFilteredPresentation X).choose_spec j + (h.exists_cardinalFilteredPresentation X).choose_spec j -instance (j : (h.presentation X).J) [∀ i, IsCardinalPresentable (G i) κ] : - IsCardinalPresentable ((h.presentation X).F.obj j) κ := by - obtain ⟨i, ⟨e⟩⟩ := (h.exists_presentation_obj_iso X j) +instance (j : (h.presentation X).J) : + IsCardinalPresentable.{w} ((h.presentation X).F.obj j) κ := by + obtain ⟨i, ⟨e⟩⟩ := h.exists_presentation_obj_iso X j + have := h.isCardinalPresentable exact isCardinalPresentable_of_iso e.symm κ +include h in +lemma isPresentable (i : ι) : IsPresentable.{w} (G i) := by + have := h.isCardinalPresentable + exact isPresentable_of_isCardinalPresentable _ κ + +instance (j : (h.presentation X).J) : IsPresentable.{w} ((h.presentation X).F.obj j) := + isPresentable_of_isCardinalPresentable _ κ + include h in lemma presentable [LocallySmall.{w} C] (X : C) : IsPresentable.{w} X := by - have := h - sorry + obtain ⟨κ', _, le, hκ'⟩ : ∃ (κ' : Cardinal.{w}) (_ : Fact κ'.IsRegular) (_ : κ ≤ κ'), + HasCardinalLT (Arrow (h.presentation X).J) κ' := by + obtain ⟨κ', h₁, h₂⟩ := exists_regular_cardinal'.{w} + (Sum.elim (fun (_ : Unit) ↦ Arrow (h.presentation X).J) (fun (_ : Unit) ↦ κ.ord.toType)) + exact ⟨κ', ⟨h₁⟩, + le_of_lt (by simpa [hasCardinalLT_iff_cardinal_mk_lt] using h₂ (Sum.inr ⟨⟩)), + h₂ (Sum.inl ⟨⟩)⟩ + have := (h.presentation X).isCardinalPresentable_pt (by infer_instance) κ' le hκ' + exact isPresentable_of_isCardinalPresentable _ κ' end AreCardinalFilteredGenerators diff --git a/Mathlib/SetTheory/Cardinal/HasCardinalLT.lean b/Mathlib/SetTheory/Cardinal/HasCardinalLT.lean index 85c95a6267a4d6..c063bab7c31989 100644 --- a/Mathlib/SetTheory/Cardinal/HasCardinalLT.lean +++ b/Mathlib/SetTheory/Cardinal/HasCardinalLT.lean @@ -4,6 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.SetTheory.Cardinal.Arithmetic +import Mathlib.SetTheory.Cardinal.Cofinality /-! # The property of being of cardinality less than a cardinal @@ -86,3 +87,20 @@ lemma hasCardinalLT_option_iff (X : Type u) (κ' : Cardinal.{w}) simp only [Cardinal.mk_option, Cardinal.lift_add, Cardinal.lift_one] exact Cardinal.add_lt_of_lt (by simpa using hκ') h (lt_of_lt_of_le Cardinal.one_lt_aleph0 (by simpa using hκ')) + +/-- For any `w`-small type `X`, there exists a regular cardinal `κ : Cardinal.{w}` +such that `HasCardinalLT X κ`. -/ +lemma exists_regular_cardinal (X : Type u) [Small.{w} X] : + ∃ (κ : Cardinal.{w}), κ.IsRegular ∧ HasCardinalLT X κ := + ⟨Order.succ (max (Cardinal.mk (Shrink.{w} X)) .aleph0), + Cardinal.isRegular_succ (le_max_right _ _), by + simp [hasCardinalLT_iff_of_equiv (equivShrink.{w} X), + hasCardinalLT_iff_cardinal_mk_lt]⟩ + +/-- For any `w`-small family `X : ι → Type u` of `w`-small types, there exists +a regular cardinal`κ : Cardinal.{w}` such that `HasCardinalLT (X i) κ` for all `i : ι`. -/ +lemma exists_regular_cardinal' {ι : Type v} (X : ι → Type u) [Small.{w} ι] + [∀ i, Small.{w} (X i)] : + ∃ (κ : Cardinal.{w}), κ.IsRegular ∧ ∀ (i : ι), HasCardinalLT (X i) κ := by + obtain ⟨κ, hκ, h⟩ := exists_regular_cardinal.{w} (Sigma X) + exact ⟨κ, hκ, fun i ↦ h.of_injective _ sigma_mk_injective⟩ From 9b993a6da68de599d1efad80731a2442bd7a5910 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 27 Dec 2024 03:55:14 +0100 Subject: [PATCH 049/309] wip --- Mathlib.lean | 1 + Mathlib/CategoryTheory/Limits/Comma.lean | 18 ++ .../CardinalFilteredPresentation.lean | 31 ++- Mathlib/CategoryTheory/Presentable/Comma.lean | 209 ++++++++++++++++++ 4 files changed, 256 insertions(+), 3 deletions(-) create mode 100644 Mathlib/CategoryTheory/Presentable/Comma.lean diff --git a/Mathlib.lean b/Mathlib.lean index 5fddcdf9972a73..312a9eb8adb044 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -2083,6 +2083,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.Comma import Mathlib.CategoryTheory.Presentable.IsCardinalFiltered import Mathlib.CategoryTheory.Presentable.Limits import Mathlib.CategoryTheory.Presentable.LocallyPresentable diff --git a/Mathlib/CategoryTheory/Limits/Comma.lean b/Mathlib/CategoryTheory/Limits/Comma.lean index 93476394301e14..1c0f7eb44e00da 100644 --- a/Mathlib/CategoryTheory/Limits/Comma.lean +++ b/Mathlib/CategoryTheory/Limits/Comma.lean @@ -153,6 +153,24 @@ instance hasColimitsOfSize [HasColimitsOfSize.{w, w'} A] [HasColimitsOfSize.{w, [PreservesColimitsOfSize.{w, w'} L] : HasColimitsOfSize.{w, w'} (Comma L R) := ⟨fun _ _ => inferInstance⟩ +instance preservesColimitsOfShape_fst + [HasColimitsOfShape J A] [HasColimitsOfShape J B] + [PreservesColimitsOfShape J L] : + PreservesColimitsOfShape J (Comma.fst L R) where + preservesColimit {F} := + preservesColimit_of_preserves_colimit_cocone (h := + coconeOfPreservesIsColimit F (colimit.isColimit _) (colimit.isColimit _)) + ((colimit.isColimit _)) + +instance preservesColimitsOfShape_snd + [HasColimitsOfShape J A] [HasColimitsOfShape J B] + [PreservesColimitsOfShape J L] : + PreservesColimitsOfShape J (Comma.snd L R) where + preservesColimit {F} := + preservesColimit_of_preserves_colimit_cocone (h := + coconeOfPreservesIsColimit F (colimit.isColimit _) (colimit.isColimit _)) + ((colimit.isColimit _)) + end Comma namespace Arrow diff --git a/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean b/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean index 2509660edc9277..e7ce071f599178 100644 --- a/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean +++ b/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean @@ -11,7 +11,7 @@ import Mathlib.CategoryTheory.Presentable.Limits -/ -universe w v u +universe w v u v' u' namespace CategoryTheory @@ -31,6 +31,8 @@ namespace CardinalFilteredPresentation attribute [instance] category isCardinalFiltered +section + variable {X : C} {κ : Cardinal.{w}} [Fact κ.IsRegular] variable (p : CardinalFilteredPresentation X κ) @@ -44,10 +46,10 @@ lemma isCardinalPresentable_pt (h : ∀ (j : p.J), IsCardinalPresentable (p.F.ob fun _ ↦ isCardinalPresentable_of_le _ h exact isCardinalPresentable_of_isColimit _ p.isColimit κ' hJ -end CardinalFilteredPresentation +end @[simps J F ι isColimit] -def CardinalFilteredPresentation.ofIsColimit {J : Type w} [Category.{w} J] +def ofIsColimit {J : Type w} [Category.{w} J] {F : J ⥤ C} (c : Cocone F) (hc : IsColimit c) (κ : Cardinal.{w}) [Fact κ.IsRegular] [IsCardinalFiltered J κ] : @@ -57,6 +59,29 @@ def CardinalFilteredPresentation.ofIsColimit {J : Type w} [Category.{w} J] ι := c.ι isColimit := hc +variable {J : Type u'} [Category.{v'} J] [EssentiallySmall.{w} J] + {F : J ⥤ C} (c : Cocone F) (hc : IsColimit c) + (κ : Cardinal.{w}) [Fact κ.IsRegular] + [IsCardinalFiltered J κ] + +noncomputable def ofIsColimitOfEssentiallySmall : + CardinalFilteredPresentation c.pt κ where + isCardinalFiltered := IsCardinalFiltered.of_equivalence κ (equivSmallModel J) + J := SmallModel J + F := (equivSmallModel J).inverse ⋙ F + ι := whiskerLeft (equivSmallModel J).inverse c.ι + isColimit := + (IsColimit.whiskerEquivalenceEquiv (equivSmallModel J).symm).1 hc + +lemma ofIsColimitOfEssentiallySmall_exists_f_obj_iso + (j : (ofIsColimitOfEssentiallySmall c hc κ).J) : + ∃ (j₀ : J), Nonempty ((ofIsColimitOfEssentiallySmall c hc κ).F.obj j ≅ + F.obj j₀) := + ⟨_, ⟨Iso.refl _⟩⟩ + +end CardinalFilteredPresentation + + variable {ι : Type w} (G : ι → C) (κ : Cardinal.{w}) [Fact κ.IsRegular] structure AreCardinalFilteredGenerators : Prop where diff --git a/Mathlib/CategoryTheory/Presentable/Comma.lean b/Mathlib/CategoryTheory/Presentable/Comma.lean new file mode 100644 index 00000000000000..4594e48ced1f4a --- /dev/null +++ b/Mathlib/CategoryTheory/Presentable/Comma.lean @@ -0,0 +1,209 @@ +/- +Copyright (c) 2024 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.LocallyPresentable +import Mathlib.CategoryTheory.Limits.Comma +import Mathlib.CategoryTheory.Comma.LocallySmall + +/-! +# Comma categories are accessible + +-/ + +universe w v₁ v₂ v₃ u₁ u₂ u₃ + +namespace CategoryTheory + +open Category Limits + +namespace Comma + +variable {C₁ : Type u₁} [Category.{v₁} C₁] {C₂ : Type u₂} [Category.{v₂} C₂] + {D : Type u₃} [Category.{v₃} D] (F₁ : C₁ ⥤ D) (F₂ : C₂ ⥤ D) + +variable (κ : Cardinal.{w}) [Fact κ.IsRegular] + +variable {F₁ F₂} in +instance isCardinalPresentable_mk {X₁ : C₁} {X₂ : C₂} + [IsCardinalPresentable X₁ κ] [IsCardinalPresentable X₂ κ] + (f : F₁.obj X₁ ⟶ F₂.obj X₂) : + IsCardinalPresentable (Comma.mk _ _ f) κ := sorry + +section + +variable [IsCardinalAccessibleCategory C₁ κ] [IsCardinalAccessibleCategory C₂ κ] + [IsCardinalAccessibleCategory D κ] + [F₁.IsCardinalAccessible κ] + +instance hasCardinalFilteredColimits : + HasCardinalFilteredColimits.{w} (Comma F₁ F₂) κ where + hasColimitsOfShape J _ _ := by + have := F₁.preservesColimitsOfShape_of_isCardinalAccessible κ + infer_instance + +instance : (Comma.fst F₁ F₂).IsCardinalAccessible κ where + preservesColimitOfShape J _ _ := by + have := F₁.preservesColimitsOfShape_of_isCardinalAccessible κ + infer_instance + +instance : (Comma.snd F₁ F₂).IsCardinalAccessible κ where + preservesColimitOfShape J _ _ := by + have := F₁.preservesColimitsOfShape_of_isCardinalAccessible κ + infer_instance + +end + +namespace hasCardinalFilteredGenerators + +variable {F₁ F₂ κ} {X₁ : C₁} {X₂ : C₂} (f : F₁.obj X₁ ⟶ F₂.obj X₂) + (p₁ : CardinalFilteredPresentation.{w} X₁ κ) + (p₂ : CardinalFilteredPresentation.{w} X₂ κ) + +structure Index where + j₁ : p₁.J + j₂ : p₂.J + hom : F₁.obj (p₁.F.obj j₁) ⟶ F₂.obj (p₂.F.obj j₂) + w : hom ≫ F₂.map (p₂.ι.app j₂) = F₁.map (p₁.ι.app j₁) ≫ f + +namespace Index + +attribute [reassoc (attr := simp)] w + +variable {f p₁ p₂} + +@[ext] +structure Hom (S₁ S₂ : Index f p₁ p₂) where + m₁ : S₁.j₁ ⟶ S₂.j₁ + m₂ : S₁.j₂ ⟶ S₂.j₂ + w : S₁.hom ≫ F₂.map (p₂.F.map m₂) = F₁.map (p₁.F.map m₁) ≫ S₂.hom := by aesop_cat + +attribute [reassoc] Hom.w +attribute [local simp] Hom.w_assoc Hom.w + +instance : Category (Index f p₁ p₂) where + Hom := Hom + id S := { m₁ := 𝟙 _, m₂ := 𝟙 _} + comp φ φ' := { m₁ := φ.m₁ ≫ φ'.m₁, m₂ := φ.m₂ ≫ φ'.m₂ } + +@[simp] lemma id_m₁ (S : Index f p₁ p₂) : Hom.m₁ (𝟙 S) = 𝟙 _ := rfl +@[simp] lemma id_m₂ (S : Index f p₁ p₂) : Hom.m₂ (𝟙 S) = 𝟙 _ := rfl + +section + +variable {S₁ S₂ S₃ : Index f p₁ p₂} (φ : S₁ ⟶ S₂) (φ' : S₂ ⟶ S₃) + +@[reassoc (attr := simp)] lemma comp_m₁ : (φ ≫ φ').m₁ = φ.m₁ ≫ φ'.m₁ := rfl +@[reassoc (attr := simp)] lemma comp_m₂ : (φ ≫ φ').m₂ = φ.m₂ ≫ φ'.m₂ := rfl + +end + +end Index + +@[simps] +def functor : Index f p₁ p₂ ⥤ Comma F₁ F₂ where + obj S := Comma.mk _ _ S.hom + map {S₁ S₂} φ := + { left := p₁.F.map φ.m₁ + right := p₂.F.map φ.m₂ + w := φ.w.symm } + +@[simps] +def cocone : Cocone (functor f p₁ p₂) where + pt := Comma.mk _ _ f + ι := + { app S := + { left := p₁.ι.app S.j₁ + right := p₂.ι.app S.j₂ + w := S.w.symm } } + +instance [LocallySmall.{w} D] : Small.{w} (Index f p₁ p₂) := by + let T := Σ (j₁ : p₁.J) (j₂ : p₂.J), Shrink.{w} (F₁.obj (p₁.F.obj j₁) ⟶ F₂.obj (p₂.F.obj j₂)) + let φ : Index f p₁ p₂ → T := fun S ↦ ⟨S.j₁, S.j₂, equivShrink _ S.hom⟩ + have hφ : Function.Injective φ := by + rintro ⟨j₁, j₂, hom, _⟩ ⟨j₁', j₂', hom', _⟩ h + dsimp [φ] at h + obtain rfl : j₁ = j₁' := congr_arg Sigma.fst h + rw [Sigma.ext_iff, heq_eq_eq] at h + replace h := h.2 + obtain rfl : j₂ = j₂' := congr_arg Sigma.fst h + simpa using h + exact small_of_injective hφ + +instance [LocallySmall.{w} D] : EssentiallySmall.{w} (Index f p₁ p₂) := by + apply essentiallySmall_of_small_of_locallySmall + +instance : IsCardinalFiltered (Index f p₁ p₂) κ := sorry + +section + +variable [IsCardinalAccessibleCategory C₁ κ] [IsCardinalAccessibleCategory C₂ κ] + [IsCardinalAccessibleCategory D κ] + [F₁.IsCardinalAccessible κ] [F₂.IsCardinalAccessible κ] + +def isColimitCocone : IsColimit (cocone f p₁ p₂) := sorry + +noncomputable def cardinalFilteredPresentation : + CardinalFilteredPresentation (Comma.mk _ _ f) κ := + .ofIsColimitOfEssentiallySmall _ (isColimitCocone f p₁ p₂) κ + +end + +lemma cardinalFilteredPresentation_exists_f_obj_iso + [IsCardinalAccessibleCategory D κ] + (x : (cardinalFilteredPresentation f p₁ p₂).J) : + ∃ (j : Index f p₁ p₂), + Nonempty ((cardinalFilteredPresentation f p₁ p₂).F.obj x ≅ (functor f p₁ p₂).obj j) := + CardinalFilteredPresentation.ofIsColimitOfEssentiallySmall_exists_f_obj_iso _ _ _ _ + +end hasCardinalFilteredGenerators + +variable [IsCardinalAccessibleCategory C₁ κ] [IsCardinalAccessibleCategory C₂ κ] + [IsCardinalAccessibleCategory D κ] + [F₁.IsCardinalAccessible κ] [F₂.IsCardinalAccessible κ] + +open hasCardinalFilteredGenerators in +instance hasCardinalFilteredGenerators : + HasCardinalFilteredGenerators.{w} (Comma F₁ F₂) κ where + exists_generators' := by + obtain ⟨ι₁, G₁, h₁⟩ := HasCardinalFilteredGenerators.exists_generators C₁ κ + obtain ⟨ι₂, G₂, h₂⟩ := HasCardinalFilteredGenerators.exists_generators C₂ κ + have := h₁.isCardinalPresentable + have := h₂.isCardinalPresentable + refine ⟨Σ (i₁ : ι₁) (i₂ : ι₂), Shrink.{w} (F₁.obj (G₁ i₁) ⟶ F₂.obj (G₂ i₂)), + fun ⟨i₁, i₂, hom⟩ ↦ Comma.mk _ _ ((equivShrink _).symm hom), ?_⟩ + constructor + · rintro ⟨i₁, i₂, hom⟩ + infer_instance + · rintro ⟨X₁, X₂, hom⟩ + refine ⟨cardinalFilteredPresentation hom (h₁.presentation X₁) (h₂.presentation X₂), + ?_⟩ + intro j + let Z := (cardinalFilteredPresentation hom (h₁.presentation X₁) + (h₂.presentation X₂)).F.obj j + obtain ⟨S, ⟨e : Z ≅ _⟩⟩ := cardinalFilteredPresentation_exists_f_obj_iso _ _ _ j + obtain ⟨i₁, ⟨e₁⟩⟩ := h₁.exists_presentation_obj_iso X₁ S.j₁ + obtain ⟨i₂, ⟨e₂⟩⟩ := h₂.exists_presentation_obj_iso X₂ S.j₂ + let α : F₁.obj (G₁ i₁) ⟶ F₂.obj (G₂ i₂) := + F₁.map (e₁.inv ≫ e.inv.left) ≫ Z.hom ≫ F₂.map (e.hom.right ≫ e₂.hom) + refine ⟨⟨i₁, i₂, equivShrink _ + (F₁.map (e₁.inv ≫ e.inv.left) ≫ Z.hom ≫ F₂.map (e.hom.right ≫ e₂.hom))⟩, + ⟨isoMk ((Comma.fst _ _).mapIso e ≪≫ e₁) ((Comma.snd _ _).mapIso e ≪≫ e₂) ?_⟩⟩ + dsimp + simp only [Functor.map_comp, Category.assoc, CommaMorphism.w_assoc, functor_obj_left, + functor_obj_right, functor_obj_hom, Equiv.symm_apply_apply, Iso.map_hom_inv_id_assoc] + have := e.hom.w + dsimp at this + rw [reassoc_of% this, ← F₂.map_comp_assoc e.inv.right, ← comp_right, + e.inv_hom_id] + dsimp + rw [F₂.map_id, id_comp] + +instance isCardinalAccessibleCategory : + IsCardinalAccessibleCategory (Comma F₁ F₂) κ where + +end Comma + +end CategoryTheory From bebe433bbca83e7d7ecc4349bb7e7305df854509 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 27 Dec 2024 04:02:09 +0100 Subject: [PATCH 050/309] wip --- Mathlib/CategoryTheory/Presentable/Comma.lean | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Mathlib/CategoryTheory/Presentable/Comma.lean b/Mathlib/CategoryTheory/Presentable/Comma.lean index 4594e48ced1f4a..b7c0565aa3045f 100644 --- a/Mathlib/CategoryTheory/Presentable/Comma.lean +++ b/Mathlib/CategoryTheory/Presentable/Comma.lean @@ -160,6 +160,8 @@ lemma cardinalFilteredPresentation_exists_f_obj_iso end hasCardinalFilteredGenerators +section + variable [IsCardinalAccessibleCategory C₁ κ] [IsCardinalAccessibleCategory C₂ κ] [IsCardinalAccessibleCategory D κ] [F₁.IsCardinalAccessible κ] [F₂.IsCardinalAccessible κ] @@ -204,6 +206,18 @@ instance hasCardinalFilteredGenerators : instance isCardinalAccessibleCategory : IsCardinalAccessibleCategory (Comma F₁ F₂) κ where +end + +section + +variable [IsCardinalLocallyPresentable C₁ κ] [IsCardinalLocallyPresentable C₂ κ] + [IsCardinalLocallyPresentable D κ] [PreservesColimitsOfSize.{w, w} F₁] + +instance isCardinalLocallyPresentable : + IsCardinalLocallyPresentable (Comma F₁ F₂) κ where + +end + end Comma end CategoryTheory From 8b9474ef921b89b205a764fee613f38143aafdff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 27 Dec 2024 06:07:08 +0100 Subject: [PATCH 051/309] wip --- .../CardinalFilteredPresentation.lean | 3 ++ Mathlib/CategoryTheory/Presentable/Comma.lean | 28 +++++++++++++++++-- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean b/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean index e7ce071f599178..5d609f59c078ad 100644 --- a/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean +++ b/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean @@ -37,6 +37,9 @@ variable {X : C} {κ : Cardinal.{w}} [Fact κ.IsRegular] variable (p : CardinalFilteredPresentation X κ) +instance isFiltered : IsFiltered p.J := by + apply isFiltered_of_isCardinalDirected _ κ + lemma isCardinalPresentable_pt (h : ∀ (j : p.J), IsCardinalPresentable (p.F.obj j) κ) [LocallySmall.{w} C] (κ' : Cardinal.{w}) [Fact κ'.IsRegular] (h : κ ≤ κ') diff --git a/Mathlib/CategoryTheory/Presentable/Comma.lean b/Mathlib/CategoryTheory/Presentable/Comma.lean index b7c0565aa3045f..d952b63e919731 100644 --- a/Mathlib/CategoryTheory/Presentable/Comma.lean +++ b/Mathlib/CategoryTheory/Presentable/Comma.lean @@ -6,6 +6,7 @@ Authors: Joël Riou import Mathlib.CategoryTheory.Presentable.LocallyPresentable import Mathlib.CategoryTheory.Limits.Comma +import Mathlib.CategoryTheory.Limits.Final import Mathlib.CategoryTheory.Comma.LocallySmall /-! @@ -28,9 +29,12 @@ variable (κ : Cardinal.{w}) [Fact κ.IsRegular] variable {F₁ F₂} in instance isCardinalPresentable_mk {X₁ : C₁} {X₂ : C₂} + [IsCardinalPresentable X₁ κ] [IsCardinalPresentable X₂ κ] [IsCardinalPresentable X₁ κ] [IsCardinalPresentable X₂ κ] (f : F₁.obj X₁ ⟶ F₂.obj X₂) : - IsCardinalPresentable (Comma.mk _ _ f) κ := sorry + IsCardinalPresentable (Comma.mk _ _ f) κ := by + -- need that `F₁` (and `F₂` ?) preserve κ-presentable objects + sorry section @@ -100,6 +104,18 @@ variable {S₁ S₂ S₃ : Index f p₁ p₂} (φ : S₁ ⟶ S₂) (φ' : S₂ end +variable (f p₁ p₂) + +@[simps] +def π₁ : Index f p₁ p₂ ⥤ p₁.J where + obj S := S.j₁ + map φ := φ.m₁ + +@[simps] +def π₂ : Index f p₁ p₂ ⥤ p₂.J where + obj S := S.j₂ + map φ := φ.m₂ + end Index @[simps] @@ -137,13 +153,21 @@ instance [LocallySmall.{w} D] : EssentiallySmall.{w} (Index f p₁ p₂) := by instance : IsCardinalFiltered (Index f p₁ p₂) κ := sorry +instance : IsFiltered (Index f p₁ p₂) := by + apply isFiltered_of_isCardinalDirected _ κ + +instance : (Index.π₁ f p₁ p₂).Final := sorry + +instance : (Index.π₂ f p₁ p₂).Final := sorry + section variable [IsCardinalAccessibleCategory C₁ κ] [IsCardinalAccessibleCategory C₂ κ] [IsCardinalAccessibleCategory D κ] [F₁.IsCardinalAccessible κ] [F₂.IsCardinalAccessible κ] -def isColimitCocone : IsColimit (cocone f p₁ p₂) := sorry +def isColimitCocone : IsColimit (cocone f p₁ p₂) := by + sorry noncomputable def cardinalFilteredPresentation : CardinalFilteredPresentation (Comma.mk _ _ f) κ := From a300a0998545901f161932dffdd24d0dbfe3cb7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 11 Sep 2025 01:11:25 +0200 Subject: [PATCH 052/309] wip --- Mathlib.lean | 1 + Mathlib/CategoryTheory/ExtremalEpi.lean | 74 ++++++++ .../Generator/StrongGenerator.lean | 174 ++++++++++++++++++ 3 files changed, 249 insertions(+) create mode 100644 Mathlib/CategoryTheory/ExtremalEpi.lean create mode 100644 Mathlib/CategoryTheory/Generator/StrongGenerator.lean diff --git a/Mathlib.lean b/Mathlib.lean index 8194c06bf2b695..1c47fe5e412873 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -2267,6 +2267,7 @@ import Mathlib.CategoryTheory.Generator.Indization import Mathlib.CategoryTheory.Generator.Preadditive import Mathlib.CategoryTheory.Generator.Presheaf import Mathlib.CategoryTheory.Generator.Sheaf +import Mathlib.CategoryTheory.Generator.StrongGenerator import Mathlib.CategoryTheory.GlueData import Mathlib.CategoryTheory.GradedObject import Mathlib.CategoryTheory.GradedObject.Associator diff --git a/Mathlib/CategoryTheory/ExtremalEpi.lean b/Mathlib/CategoryTheory/ExtremalEpi.lean new file mode 100644 index 00000000000000..37067cff8ac079 --- /dev/null +++ b/Mathlib/CategoryTheory/ExtremalEpi.lean @@ -0,0 +1,74 @@ +/- +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.Subobject.Lattice +import Mathlib.CategoryTheory.Limits.Shapes.StrongEpi + +/-! +# Extremal epimorphisms + +An extremal epimorphism `p : X ⟶ Y` is an epimorphism which does not factor +through any proper subobject of `Y`. In case the category has equalizers, +we show that a morphism `p : X ⟶ Y` which does not factor through +any proper subobject of `Y` is automatically an epimorphism, and also +an extremal epimorphism. We also show that a strong epimorphism +is an extremal epimorphism, and the both notions coincide when +the category has pullbacks. + +## References + +* https://ncatlab.org/nlab/show/extremal+epimorphism + +-/ + +universe v u + +namespace CategoryTheory + +open Limits + +variable {C : Type u} [Category.{v} C] {X Y : C} + +/-- An extremal epimorphism `f : X ⟶ Y` is an epimorphism which does not +factor through any proper subobject of `Y`. -/ +class ExtremalEpi (f : X ⟶ Y) : Prop extends Epi f where + isIso (f) {Z : C} (p : X ⟶ Z) (i : Z ⟶ Y) (fac : p ≫ i = f) [Mono i] : IsIso i + +variable (f : X ⟶ Y) + +lemma ExtremalEpi.subobject_eq_top [ExtremalEpi f] + {A : Subobject Y} (hA : Subobject.Factors A f) : A = ⊤ := by + rw [← Subobject.isIso_arrow_iff_eq_top] + exact isIso f (Subobject.factorThru A f hA) _ (by simp) + +lemma ExtremalEpi.mk_of_hasEqualizers [HasEqualizers C] + (hf : ∀ ⦃Z : C⦄ (p : X ⟶ Z) (i : Z ⟶ Y) (_ : p ≫ i = f) [Mono i], IsIso i) : + ExtremalEpi f where + left_cancellation {Z} p q h := by + have := hf (equalizer.lift f h) (equalizer.ι p q) (by simp) + rw [← cancel_epi (equalizer.ι p q), equalizer.condition] + isIso := by tauto + +instance [StrongEpi f] : ExtremalEpi f where + isIso {Z} p i fac _ := by + have sq : CommSq p f i (𝟙 Y) := { } + exact ⟨sq.lift, by simp [← cancel_mono i], by simp⟩ + +lemma extremalEpi_iff_strongEpi_of_hasPullbacks [HasPullbacks C] : + ExtremalEpi f ↔ StrongEpi f := by + refine ⟨fun _ ↦ ⟨inferInstance, fun A B i _ ↦ ⟨fun {t b} sq ↦ ⟨⟨?_⟩⟩⟩⟩, + fun _ ↦ inferInstance⟩ + have := ExtremalEpi.isIso f (pullback.lift _ _ sq.w) + (pullback.snd _ _) (by simp) + refine + { l := inv (pullback.snd i b) ≫ pullback.fst _ _ + fac_left := by + rw [← cancel_mono i, sq.w, Category.assoc, Category.assoc] + congr 1 + rw [← cancel_epi (pullback.snd i b), IsIso.hom_inv_id_assoc, + pullback.condition] + fac_right := by simp [pullback.condition] } + +end CategoryTheory diff --git a/Mathlib/CategoryTheory/Generator/StrongGenerator.lean b/Mathlib/CategoryTheory/Generator/StrongGenerator.lean new file mode 100644 index 00000000000000..9fa79e1c718f79 --- /dev/null +++ b/Mathlib/CategoryTheory/Generator/StrongGenerator.lean @@ -0,0 +1,174 @@ +/- +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.ExtremalEpi +import Mathlib.CategoryTheory.Generator.Basic + +/-! +# Strong generators + +-/ + +universe w v u + +namespace CategoryTheory + +open Limits + +variable {C : Type u} [Category.{v} C] (S : Set C) + +def IsStrongGenerator : Prop := + IsSeparating S ∧ ∀ ⦃X : C⦄ (A : Subobject X), + (∀ (G : S) (f : G.1 ⟶ X), Subobject.Factors A f) → A = ⊤ + +variable {S} + +lemma isStrongGenerator_iff : + IsStrongGenerator S ↔ IsSeparating S ∧ + ∀ ⦃X Y : C⦄ (i : X ⟶ Y) [Mono i], + (∀ (G : S), Function.Surjective (fun (f : G.1 ⟶ X) ↦ f ≫ i)) → IsIso i := by + refine ⟨fun ⟨hS₁, hS₂⟩ ↦ ⟨hS₁, fun X Y i _ h ↦ ?_⟩, + fun ⟨hS₁, hS₂⟩ ↦ ⟨hS₁, fun X A hA ↦ ?_⟩⟩ + · rw [Subobject.isIso_iff_mk_eq_top] + refine hS₂ _ (fun G g ↦ ?_) + rw [Subobject.mk_factors_iff] + exact h G g + · rw [← Subobject.isIso_arrow_iff_eq_top] + exact hS₂ A.arrow (fun G g ↦ ⟨_, Subobject.factorThru_arrow _ _ (hA G g)⟩) + +namespace IsStrongGenerator + +section + +variable (hS : IsStrongGenerator S) + +include hS + +lemma isSeparating : IsSeparating S := hS.1 + +lemma subobject_eq_top {X : C} {A : Subobject X} + (hA : ∀ (G : S) (f : G.1 ⟶ X), Subobject.Factors A f) : + A = ⊤ := + hS.2 _ hA + +lemma isIso_of_mono ⦃X Y : C⦄ (i : X ⟶ Y) [Mono i] + (hi : ∀ (G : S), Function.Surjective (fun (f : G.1 ⟶ X) ↦ f ≫ i)) : IsIso i := + (isStrongGenerator_iff.1 hS).2 i hi + +lemma exists_of_subobject_ne_top {X : C} {A : Subobject X} (hA : A ≠ ⊤) : + ∃ (G : S) (f : G.1 ⟶ X), ¬ Subobject.Factors A f := by + by_contra! + exact hA (hS.subobject_eq_top this) + +lemma exists_of_mono_not_isIso {X Y : C} (i : X ⟶ Y) [Mono i] (hi : ¬ IsIso i) : + ∃ (G : S) (g : G.1 ⟶ Y), ∀ (f : G.1 ⟶ X), f ≫ i ≠ g := by + by_contra! + exact hi (hS.isIso_of_mono i this) + +end + +end IsStrongGenerator + +section + +variable (S) [HasCoproducts.{w} C] [LocallySmall.{w} C] [Small.{w} S] (X : C) + +abbrev coproductOfSet.obj (p : Σ (s : S), s.1 ⟶ X) : C := p.1.1 + +lemma coproductOfSet.hasColimit : + HasColimit (Discrete.functor (coproductOfSet.obj S X)) := + hasColimit_of_equivalence_comp + (Discrete.equivalence (equivShrink.{w} _)).symm + +noncomputable def coproductOfSet (X : C) : C := + have := coproductOfSet.hasColimit S X + ∐ (coproductOfSet.obj S X) + +namespace coproductOfSet + +noncomputable def π (X : C) : coproductOfSet S X ⟶ X := + have := coproductOfSet.hasColimit S X + Sigma.desc (fun p ↦ p.2) + +section + +variable {S} {X : C} (s : S) (f : s.1 ⟶ X) + +noncomputable def ι : s.1 ⟶ coproductOfSet S X := + have := coproductOfSet.hasColimit S X + Sigma.ι (coproductOfSet.obj S X) ⟨s, f⟩ + +@[reassoc (attr := simp)] +lemma ι_π : ι s f ≫ π S X = f := by simp [ι, π] + +end + +end coproductOfSet + +end + +namespace IsSeparating + +variable {S : Set C} + +lemma epi_coproductOfSetπ (hS : IsSeparating S) + [HasCoproducts.{w} C] [LocallySmall.{w} C] [Small.{w} S] (X : C) : + Epi (coproductOfSet.π S X) where + left_cancellation {Z} f g h := + hS _ _ (fun G hG p ↦ by simpa using coproductOfSet.ι ⟨_, hG⟩ p ≫= h) + +lemma mk_of_exists_epi + (hS : ∀ (X : C), ∃ (ι : Type w) (s : ι → S) (c : Cofan (fun i ↦ (s i).1)) (_ : IsColimit c) + (p : c.pt ⟶ X), Epi p) : + IsSeparating S := by + intro X Y f g h + obtain ⟨ι, s, c, hc, p, _⟩ := hS X + rw [← cancel_epi p] + exact Cofan.IsColimit.hom_ext hc _ _ + (fun i ↦ by simpa using h _ (s i).2 (c.inj i ≫ p)) + +end IsSeparating + +namespace IsStrongGenerator + +variable {S : Set C} + +lemma extremalEpi_coproductOfSetπ + (hS : IsStrongGenerator S) [HasCoproducts.{w} C] [LocallySmall.{w} C] + [Small.{w} S] (X : C) : + ExtremalEpi (coproductOfSet.π S X) where + toEpi := hS.isSeparating.epi_coproductOfSetπ X + isIso {Z} p i fac _ := hS.isIso_of_mono _ + (fun G f ↦ ⟨coproductOfSet.ι G f ≫ p, by simp [fac]⟩) + +lemma mk_of_exists_extremalEpi + (hS : ∀ (X : C), ∃ (ι : Type w) (s : ι → S) (c : Cofan (fun i ↦ (s i).1)) (_ : IsColimit c) + (p : c.pt ⟶ X), ExtremalEpi p) : + IsStrongGenerator S := by + rw [isStrongGenerator_iff] + refine ⟨IsSeparating.mk_of_exists_epi.{w} (fun X ↦ ?_), fun X Y i _ hi ↦ ?_⟩ + · obtain ⟨ι, s, c, hc, p, _⟩ := hS X + exact ⟨ι, s, c, hc, p, inferInstance⟩ + · obtain ⟨ι, s, c, hc, p, _⟩ := hS Y + replace hi (j : ι) := hi (s j) (c.inj j ≫ p) + choose φ hφ using hi + exact ExtremalEpi.isIso p (Cofan.IsColimit.desc hc φ) _ + (Cofan.IsColimit.hom_ext hc _ _ (by simp [hφ])) + +end IsStrongGenerator + +lemma isStrongGenerator_iff_exists_extremalEpi + [HasCoproducts.{w} C] [LocallySmall.{w} C] [Small.{w} S] : + IsStrongGenerator S ↔ + ∀ (X : C), ∃ (ι : Type w) (s : ι → S) (c : Cofan (fun i ↦ (s i).1)) (_ : IsColimit c) + (p : c.pt ⟶ X), ExtremalEpi p := by + refine ⟨fun hS X ↦ ?_, fun hS ↦ .mk_of_exists_extremalEpi hS⟩ + have := coproductOfSet.hasColimit S X + exact ⟨_, fun j ↦ ((equivShrink (Σ (s : S), s.1 ⟶ X)).symm j).1, _, + (colimit.isColimit (Discrete.functor (coproductOfSet.obj S X))).whiskerEquivalence + ((Discrete.equivalence (equivShrink.{w} _))).symm, _, + hS.extremalEpi_coproductOfSetπ X⟩ + +end CategoryTheory From 7ceaabebd3f4c46a30b5dcffdb3caa79932b41e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 11 Sep 2025 01:25:36 +0200 Subject: [PATCH 053/309] docstring --- .../Generator/StrongGenerator.lean | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/Mathlib/CategoryTheory/Generator/StrongGenerator.lean b/Mathlib/CategoryTheory/Generator/StrongGenerator.lean index 9fa79e1c718f79..f31aaa0d5f5c4d 100644 --- a/Mathlib/CategoryTheory/Generator/StrongGenerator.lean +++ b/Mathlib/CategoryTheory/Generator/StrongGenerator.lean @@ -9,6 +9,20 @@ import Mathlib.CategoryTheory.Generator.Basic /-! # Strong generators +A set of objects `S` in a category `C` is a strong generator if it is a +generator (in the sense that `IsSeparating S` holds) such that for any +proper subject `A ⊂ X`, there exists a morphism `G ⟶ X` from an +object in `S` which does not factor through `A`. + +The main result if the lemma `isStrongGenerator_iff_exists_extremalEpi` which +says that if `S` is `w`-small, `C` is locally `w`-small and +has coproducts of size `w`, then `S` is a strong generator iff any +object of `C` is the target of extremal epimorphism from a coproduct of +objects in `S`. A similar iff lemma for `IsSeparating` is also obtained. + +## References +* [Adámek, J. and Rosický, J., *Locally presentable and accessible categories*][Adamek_Rosicky_1994] + -/ universe w v u @@ -19,6 +33,9 @@ open Limits variable {C : Type u} [Category.{v} C] (S : Set C) +/-- A set of objects is a strong generator if it is separating and for any +proper subject `A ⊂ X`, there exists a morphism `G ⟶ X` from an +object in `S` which does not factor through `A`. -/ def IsStrongGenerator : Prop := IsSeparating S ∧ ∀ ⦃X : C⦄ (A : Subobject X), (∀ (G : S) (f : G.1 ⟶ X), Subobject.Factors A f) → A = ⊤ @@ -75,6 +92,8 @@ section variable (S) [HasCoproducts.{w} C] [LocallySmall.{w} C] [Small.{w} S] (X : C) +/-- Given `S : Set C` and `X : C`, this is the family of source objects +in the family of all maps `G ⟶ X` with `G ∈ S`. -/ abbrev coproductOfSet.obj (p : Σ (s : S), s.1 ⟶ X) : C := p.1.1 lemma coproductOfSet.hasColimit : @@ -82,12 +101,15 @@ lemma coproductOfSet.hasColimit : hasColimit_of_equivalence_comp (Discrete.equivalence (equivShrink.{w} _)).symm +/-- Given `S : Set C` and `X : C`, this is the coproduct of +`G` indexed by the type of all maps `G ⟶ X` with `G ∈ S`. -/ noncomputable def coproductOfSet (X : C) : C := have := coproductOfSet.hasColimit S X ∐ (coproductOfSet.obj S X) namespace coproductOfSet +/-- The canonical morphism `coproductOfSet S X ⟶ X`. -/ noncomputable def π (X : C) : coproductOfSet S X ⟶ X := have := coproductOfSet.hasColimit S X Sigma.desc (fun p ↦ p.2) @@ -96,6 +118,7 @@ section variable {S} {X : C} (s : S) (f : s.1 ⟶ X) +/-- The inclusion morphisms in the coproduct `coproductOfSet S X`. -/ noncomputable def ι : s.1 ⟶ coproductOfSet S X := have := coproductOfSet.hasColimit S X Sigma.ι (coproductOfSet.obj S X) ⟨s, f⟩ @@ -131,6 +154,18 @@ lemma mk_of_exists_epi end IsSeparating +lemma isSeparating_iff_exists_epi + [HasCoproducts.{w} C] [LocallySmall.{w} C] [Small.{w} S] : + IsSeparating S ↔ + ∀ (X : C), ∃ (ι : Type w) (s : ι → S) (c : Cofan (fun i ↦ (s i).1)) (_ : IsColimit c) + (p : c.pt ⟶ X), Epi p := by + refine ⟨fun hS X ↦ ?_, fun hS ↦ .mk_of_exists_epi hS⟩ + have := coproductOfSet.hasColimit S X + exact ⟨_, fun j ↦ ((equivShrink (Σ (s : S), s.1 ⟶ X)).symm j).1, _, + (colimit.isColimit (Discrete.functor (coproductOfSet.obj S X))).whiskerEquivalence + ((Discrete.equivalence (equivShrink.{w} _))).symm, _, + hS.epi_coproductOfSetπ X⟩ + namespace IsStrongGenerator variable {S : Set C} From f0e932e6d98b8ebbacd07b6d4f1fbd7084ea02c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 11 Sep 2025 01:32:07 +0200 Subject: [PATCH 054/309] typos --- Mathlib/CategoryTheory/Generator/StrongGenerator.lean | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Mathlib/CategoryTheory/Generator/StrongGenerator.lean b/Mathlib/CategoryTheory/Generator/StrongGenerator.lean index f31aaa0d5f5c4d..521a7bb8a5bfed 100644 --- a/Mathlib/CategoryTheory/Generator/StrongGenerator.lean +++ b/Mathlib/CategoryTheory/Generator/StrongGenerator.lean @@ -11,7 +11,7 @@ import Mathlib.CategoryTheory.Generator.Basic A set of objects `S` in a category `C` is a strong generator if it is a generator (in the sense that `IsSeparating S` holds) such that for any -proper subject `A ⊂ X`, there exists a morphism `G ⟶ X` from an +proper subobject `A ⊂ X`, there exists a morphism `G ⟶ X` from an object in `S` which does not factor through `A`. The main result if the lemma `isStrongGenerator_iff_exists_extremalEpi` which @@ -34,7 +34,7 @@ open Limits variable {C : Type u} [Category.{v} C] (S : Set C) /-- A set of objects is a strong generator if it is separating and for any -proper subject `A ⊂ X`, there exists a morphism `G ⟶ X` from an +proper subobject `A ⊂ X`, there exists a morphism `G ⟶ X` from an object in `S` which does not factor through `A`. -/ def IsStrongGenerator : Prop := IsSeparating S ∧ ∀ ⦃X : C⦄ (A : Subobject X), @@ -134,8 +134,6 @@ end namespace IsSeparating -variable {S : Set C} - lemma epi_coproductOfSetπ (hS : IsSeparating S) [HasCoproducts.{w} C] [LocallySmall.{w} C] [Small.{w} S] (X : C) : Epi (coproductOfSet.π S X) where @@ -168,8 +166,6 @@ lemma isSeparating_iff_exists_epi namespace IsStrongGenerator -variable {S : Set C} - lemma extremalEpi_coproductOfSetπ (hS : IsStrongGenerator S) [HasCoproducts.{w} C] [LocallySmall.{w} C] [Small.{w} S] (X : C) : From 6904a8f7290547345bcf5183ce811278fc1a51e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 11 Sep 2025 01:37:56 +0200 Subject: [PATCH 055/309] typos --- Mathlib/CategoryTheory/ExtremalEpi.lean | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Mathlib/CategoryTheory/ExtremalEpi.lean b/Mathlib/CategoryTheory/ExtremalEpi.lean index 37067cff8ac079..53fc71bd5269c7 100644 --- a/Mathlib/CategoryTheory/ExtremalEpi.lean +++ b/Mathlib/CategoryTheory/ExtremalEpi.lean @@ -14,7 +14,7 @@ through any proper subobject of `Y`. In case the category has equalizers, we show that a morphism `p : X ⟶ Y` which does not factor through any proper subobject of `Y` is automatically an epimorphism, and also an extremal epimorphism. We also show that a strong epimorphism -is an extremal epimorphism, and the both notions coincide when +is an extremal epimorphism, and that both notions coincide when the category has pullbacks. ## References @@ -62,7 +62,7 @@ lemma extremalEpi_iff_strongEpi_of_hasPullbacks [HasPullbacks C] : fun _ ↦ inferInstance⟩ have := ExtremalEpi.isIso f (pullback.lift _ _ sq.w) (pullback.snd _ _) (by simp) - refine + exact { l := inv (pullback.snd i b) ≫ pullback.fst _ _ fac_left := by rw [← cancel_mono i, sq.w, Category.assoc, Category.assoc] From f2d5360623fe7fe384ca3a2c4919b1b037d4b8ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 11 Sep 2025 01:42:37 +0200 Subject: [PATCH 056/309] fix --- .../CategoryTheory/Generator/StrongGenerator.lean | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Mathlib/CategoryTheory/Generator/StrongGenerator.lean b/Mathlib/CategoryTheory/Generator/StrongGenerator.lean index 521a7bb8a5bfed..0b823bf30a60b1 100644 --- a/Mathlib/CategoryTheory/Generator/StrongGenerator.lean +++ b/Mathlib/CategoryTheory/Generator/StrongGenerator.lean @@ -96,22 +96,22 @@ variable (S) [HasCoproducts.{w} C] [LocallySmall.{w} C] [Small.{w} S] (X : C) in the family of all maps `G ⟶ X` with `G ∈ S`. -/ abbrev coproductOfSet.obj (p : Σ (s : S), s.1 ⟶ X) : C := p.1.1 -lemma coproductOfSet.hasColimit : - HasColimit (Discrete.functor (coproductOfSet.obj S X)) := +lemma coproductOfSet.hasCoproduct : + HasCoproduct (coproductOfSet.obj S X) := hasColimit_of_equivalence_comp (Discrete.equivalence (equivShrink.{w} _)).symm /-- Given `S : Set C` and `X : C`, this is the coproduct of `G` indexed by the type of all maps `G ⟶ X` with `G ∈ S`. -/ noncomputable def coproductOfSet (X : C) : C := - have := coproductOfSet.hasColimit S X + have := coproductOfSet.hasCoproduct S X ∐ (coproductOfSet.obj S X) namespace coproductOfSet /-- The canonical morphism `coproductOfSet S X ⟶ X`. -/ noncomputable def π (X : C) : coproductOfSet S X ⟶ X := - have := coproductOfSet.hasColimit S X + have := coproductOfSet.hasCoproduct S X Sigma.desc (fun p ↦ p.2) section @@ -120,7 +120,7 @@ variable {S} {X : C} (s : S) (f : s.1 ⟶ X) /-- The inclusion morphisms in the coproduct `coproductOfSet S X`. -/ noncomputable def ι : s.1 ⟶ coproductOfSet S X := - have := coproductOfSet.hasColimit S X + have := coproductOfSet.hasCoproduct S X Sigma.ι (coproductOfSet.obj S X) ⟨s, f⟩ @[reassoc (attr := simp)] @@ -158,7 +158,7 @@ lemma isSeparating_iff_exists_epi ∀ (X : C), ∃ (ι : Type w) (s : ι → S) (c : Cofan (fun i ↦ (s i).1)) (_ : IsColimit c) (p : c.pt ⟶ X), Epi p := by refine ⟨fun hS X ↦ ?_, fun hS ↦ .mk_of_exists_epi hS⟩ - have := coproductOfSet.hasColimit S X + have := coproductOfSet.hasCoproduct S X exact ⟨_, fun j ↦ ((equivShrink (Σ (s : S), s.1 ⟶ X)).symm j).1, _, (colimit.isColimit (Discrete.functor (coproductOfSet.obj S X))).whiskerEquivalence ((Discrete.equivalence (equivShrink.{w} _))).symm, _, @@ -196,7 +196,7 @@ lemma isStrongGenerator_iff_exists_extremalEpi ∀ (X : C), ∃ (ι : Type w) (s : ι → S) (c : Cofan (fun i ↦ (s i).1)) (_ : IsColimit c) (p : c.pt ⟶ X), ExtremalEpi p := by refine ⟨fun hS X ↦ ?_, fun hS ↦ .mk_of_exists_extremalEpi hS⟩ - have := coproductOfSet.hasColimit S X + have := coproductOfSet.hasCoproduct S X exact ⟨_, fun j ↦ ((equivShrink (Σ (s : S), s.1 ⟶ X)).symm j).1, _, (colimit.isColimit (Discrete.functor (coproductOfSet.obj S X))).whiskerEquivalence ((Discrete.equivalence (equivShrink.{w} _))).symm, _, From e4b10d1aaabfe53e1c40c8f6fff02c676c719a9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 11 Sep 2025 10:06:26 +0200 Subject: [PATCH 057/309] feat(CategoryTheory): a set S of objects is a strong generator if any object is a colimit of objects in S --- .../Generator/StrongGenerator.lean | 45 +++++++++++++++++++ .../CardinalFilteredPresentation.lean | 13 +++++- 2 files changed, 56 insertions(+), 2 deletions(-) diff --git a/Mathlib/CategoryTheory/Generator/StrongGenerator.lean b/Mathlib/CategoryTheory/Generator/StrongGenerator.lean index 0b823bf30a60b1..bebebb879c9f32 100644 --- a/Mathlib/CategoryTheory/Generator/StrongGenerator.lean +++ b/Mathlib/CategoryTheory/Generator/StrongGenerator.lean @@ -5,6 +5,7 @@ Authors: Joël Riou -/ import Mathlib.CategoryTheory.ExtremalEpi import Mathlib.CategoryTheory.Generator.Basic +import Mathlib.CategoryTheory.Limits.Presentation /-! # Strong generators @@ -20,6 +21,9 @@ has coproducts of size `w`, then `S` is a strong generator iff any object of `C` is the target of extremal epimorphism from a coproduct of objects in `S`. A similar iff lemma for `IsSeparating` is also obtained. +We also show that if any object in `C` is a colimit of objects in `S`, +then `S` is a strong generator. + ## References * [Adámek, J. and Rosický, J., *Locally presentable and accessible categories*][Adamek_Rosicky_1994] @@ -202,4 +206,45 @@ lemma isStrongGenerator_iff_exists_extremalEpi ((Discrete.equivalence (equivShrink.{w} _))).symm, _, hS.extremalEpi_coproductOfSetπ X⟩ +section + +variable (hS : ∀ (X : C), ∃ (J : Type w) (_ : SmallCategory J) + (p : ColimitPresentation J X), ∀ (j : J), ∃ (G : S), Nonempty (p.diag.obj j ≅ G.1)) + +include hS + +lemma IsSeparating.mk_of_exists_colimitPresentation : + IsSeparating S := by + intro X Y f g h + obtain ⟨J, _, p, hp⟩ := hS X + choose t ht using hp + let e (j : J) := (ht j).some + refine p.isColimit.hom_ext (fun j ↦ ?_) + rw [← cancel_epi (e j).inv] + simpa only [Category.assoc] using h _ (t j).2 ((e j).inv ≫ p.ι.app j) + +lemma IsStrongGenerator.mk_of_exists_colimitPresentation : + IsStrongGenerator S := by + rw [isStrongGenerator_iff] + refine ⟨IsSeparating.mk_of_exists_colimitPresentation hS, + fun X Y i _ hi ↦ ?_⟩ + suffices ∃ (r : Y ⟶ X), r ≫ i = 𝟙 Y by + obtain ⟨r, fac⟩ := this + exact ⟨r, by simp [← cancel_mono i, fac], fac⟩ + obtain ⟨J, _, p, hp⟩ := hS Y + have (j : J) : ∃ (l : p.diag.obj j ⟶ X), l ≫ i = p.ι.app j := by + obtain ⟨G, ⟨e⟩⟩ := hp j + obtain ⟨l, hl⟩ := hi G (e.inv ≫ p.ι.app j) + exact ⟨e.hom ≫ l, by simp [hl]⟩ + choose φ hφ using this + let c : Cocone p.diag := Cocone.mk _ + { app := φ + naturality j₁ j₂ f := by simp [← cancel_mono i, hφ] } + refine ⟨p.isColimit.desc c, p.isColimit.hom_ext (fun j ↦ ?_)⟩ + have := p.isColimit.fac c j + dsimp [c] at this ⊢ + rw [reassoc_of% this, hφ, Category.comp_id] + +end + end CategoryTheory diff --git a/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean b/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean index 1c5007f138f6ec..0cceed7e1ff836 100644 --- a/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean +++ b/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean @@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.CategoryTheory.Presentable.Limits -import Mathlib.CategoryTheory.Limits.Presentation +import Mathlib.CategoryTheory.Generator.StrongGenerator /-! # Presentable generators @@ -16,7 +16,8 @@ this property says that the objects `G i` are all `κ`-presentable and that any object in `C` identifies as a `κ`-filtered colimit of these objects. We show in the lemma `AreCardinalFilteredGenerators.presentable` that it follows that any object `X` is presentable (relatively to a possibly -larger regular cardinal `κ'`). +larger regular cardinal `κ'`). The lemma `AreCardinalFilteredGenerators.isStrongGenerator` +shows that the objects `G i` form a strong generator of the category `C`. Finally, we define a typeclass `HasCardinalFilteredGenerators C κ` saying that `C` is locally `w`-small and that there exists a family `G : ι → C` @@ -115,6 +116,14 @@ lemma presentable [LocallySmall.{w} C] (X : C) : IsPresentable.{w} X := by have := (h.colimitPresentation X).isCardinalPresentable κ (by infer_instance) κ' le hκ' exact isPresentable_of_isCardinalPresentable _ κ' +include h in +lemma isStrongGenerator : + IsStrongGenerator (Set.range G) := + .mk_of_exists_colimitPresentation (fun X ↦ by + refine ⟨_, _, h.colimitPresentation X, fun j ↦ ?_⟩ + obtain ⟨i, ⟨e⟩⟩ := h.exists_colimitPresentation_diag_obj_iso X j + exact ⟨⟨_, i, rfl⟩, ⟨e⟩⟩) + end AreCardinalFilteredGenerators end From 10f039a5914791baaae9c6ba717237a1b5f0d3e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 11 Sep 2025 10:09:15 +0200 Subject: [PATCH 058/309] fix --- Mathlib.lean | 1 + 1 file changed, 1 insertion(+) diff --git a/Mathlib.lean b/Mathlib.lean index 1c47fe5e412873..ab83d8c8eefaa0 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -2205,6 +2205,7 @@ import Mathlib.CategoryTheory.Equivalence.Symmetry import Mathlib.CategoryTheory.EssentialImage import Mathlib.CategoryTheory.EssentiallySmall import Mathlib.CategoryTheory.Extensive +import Mathlib.CategoryTheory.ExtremalEpi import Mathlib.CategoryTheory.FiberedCategory.BasedCategory import Mathlib.CategoryTheory.FiberedCategory.Cartesian import Mathlib.CategoryTheory.FiberedCategory.Cocartesian From 40705228cce558d4c4f9d3f3f17ac8af7a1a9222 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 11 Sep 2025 10:09:29 +0200 Subject: [PATCH 059/309] fix --- Mathlib.lean | 1 + 1 file changed, 1 insertion(+) diff --git a/Mathlib.lean b/Mathlib.lean index 1c47fe5e412873..ab83d8c8eefaa0 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -2205,6 +2205,7 @@ import Mathlib.CategoryTheory.Equivalence.Symmetry import Mathlib.CategoryTheory.EssentialImage import Mathlib.CategoryTheory.EssentiallySmall import Mathlib.CategoryTheory.Extensive +import Mathlib.CategoryTheory.ExtremalEpi import Mathlib.CategoryTheory.FiberedCategory.BasedCategory import Mathlib.CategoryTheory.FiberedCategory.Cartesian import Mathlib.CategoryTheory.FiberedCategory.Cocartesian From 22d6d1ddf4962ccbc384dcb13b916585ae0ad689 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 11 Sep 2025 13:54:18 +0200 Subject: [PATCH 060/309] feat(CategoryTheory): canonical colimits --- Mathlib.lean | 1 + Mathlib/CategoryTheory/Limits/Canonical.lean | 71 ++++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 Mathlib/CategoryTheory/Limits/Canonical.lean diff --git a/Mathlib.lean b/Mathlib.lean index 8194c06bf2b695..ca1a9ffb2b264a 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -2309,6 +2309,7 @@ import Mathlib.CategoryTheory.LiftingProperties.Basic import Mathlib.CategoryTheory.LiftingProperties.Limits import Mathlib.CategoryTheory.LiftingProperties.ParametrizedAdjunction import Mathlib.CategoryTheory.Limits.Bicones +import Mathlib.CategoryTheory.Limits.Canonical import Mathlib.CategoryTheory.Limits.ColimitLimit import Mathlib.CategoryTheory.Limits.Comma import Mathlib.CategoryTheory.Limits.ConcreteCategory.Basic diff --git a/Mathlib/CategoryTheory/Limits/Canonical.lean b/Mathlib/CategoryTheory/Limits/Canonical.lean new file mode 100644 index 00000000000000..ff7fd3f588848f --- /dev/null +++ b/Mathlib/CategoryTheory/Limits/Canonical.lean @@ -0,0 +1,71 @@ +/- +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.Limits.IsLimit +import Mathlib.CategoryTheory.Comma.StructuredArrow.Basic + +/-! +# Canonical colimits + +Given a functor `F : C ⥤ D` and `Y : D`, we say that `Y` is a +canonical colimit relatively to `F` is `Y` identifies to the +colimit of all `F.obj X` for `X : C` and `f : F.obj X ⟶ Y`, +i.e. `Y` identifies to the colimit of the obvious functor +`CostructuredArrow F Y ⥤ D` (see definitions `canonicalCocone` +and `CanonicalColimit`). We introduce the corresponding property +`isCanonicalColimit F` of objects of `D`. + +## TODO + +* formalize dense subcategories +* show the presheaves of types are canonical colimits relatively +to the Yoneda embedding + +## References +* https://ncatlab.org/nlab/show/dense+functor + +-/ + +universe v₁ v₂ u₁ u₂ + +namespace CategoryTheory + +open Limits + +variable {C : Type u₁} {D : Type u₂} [Category.{v₁} C] [Category.{v₂} D] + (F : C ⥤ D) + +namespace Limits + +/-- Given a functor `F : C ⥤ D` and `Y : D`, this is the canonical cocone +with point `Y` for the functor +`CostructuredArrow.proj F Y ⋙ F : CostructuredArrow F Y ⥤ D`. -/ +@[simps] +def canonicalCocone (Y : D) : + Cocone (CostructuredArrow.proj F Y ⋙ F) where + pt := Y + ι := { app f := f.hom } + +/-- An object `Y : D` is a canonical colimit relatively to `F : C ⥤ D` +when `canonicalCocone F Y` is colimit, i.e. `Y` identifies to the +colimit of all `F.obj X` for `X : C` and `f : F.obj X ⟶ Y`. -/ +abbrev CanonicalColimit (Y : D) : Type _ := IsColimit (canonicalCocone F Y) + +end Limits + +/-- Given a functor `F : C ⥤ D`, this is the property that an object `Y : D` +is a canonical colimit relatively to `F`, i.e. `Y` identifies to the +colimit of all `F.obj X` for `X : C` and `f : F.obj X ⟶ Y`. -/ +def Functor.isCanonicalColimit : ObjectProperty D := + fun Y ↦ Nonempty (CanonicalColimit F Y) + +variable {F} in +lemma Functor.isCanonicalColimit.hom_ext + {Y : D} (hY : F.isCanonicalColimit Y) + {T : D} {f g : Y ⟶ T} + (h : ∀ (X : C) (p : F.obj X ⟶ Y), p ≫ f = p ≫ g) : f = g := + hY.some.hom_ext (fun _ ↦ h _ _) + +end CategoryTheory From 6f3b53ee3f90732ab34d16a019c168575ab07fba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 11 Sep 2025 22:31:08 +0200 Subject: [PATCH 061/309] feat(CategoryTheory): dense functors --- Mathlib.lean | 1 + Mathlib/CategoryTheory/Functor/Dense.lean | 107 +++++++++++++++++++ Mathlib/CategoryTheory/Limits/Canonical.lean | 16 ++- 3 files changed, 119 insertions(+), 5 deletions(-) create mode 100644 Mathlib/CategoryTheory/Functor/Dense.lean diff --git a/Mathlib.lean b/Mathlib.lean index ca1a9ffb2b264a..28956ce5866166 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -2230,6 +2230,7 @@ import Mathlib.CategoryTheory.Functor.Category import Mathlib.CategoryTheory.Functor.Const import Mathlib.CategoryTheory.Functor.Currying import Mathlib.CategoryTheory.Functor.CurryingThree +import Mathlib.CategoryTheory.Functor.Dense import Mathlib.CategoryTheory.Functor.Derived.Adjunction import Mathlib.CategoryTheory.Functor.Derived.LeftDerived import Mathlib.CategoryTheory.Functor.Derived.PointwiseRightDerived diff --git a/Mathlib/CategoryTheory/Functor/Dense.lean b/Mathlib/CategoryTheory/Functor/Dense.lean new file mode 100644 index 00000000000000..f3bb11c9219066 --- /dev/null +++ b/Mathlib/CategoryTheory/Functor/Dense.lean @@ -0,0 +1,107 @@ +/- +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.Limits.Canonical +import Mathlib.CategoryTheory.Limits.Presheaf + +/-! +# Dense functors + +A functor `F : C ⥤ D` is dense if any `Y : D` is a canonical colimit +relatively to `F`. When `F` is full, we show that this is equivalent +to saysing that the restricted Yoneda functor +`D ⥤ Cᵒᵖ ⥤ Type _` is fully faithful. + +## Main definitions + +* The typeclass `Functor.IsDense` +* The lemma `Functor.isDense_iff_fullyFaithful_restrictedULiftYoneda` + +## References + +* https://ncatlab.org/nlab/show/dense+subcategory + +-/ + +universe w v₁ v₂ u₁ u₂ + +namespace CategoryTheory + +open Limits Opposite Presheaf + +variable {C : Type u₁} {D : Type u₂} [Category.{v₁} C] [Category.{v₂} D] + +namespace Functor + +/-- A functor `F : C ⥤ D` is dense if any `Y : D` is a canonical colimit +relatively to `F`. -/ +class IsDense (F : C ⥤ D) : Prop where + isCanonicalColimit_eq_top (F) : F.isCanonicalColimit = ⊤ + +/-- This is a choice of structure `CanonicalColimit F Y` when `F : C ⥤ D` +is dense, and `Y : D`. -/ +noncomputable def canonicalColimitOfIsDense (F : C ⥤ D) [F.IsDense] (Y : D) : + CanonicalColimit F Y := + ((IsDense.isCanonicalColimit_eq_top F).symm.le _ (by simp)).canonicalColimit + +variable (F : C ⥤ D) + +instance [F.IsDense] : (restrictedULiftYoneda.{w} F).Faithful where + map_injective h := + (canonicalColimitOfIsDense F _).hom_ext' (fun X p ↦ + ULift.up_injective (congr_fun (NatTrans.congr_app h (op X)) (ULift.up p))) + +instance [F.IsDense] : (restrictedULiftYoneda.{w} F).Full where + map_surjective {Y Z} f := by + let c : Cocone (CostructuredArrow.proj F Y ⋙ F) := + { pt := Z + ι := + { app g := ((f.app (op g.left)) (ULift.up g.hom)).down + naturality g₁ g₂ φ := by + simpa [uliftFunctor, uliftYoneda, + restrictedULiftYoneda, ← ULift.down_inj] using + (congr_fun (f.naturality φ.left.op) (ULift.up g₂.hom)).symm }} + refine ⟨(canonicalColimitOfIsDense F Y).desc c, ?_⟩ + ext ⟨X⟩ ⟨x⟩ + exact ULift.down_injective ((canonicalColimitOfIsDense F Y).fac c (.mk x)) + +variable {F} in +lemma IsDense.of_fullyFaithful_restrictedULiftYoneda [F.Full] + (h : (restrictedULiftYoneda.{w} F).FullyFaithful) : + F.IsDense where + isCanonicalColimit_eq_top := by + ext Y + simp only [Pi.top_apply, «Prop».top_eq_true, iff_true] + let φ (s : Cocone (CostructuredArrow.proj F Y ⋙ F)) : + (restrictedULiftYoneda.{w} F).obj Y ⟶ (restrictedULiftYoneda F).obj s.pt := + { app := fun ⟨X⟩ ⟨x⟩ ↦ ULift.up (s.ι.app (.mk x)) + naturality := by + rintro ⟨X₁⟩ ⟨X₂⟩ ⟨f⟩ + ext ⟨x⟩ + let α : CostructuredArrow.mk (F.map f ≫ x) ⟶ CostructuredArrow.mk x := + CostructuredArrow.homMk f + simp [uliftYoneda, ← s.w α, α] } + have hφ (s) (j) : (restrictedULiftYoneda F).map j.hom ≫ φ s = + (restrictedULiftYoneda F).map (s.ι.app j) := by + ext ⟨X⟩ ⟨x⟩ + let α : .mk (x ≫ j.hom) ⟶ j := CostructuredArrow.homMk (F.preimage x) + have := s.w α + dsimp [uliftYoneda, φ, α] at this ⊢ + rw [← this, map_preimage] + exact + ⟨{desc s := (h.preimage (φ s)) + fac s j := h.map_injective (by simp [hφ]) + uniq s m hm := h.map_injective (by + ext ⟨X⟩ ⟨x⟩ + simp [uliftYoneda, φ, ← hm] ) }⟩ + +lemma isDense_iff_fullyFaithful_restrictedULiftYoneda [F.Full] : + F.IsDense ↔ Nonempty (restrictedULiftYoneda.{w} F).FullyFaithful := + ⟨fun _ ↦ ⟨FullyFaithful.ofFullyFaithful _⟩, + fun ⟨h⟩ ↦ IsDense.of_fullyFaithful_restrictedULiftYoneda h⟩ + +end Functor + +end CategoryTheory diff --git a/Mathlib/CategoryTheory/Limits/Canonical.lean b/Mathlib/CategoryTheory/Limits/Canonical.lean index ff7fd3f588848f..03825e999cf835 100644 --- a/Mathlib/CategoryTheory/Limits/Canonical.lean +++ b/Mathlib/CategoryTheory/Limits/Canonical.lean @@ -53,6 +53,12 @@ when `canonicalCocone F Y` is colimit, i.e. `Y` identifies to the colimit of all `F.obj X` for `X : C` and `f : F.obj X ⟶ Y`. -/ abbrev CanonicalColimit (Y : D) : Type _ := IsColimit (canonicalCocone F Y) +variable {F} in +lemma CanonicalColimit.hom_ext' + {Y : D} (hY : CanonicalColimit F Y) {T : D} {f g : Y ⟶ T} + (h : ∀ (X : C) (p : F.obj X ⟶ Y), p ≫ f = p ≫ g) : f = g := + hY.hom_ext (fun _ ↦ h _ _) + end Limits /-- Given a functor `F : C ⥤ D`, this is the property that an object `Y : D` @@ -62,10 +68,10 @@ def Functor.isCanonicalColimit : ObjectProperty D := fun Y ↦ Nonempty (CanonicalColimit F Y) variable {F} in -lemma Functor.isCanonicalColimit.hom_ext - {Y : D} (hY : F.isCanonicalColimit Y) - {T : D} {f g : Y ⟶ T} - (h : ∀ (X : C) (p : F.obj X ⟶ Y), p ≫ f = p ≫ g) : f = g := - hY.some.hom_ext (fun _ ↦ h _ _) +/-- When `Y : D` is a canonical colimit relatively to `F`, +this is a choice of structure `CanonicalColimit F Y`. -/ +noncomputable def Functor.isCanonicalColimit.canonicalColimit + {Y : D} (hY : F.isCanonicalColimit Y) : + CanonicalColimit F Y := hY.some end CategoryTheory From 3621cdf41d64ca125e2cbd20662ce973d45e184e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 11 Sep 2025 22:32:59 +0200 Subject: [PATCH 062/309] wip --- Mathlib/CategoryTheory/Functor/Dense.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Functor/Dense.lean b/Mathlib/CategoryTheory/Functor/Dense.lean index f3bb11c9219066..13c7ab7693f762 100644 --- a/Mathlib/CategoryTheory/Functor/Dense.lean +++ b/Mathlib/CategoryTheory/Functor/Dense.lean @@ -11,7 +11,7 @@ import Mathlib.CategoryTheory.Limits.Presheaf A functor `F : C ⥤ D` is dense if any `Y : D` is a canonical colimit relatively to `F`. When `F` is full, we show that this is equivalent -to saysing that the restricted Yoneda functor +to saying that the restricted Yoneda functor `D ⥤ Cᵒᵖ ⥤ Type _` is fully faithful. ## Main definitions From 67b9b21059d7c0a9eb0b58feb727824a5cc7da4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 11 Sep 2025 23:28:33 +0200 Subject: [PATCH 063/309] isStrongGenerator_range_of_isDense --- Mathlib/CategoryTheory/Functor/Dense.lean | 24 +++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/Mathlib/CategoryTheory/Functor/Dense.lean b/Mathlib/CategoryTheory/Functor/Dense.lean index 13c7ab7693f762..909c6710500698 100644 --- a/Mathlib/CategoryTheory/Functor/Dense.lean +++ b/Mathlib/CategoryTheory/Functor/Dense.lean @@ -5,19 +5,19 @@ Authors: Joël Riou -/ import Mathlib.CategoryTheory.Limits.Canonical import Mathlib.CategoryTheory.Limits.Presheaf +import Mathlib.CategoryTheory.Generator.StrongGenerator /-! # Dense functors -A functor `F : C ⥤ D` is dense if any `Y : D` is a canonical colimit -relatively to `F`. When `F` is full, we show that this is equivalent -to saying that the restricted Yoneda functor -`D ⥤ Cᵒᵖ ⥤ Type _` is fully faithful. +A functor `F : C ⥤ D` is dense (`F.IsDense`) if any `Y : D` is a +canonical colimit relatively to `F`. When `F` is full, we show that this +is equivalent to saying that the restricted Yoneda functor +`D ⥤ Cᵒᵖ ⥤ Type _` is fully faithful (see the lemma +`Functor.isDense_iff_fullyFaithful_restrictedULiftYoneda`). -## Main definitions - -* The typeclass `Functor.IsDense` -* The lemma `Functor.isDense_iff_fullyFaithful_restrictedULiftYoneda` +We also show that the range of a dense functor is a strong +generator (see `Functor.isStrongGenerator_range_of_isDense`). ## References @@ -102,6 +102,14 @@ lemma isDense_iff_fullyFaithful_restrictedULiftYoneda [F.Full] : ⟨fun _ ↦ ⟨FullyFaithful.ofFullyFaithful _⟩, fun ⟨h⟩ ↦ IsDense.of_fullyFaithful_restrictedULiftYoneda h⟩ +lemma isStrongGenerator_range_of_isDense [F.IsDense] : + IsStrongGenerator (Set.range F.obj) := + IsStrongGenerator.mk_of_exists_colimitPresentation.{max u₁ u₂ v₁ v₂} + (fun Y ↦ ⟨_, _, ColimitPresentation.mk _ _ + (IsColimit.whiskerEquivalence (canonicalColimitOfIsDense F Y) + ((ShrinkHoms.equivalence _).symm.trans ((Shrink.equivalence _)).symm)), + fun j ↦ ⟨⟨_, by simp⟩, ⟨Iso.refl _⟩⟩⟩) + end Functor end CategoryTheory 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 064/309] 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 065/309] 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 066/309] 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 067/309] 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 068/309] 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 069/309] 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 070/309] 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 071/309] 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 072/309] 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 073/309] 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 074/309] 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 075/309] 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 076/309] 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 077/309] 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 078/309] 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 079/309] 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 080/309] 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 081/309] 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 082/309] 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 083/309] 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 084/309] 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 085/309] 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 086/309] 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 087/309] 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 088/309] 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 089/309] 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 090/309] 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 091/309] 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 092/309] 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 093/309] 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 094/309] 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 095/309] 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 096/309] 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 097/309] 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 27e78755d9bf1fcaa87a356aa5e61d5c7247f508 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 16:00:25 +0200 Subject: [PATCH 098/309] Update Mathlib/CategoryTheory/Limits/Canonical.lean --- Mathlib/CategoryTheory/Limits/Canonical.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Limits/Canonical.lean b/Mathlib/CategoryTheory/Limits/Canonical.lean index ff7fd3f588848f..d7dbb757568783 100644 --- a/Mathlib/CategoryTheory/Limits/Canonical.lean +++ b/Mathlib/CategoryTheory/Limits/Canonical.lean @@ -10,7 +10,7 @@ import Mathlib.CategoryTheory.Comma.StructuredArrow.Basic # Canonical colimits Given a functor `F : C ⥤ D` and `Y : D`, we say that `Y` is a -canonical colimit relatively to `F` is `Y` identifies to the +canonical colimit relatively to `F` if `Y` identifies to the colimit of all `F.obj X` for `X : C` and `f : F.obj X ⟶ Y`, i.e. `Y` identifies to the colimit of the obvious functor `CostructuredArrow F Y ⥤ D` (see definitions `canonicalCocone` 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 099/309] 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 100/309] 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 101/309] 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 102/309] 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 103/309] 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 104/309] 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 105/309] 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 00cd1a8867395ebf562ed60762d72f923192216f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sun, 5 Oct 2025 18:12:55 +0200 Subject: [PATCH 106/309] typo --- Mathlib/CategoryTheory/Generator/StrongGenerator.lean | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Mathlib/CategoryTheory/Generator/StrongGenerator.lean b/Mathlib/CategoryTheory/Generator/StrongGenerator.lean index 0b823bf30a60b1..efd0fcd21ec38c 100644 --- a/Mathlib/CategoryTheory/Generator/StrongGenerator.lean +++ b/Mathlib/CategoryTheory/Generator/StrongGenerator.lean @@ -14,10 +14,10 @@ generator (in the sense that `IsSeparating S` holds) such that for any proper subobject `A ⊂ X`, there exists a morphism `G ⟶ X` from an object in `S` which does not factor through `A`. -The main result if the lemma `isStrongGenerator_iff_exists_extremalEpi` which +The main result is the lemma `isStrongGenerator_iff_exists_extremalEpi` which says that if `S` is `w`-small, `C` is locally `w`-small and has coproducts of size `w`, then `S` is a strong generator iff any -object of `C` is the target of extremal epimorphism from a coproduct of +object of `C` is the target of an extremal epimorphism from a coproduct of objects in `S`. A similar iff lemma for `IsSeparating` is also obtained. ## References From 9a0751d25533db972f207d423eb054f6e3e9e7c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Mon, 6 Oct 2025 15:59:30 +0200 Subject: [PATCH 107/309] refactor(CategoryTheory/Generator): use ObjectProperty --- Mathlib.lean | 1 + Mathlib/CategoryTheory/Generator/Basic.lean | 324 +++++++++++------- .../CategoryTheory/ObjectProperty/Basic.lean | 36 ++ .../ObjectProperty/Opposite.lean | 76 ++++ 4 files changed, 320 insertions(+), 117 deletions(-) create mode 100644 Mathlib/CategoryTheory/ObjectProperty/Opposite.lean diff --git a/Mathlib.lean b/Mathlib.lean index 985f244b4c64f4..afc86a026ab940 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -2668,6 +2668,7 @@ import Mathlib.CategoryTheory.ObjectProperty.Extensions import Mathlib.CategoryTheory.ObjectProperty.FullSubcategory import Mathlib.CategoryTheory.ObjectProperty.Ind 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/Generator/Basic.lean b/Mathlib/CategoryTheory/Generator/Basic.lean index 6e3bc206804f39..f74bc6ae173673 100644 --- a/Mathlib/CategoryTheory/Generator/Basic.lean +++ b/Mathlib/CategoryTheory/Generator/Basic.lean @@ -6,6 +6,7 @@ Authors: Markus Himmel import Mathlib.CategoryTheory.Limits.EssentiallySmall import Mathlib.CategoryTheory.Limits.Opposites import Mathlib.CategoryTheory.Subobject.Lattice +import Mathlib.CategoryTheory.ObjectProperty.Opposite import Mathlib.Data.Set.Opposite /-! @@ -14,10 +15,12 @@ import Mathlib.Data.Set.Opposite There are several non-equivalent notions of a generator of a category. Here, we consider two of them: -* We say that `𝒢` is a separating set if the functors `C(G, -)` for `G ∈ 𝒢` are collectively - faithful, i.e., if `h ≫ f = h ≫ g` for all `h` with domain in `𝒢` implies `f = g`. -* We say that `𝒢` is a detecting set if the functors `C(G, -)` collectively reflect isomorphisms, - i.e., if any `h` with domain in `𝒢` uniquely factors through `f`, then `f` is an isomorphism. +* We say that `P : ObjectProperty C` is a separating set if the functors `C(G, -)` + for `G` such that `P G` are collectively faithful, i.e., if + `h ≫ f = h ≫ g` for all `h` with domain satisfying `P` implies `f = g`. +* We say that `P : ObjectProperty C` is a detecting set if the functors `C(G, -)` + collectively reflect isomorphisms, i.e., if any `h` with domain satisfying `P` + uniquely factors through `f`, then `f` is an isomorphism. There are, of course, also the dual notions of coseparating and codetecting sets. @@ -25,7 +28,7 @@ There are, of course, also the dual notions of coseparating and codetecting sets We * define predicates `IsSeparating`, `IsCoseparating`, `IsDetecting` and `IsCodetecting` on - sets of objects; + `ObjectProperty C`; * show that equivalences of categories preserves these notions; * show that separating and coseparating are dual notions; * show that detecting and codetecting are dual notions; @@ -45,9 +48,9 @@ We * define corresponding typeclasses `HasSeparator`, `HasCoseparator`, `HasDetector` and `HasCodetector` on categories and prove analogous results for these. -## Future work +## Examples -* We currently don't have any examples yet. +See the files `CategoryTheory.Generator.Presheaf` and `CategoryTheory.Generator.Sheaf`. -/ @@ -60,143 +63,161 @@ namespace CategoryTheory variable {C : Type u₁} [Category.{v₁} C] {D : Type u₂} [Category.{v₂} D] -/-- We say that `𝒢` is a separating set if the functors `C(G, -)` for `G ∈ 𝒢` are collectively - faithful, i.e., if `h ≫ f = h ≫ g` for all `h` with domain in `𝒢` implies `f = g`. -/ -def IsSeparating (𝒢 : Set C) : Prop := - ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), (∀ G ∈ 𝒢, ∀ (h : G ⟶ X), h ≫ f = h ≫ g) → f = g - -/-- We say that `𝒢` is a coseparating set if the functors `C(-, G)` for `G ∈ 𝒢` are collectively - faithful, i.e., if `f ≫ h = g ≫ h` for all `h` with codomain in `𝒢` implies `f = g`. -/ -def IsCoseparating (𝒢 : Set C) : Prop := - ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), (∀ G ∈ 𝒢, ∀ (h : Y ⟶ G), f ≫ h = g ≫ h) → f = g - -/-- We say that `𝒢` is a detecting set if the functors `C(G, -)` collectively reflect isomorphisms, - i.e., if any `h` with domain in `𝒢` uniquely factors through `f`, then `f` is an isomorphism. -/ -def IsDetecting (𝒢 : Set C) : Prop := - ∀ ⦃X Y : C⦄ (f : X ⟶ Y), (∀ G ∈ 𝒢, ∀ (h : G ⟶ Y), ∃! h' : G ⟶ X, h' ≫ f = h) → IsIso f - -/-- We say that `𝒢` is a codetecting set if the functors `C(-, G)` collectively reflect - isomorphisms, i.e., if any `h` with codomain in `G` uniquely factors through `f`, then `f` is - an isomorphism. -/ -def IsCodetecting (𝒢 : Set C) : Prop := - ∀ ⦃X Y : C⦄ (f : X ⟶ Y), (∀ G ∈ 𝒢, ∀ (h : X ⟶ G), ∃! h' : Y ⟶ G, f ≫ h' = h) → IsIso f +namespace ObjectProperty + +variable (P : ObjectProperty C) + +/-- We say that `P : ObjectProperty C` is a separating set if the functors `C(G, -)` +for `G : C` such that `P G` are collectively faithful, +i.e., if `h ≫ f = h ≫ g` for all `h` with domain in `𝒢` implies `f = g`. -/ +def IsSeparating : Prop := + ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), (∀ (G : C) (_ : P G) (h : G ⟶ X), h ≫ f = h ≫ g) → f = g + +/-- We say that `P : ObjectProperty C` is a coseparating set if the functors `C(-, G)` +for `G : C` such that `P G` are collectively faithful, +i.e., if `f ≫ h = g ≫ h` for all `h` with codomain in `𝒢` implies `f = g`. -/ +def IsCoseparating : Prop := + ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), (∀ (G : C) (_ : P G) (h : Y ⟶ G), f ≫ h = g ≫ h) → f = g + +/-- We say that `P : ObjectProperty C` is a detecting set if the functors `C(G, -)` +for `G : C` such that `P G` collectively reflect isomorphisms, +i.e., if any `h` with domain `G` that `P G` uniquely factors through `f`, +then `f` is an isomorphism. -/ +def IsDetecting : Prop := + ∀ ⦃X Y : C⦄ (f : X ⟶ Y), (∀ (G : C) (_ : P G), + ∀ (h : G ⟶ Y), ∃! h' : G ⟶ X, h' ≫ f = h) → IsIso f + +/-- We say that `P : ObjectProperty C` is a codetecting set if the functors `C(-, G)` +for `G : C` such that `P G` collectively reflect isomorphisms, +i.e., if any `h` with codomain `G` such that `P G` uniquely factors through `f`, +then `f` is an isomorphism. -/ +def IsCodetecting : Prop := + ∀ ⦃X Y : C⦄ (f : X ⟶ Y), (∀ (G : C) (_ : P G), + ∀ (h : X ⟶ G), ∃! h' : Y ⟶ G, f ≫ h' = h) → IsIso f section Equivalence +variable {P} + lemma IsSeparating.of_equivalence - {𝒢 : Set C} (h : IsSeparating 𝒢) {D : Type*} [Category D] (α : C ≌ D) : - IsSeparating (α.functor.obj '' 𝒢) := fun X Y f g H => + (h : IsSeparating P) {D : Type*} [Category D] (α : C ≌ D) : + IsSeparating (P.map α.functor) := fun X Y f g H => α.inverse.map_injective (h _ _ (fun Z hZ h => by obtain ⟨h', rfl⟩ := (α.toAdjunction.homEquiv _ _).surjective h simp only [Adjunction.homEquiv_unit, Category.assoc, ← Functor.map_comp, - H (α.functor.obj Z) (Set.mem_image_of_mem _ hZ) h'])) + H _ (P.prop_map_obj _ hZ) h'])) lemma IsCoseparating.of_equivalence - {𝒢 : Set C} (h : IsCoseparating 𝒢) {D : Type*} [Category D] (α : C ≌ D) : - IsCoseparating (α.functor.obj '' 𝒢) := fun X Y f g H => + (h : IsCoseparating P) {D : Type*} [Category D] (α : C ≌ D) : + IsCoseparating (P.map α.functor) := fun X Y f g H => α.inverse.map_injective (h _ _ (fun Z hZ h => by obtain ⟨h', rfl⟩ := (α.symm.toAdjunction.homEquiv _ _).symm.surjective h - simp only [Adjunction.homEquiv_symm_apply, ← Category.assoc, ← Functor.map_comp, - Equivalence.symm_functor, H (α.functor.obj Z) (Set.mem_image_of_mem _ hZ) h'])) + simp only [Equivalence.symm_inverse, Equivalence.symm_functor, + Adjunction.homEquiv_counit, ← Functor.map_comp_assoc, + H _ (P.prop_map_obj _ hZ) h'])) end Equivalence section Dual -theorem isSeparating_op_iff (𝒢 : Set C) : IsSeparating 𝒢.op ↔ IsCoseparating 𝒢 := by - refine ⟨fun h𝒢 X Y f g hfg => ?_, fun h𝒢 X Y f g hfg => ?_⟩ - · refine Quiver.Hom.op_inj (h𝒢 _ _ fun G hG h => Quiver.Hom.unop_inj ?_) - simpa only [unop_comp, Quiver.Hom.unop_op] using hfg _ (Set.mem_op.1 hG) _ - · refine Quiver.Hom.unop_inj (h𝒢 _ _ fun G hG h => Quiver.Hom.op_inj ?_) - simpa only [op_comp, Quiver.Hom.op_unop] using hfg _ (Set.op_mem_op.2 hG) _ - -theorem isCoseparating_op_iff (𝒢 : Set C) : IsCoseparating 𝒢.op ↔ IsSeparating 𝒢 := by - refine ⟨fun h𝒢 X Y f g hfg => ?_, fun h𝒢 X Y f g hfg => ?_⟩ - · refine Quiver.Hom.op_inj (h𝒢 _ _ fun G hG h => Quiver.Hom.unop_inj ?_) - simpa only [unop_comp, Quiver.Hom.unop_op] using hfg _ (Set.mem_op.1 hG) _ - · refine Quiver.Hom.unop_inj (h𝒢 _ _ fun G hG h => Quiver.Hom.op_inj ?_) - simpa only [op_comp, Quiver.Hom.op_unop] using hfg _ (Set.op_mem_op.2 hG) _ - -theorem isCoseparating_unop_iff (𝒢 : Set Cᵒᵖ) : IsCoseparating 𝒢.unop ↔ IsSeparating 𝒢 := by - rw [← isSeparating_op_iff, Set.unop_op] - -theorem isSeparating_unop_iff (𝒢 : Set Cᵒᵖ) : IsSeparating 𝒢.unop ↔ IsCoseparating 𝒢 := by - rw [← isCoseparating_op_iff, Set.unop_op] - -theorem isDetecting_op_iff (𝒢 : Set C) : IsDetecting 𝒢.op ↔ IsCodetecting 𝒢 := by - refine ⟨fun h𝒢 X Y f hf => ?_, fun h𝒢 X Y f hf => ?_⟩ - · refine (isIso_op_iff _).1 (h𝒢 _ fun G hG h => ?_) - obtain ⟨t, ht, ht'⟩ := hf (unop G) (Set.mem_op.1 hG) h.unop +theorem isSeparating_op_iff : IsSeparating P.op ↔ IsCoseparating P := by + refine ⟨fun hP X Y f g hfg => ?_, fun hP X Y f g hfg => ?_⟩ + · refine Quiver.Hom.op_inj (hP _ _ fun G hG h => Quiver.Hom.unop_inj ?_) + simpa only [unop_comp, Quiver.Hom.unop_op] using hfg _ hG _ + · refine Quiver.Hom.unop_inj (hP _ _ fun G hG h => Quiver.Hom.op_inj ?_) + simpa only [op_comp, Quiver.Hom.op_unop] using hfg _ hG _ + +theorem isCoseparating_op_iff : IsCoseparating P.op ↔ IsSeparating P := by + refine ⟨fun hP X Y f g hfg => ?_, fun hP X Y f g hfg => ?_⟩ + · refine Quiver.Hom.op_inj (hP _ _ fun G hG h => Quiver.Hom.unop_inj ?_) + simpa only [unop_comp, Quiver.Hom.unop_op] using hfg _ hG _ + · refine Quiver.Hom.unop_inj (hP _ _ fun G hG h => Quiver.Hom.op_inj ?_) + simpa only [op_comp, Quiver.Hom.op_unop] using hfg _ hG _ + +theorem isCoseparating_unop_iff (P : ObjectProperty Cᵒᵖ) : + IsCoseparating P.unop ↔ IsSeparating P := + P.unop.isSeparating_op_iff.symm + +theorem isSeparating_unop_iff (P : ObjectProperty Cᵒᵖ) : + IsSeparating P.unop ↔ IsCoseparating P := + P.unop.isCoseparating_op_iff.symm + +theorem isDetecting_op_iff : IsDetecting P.op ↔ IsCodetecting P := by + refine ⟨fun hP X Y f hf => ?_, fun hP X Y f hf => ?_⟩ + · refine (isIso_op_iff _).1 (hP _ fun G hG h => ?_) + obtain ⟨t, ht, ht'⟩ := hf (unop G) hG h.unop exact ⟨t.op, Quiver.Hom.unop_inj ht, fun y hy => Quiver.Hom.unop_inj (ht' _ (Quiver.Hom.op_inj hy))⟩ - · refine (isIso_unop_iff _).1 (h𝒢 _ fun G hG h => ?_) - obtain ⟨t, ht, ht'⟩ := hf (op G) (Set.op_mem_op.2 hG) h.op + · refine (isIso_unop_iff _).1 (hP _ fun G hG h => ?_) + obtain ⟨t, ht, ht'⟩ := hf (op G) hG h.op refine ⟨t.unop, Quiver.Hom.op_inj ht, fun y hy => Quiver.Hom.op_inj (ht' _ ?_)⟩ exact Quiver.Hom.unop_inj (by simpa only using hy) -theorem isCodetecting_op_iff (𝒢 : Set C) : IsCodetecting 𝒢.op ↔ IsDetecting 𝒢 := by - refine ⟨fun h𝒢 X Y f hf => ?_, fun h𝒢 X Y f hf => ?_⟩ - · refine (isIso_op_iff _).1 (h𝒢 _ fun G hG h => ?_) - obtain ⟨t, ht, ht'⟩ := hf (unop G) (Set.mem_op.1 hG) h.unop +theorem isCodetecting_op_iff : IsCodetecting P.op ↔ IsDetecting P := by + refine ⟨fun hP X Y f hf => ?_, fun hP X Y f hf => ?_⟩ + · refine (isIso_op_iff _).1 (hP _ fun G hG h => ?_) + obtain ⟨t, ht, ht'⟩ := hf (unop G) hG h.unop exact ⟨t.op, Quiver.Hom.unop_inj ht, fun y hy => Quiver.Hom.unop_inj (ht' _ (Quiver.Hom.op_inj hy))⟩ - · refine (isIso_unop_iff _).1 (h𝒢 _ fun G hG h => ?_) - obtain ⟨t, ht, ht'⟩ := hf (op G) (Set.op_mem_op.2 hG) h.op + · refine (isIso_unop_iff _).1 (hP _ fun G hG h => ?_) + obtain ⟨t, ht, ht'⟩ := hf (op G) hG h.op refine ⟨t.unop, Quiver.Hom.op_inj ht, fun y hy => Quiver.Hom.op_inj (ht' _ ?_)⟩ exact Quiver.Hom.unop_inj (by simpa only using hy) -theorem isDetecting_unop_iff (𝒢 : Set Cᵒᵖ) : IsDetecting 𝒢.unop ↔ IsCodetecting 𝒢 := by - rw [← isCodetecting_op_iff, Set.unop_op] +theorem isDetecting_unop_iff (P : ObjectProperty Cᵒᵖ) : IsDetecting P.unop ↔ IsCodetecting P := + P.unop.isCodetecting_op_iff.symm -theorem isCodetecting_unop_iff {𝒢 : Set Cᵒᵖ} : IsCodetecting 𝒢.unop ↔ IsDetecting 𝒢 := by - rw [← isDetecting_op_iff, Set.unop_op] +theorem isCodetecting_unop_iff (P : ObjectProperty Cᵒᵖ) : IsCodetecting P.unop ↔ IsDetecting P := + P.unop.isDetecting_op_iff.symm end Dual -theorem IsDetecting.isSeparating [HasEqualizers C] {𝒢 : Set C} (h𝒢 : IsDetecting 𝒢) : - IsSeparating 𝒢 := fun _ _ f g hfg => - have : IsIso (equalizer.ι f g) := h𝒢 _ fun _ hG _ => equalizer.existsUnique _ (hfg _ hG _) +variable {P} + +theorem IsDetecting.isSeparating [HasEqualizers C] (hP : IsDetecting P) : + IsSeparating P := fun _ _ f g hfg => + have : IsIso (equalizer.ι f g) := hP _ fun _ hG _ => equalizer.existsUnique _ (hfg _ hG _) eq_of_epi_equalizer -theorem IsCodetecting.isCoseparating [HasCoequalizers C] {𝒢 : Set C} : - IsCodetecting 𝒢 → IsCoseparating 𝒢 := by +theorem IsCodetecting.isCoseparating [HasCoequalizers C] : + IsCodetecting P → IsCoseparating P := by simpa only [← isSeparating_op_iff, ← isDetecting_op_iff] using IsDetecting.isSeparating -theorem IsSeparating.isDetecting [Balanced C] {𝒢 : Set C} (h𝒢 : IsSeparating 𝒢) : - IsDetecting 𝒢 := by +theorem IsSeparating.isDetecting [Balanced C] (hP : IsSeparating P) : + IsDetecting P := by intro X Y f hf refine - (isIso_iff_mono_and_epi _).2 ⟨⟨fun g h hgh => h𝒢 _ _ fun G hG i => ?_⟩, ⟨fun g h hgh => ?_⟩⟩ + (isIso_iff_mono_and_epi _).2 ⟨⟨fun g h hgh => hP _ _ fun G hG i => ?_⟩, ⟨fun g h hgh => ?_⟩⟩ · obtain ⟨t, -, ht⟩ := hf G hG (i ≫ g ≫ f) rw [ht (i ≫ g) (Category.assoc _ _ _), ht (i ≫ h) (hgh.symm ▸ Category.assoc _ _ _)] - · refine h𝒢 _ _ fun G hG i => ?_ + · refine hP _ _ fun G hG i => ?_ obtain ⟨t, rfl, -⟩ := hf G hG i rw [Category.assoc, hgh, Category.assoc] -lemma IsDetecting.isIso_iff_of_mono {𝒢 : Set C} (h𝒢 : IsDetecting 𝒢) +lemma IsDetecting.isIso_iff_of_mono (hP : IsDetecting P) {X Y : C} (f : X ⟶ Y) [Mono f] : - IsIso f ↔ ∀ s ∈ 𝒢, Function.Surjective ((coyoneda.obj (op s)).map f) := by + IsIso f ↔ ∀ (G : C) (_ : P G), Function.Surjective ((coyoneda.obj (op G)).map f) := by constructor · intro h rw [isIso_iff_yoneda_map_bijective] at h intro A _ exact (h A).2 · intro hf - refine h𝒢 _ (fun A hA g ↦ existsUnique_of_exists_of_unique ?_ ?_) + refine hP _ (fun A hA g ↦ existsUnique_of_exists_of_unique ?_ ?_) · exact hf A hA g · intro l₁ l₂ h₁ h₂ rw [← cancel_mono f, h₁, h₂] -lemma IsCodetecting.isIso_iff_of_epi {𝒢 : Set C} (h𝒢 : IsCodetecting 𝒢) +lemma IsCodetecting.isIso_iff_of_epi (hP : IsCodetecting P) {X Y : C} (f : X ⟶ Y) [Epi f] : - IsIso f ↔ ∀ s ∈ 𝒢, Function.Surjective ((yoneda.obj s).map f.op) := by + IsIso f ↔ ∀ (G : C) (_ : P G), Function.Surjective ((yoneda.obj G).map f.op) := by constructor · intro h rw [isIso_iff_coyoneda_map_bijective] at h intro A _ exact (h A).2 · intro hf - refine h𝒢 _ (fun A hA g ↦ existsUnique_of_exists_of_unique ?_ ?_) + refine hP _ (fun A hA g ↦ existsUnique_of_exists_of_unique ?_ ?_) · exact hf A hA g · intro l₁ l₂ h₁ h₂ rw [← cancel_epi f, h₁, h₂] @@ -205,63 +226,65 @@ section attribute [local instance] balanced_opposite -theorem IsCoseparating.isCodetecting [Balanced C] {𝒢 : Set C} : - IsCoseparating 𝒢 → IsCodetecting 𝒢 := by +theorem IsCoseparating.isCodetecting [Balanced C] : + IsCoseparating P → IsCodetecting P := by simpa only [← isDetecting_op_iff, ← isSeparating_op_iff] using IsSeparating.isDetecting end -theorem isDetecting_iff_isSeparating [HasEqualizers C] [Balanced C] (𝒢 : Set C) : - IsDetecting 𝒢 ↔ IsSeparating 𝒢 := +theorem isDetecting_iff_isSeparating [HasEqualizers C] [Balanced C] : + IsDetecting P ↔ IsSeparating P := ⟨IsDetecting.isSeparating, IsSeparating.isDetecting⟩ -theorem isCodetecting_iff_isCoseparating [HasCoequalizers C] [Balanced C] {𝒢 : Set C} : - IsCodetecting 𝒢 ↔ IsCoseparating 𝒢 := +theorem isCodetecting_iff_isCoseparating [HasCoequalizers C] [Balanced C] : + IsCodetecting P ↔ IsCoseparating P := ⟨IsCodetecting.isCoseparating, IsCoseparating.isCodetecting⟩ section Mono -theorem IsSeparating.mono {𝒢 : Set C} (h𝒢 : IsSeparating 𝒢) {ℋ : Set C} (h𝒢ℋ : 𝒢 ⊆ ℋ) : - IsSeparating ℋ := fun _ _ _ _ hfg => h𝒢 _ _ fun _ hG _ => hfg _ (h𝒢ℋ hG) _ +theorem IsSeparating.of_le (hP : IsSeparating P) {Q : ObjectProperty C} (h : P ≤ Q) : + IsSeparating Q := fun _ _ _ _ hfg => hP _ _ fun _ hG _ => hfg _ (h _ hG) _ -theorem IsCoseparating.mono {𝒢 : Set C} (h𝒢 : IsCoseparating 𝒢) {ℋ : Set C} (h𝒢ℋ : 𝒢 ⊆ ℋ) : - IsCoseparating ℋ := fun _ _ _ _ hfg => h𝒢 _ _ fun _ hG _ => hfg _ (h𝒢ℋ hG) _ +theorem IsCoseparating.of_le (hP : IsCoseparating P) {Q : ObjectProperty C} (h : P ≤ Q) : + IsCoseparating Q := fun _ _ _ _ hfg => hP _ _ fun _ hG _ => hfg _ (h _ hG) _ -theorem IsDetecting.mono {𝒢 : Set C} (h𝒢 : IsDetecting 𝒢) {ℋ : Set C} (h𝒢ℋ : 𝒢 ⊆ ℋ) : - IsDetecting ℋ := fun _ _ _ hf => h𝒢 _ fun _ hG _ => hf _ (h𝒢ℋ hG) _ +theorem IsDetecting.of_le (hP : IsDetecting P) {Q : ObjectProperty C} (h : P ≤ Q) : + IsDetecting Q := fun _ _ _ hf => hP _ fun _ hG _ => hf _ (h _ hG) _ -theorem IsCodetecting.mono {𝒢 : Set C} (h𝒢 : IsCodetecting 𝒢) {ℋ : Set C} (h𝒢ℋ : 𝒢 ⊆ ℋ) : - IsCodetecting ℋ := fun _ _ _ hf => h𝒢 _ fun _ hG _ => hf _ (h𝒢ℋ hG) _ +theorem IsCodetecting.of_le (h𝒢 : IsCodetecting P) {Q : ObjectProperty C} (h : P ≤ Q) : + IsCodetecting Q := fun _ _ _ hf => h𝒢 _ fun _ hG _ => hf _ (h _ hG) _ end Mono section Empty -theorem thin_of_isSeparating_empty (h : IsSeparating (∅ : Set C)) : Quiver.IsThin C := fun _ _ => - ⟨fun _ _ => h _ _ fun _ => False.elim⟩ +lemma isThin_of_isSeparating_bot (h : IsSeparating (⊥ : ObjectProperty C)) : + Quiver.IsThin C := fun _ _ ↦ ⟨fun _ _ ↦ h _ _ (by simp)⟩ -theorem isSeparating_empty_of_thin [Quiver.IsThin C] : IsSeparating (∅ : Set C) := - fun _ _ _ _ _ => Subsingleton.elim _ _ +lemma isSeparating_bot_of_isThin [Quiver.IsThin C] : IsSeparating (⊥ : ObjectProperty C) := + fun _ _ _ _ _ ↦ Subsingleton.elim _ _ -theorem thin_of_isCoseparating_empty (h : IsCoseparating (∅ : Set C)) : Quiver.IsThin C := - fun _ _ => ⟨fun _ _ => h _ _ fun _ => False.elim⟩ +lemma isThin_of_isCoseparating_bot (h : IsCoseparating (⊥ : ObjectProperty C)) : + Quiver.IsThin C := fun _ _ ↦ ⟨fun _ _ ↦ h _ _ (by simp)⟩ -theorem isCoseparating_empty_of_thin [Quiver.IsThin C] : IsCoseparating (∅ : Set C) := - fun _ _ _ _ _ => Subsingleton.elim _ _ +lemma isCoseparating_bot_of_isThin [Quiver.IsThin C] : IsCoseparating (⊥ : ObjectProperty C) := + fun _ _ _ _ _ ↦ Subsingleton.elim _ _ -theorem groupoid_of_isDetecting_empty (h : IsDetecting (∅ : Set C)) {X Y : C} (f : X ⟶ Y) : - IsIso f := - h _ fun _ => False.elim +lemma isGroupoid_of_isDetecting_bot (h : IsDetecting (⊥ : ObjectProperty C)) : + IsGroupoid C where + all_isIso f := h _ (by simp) -theorem isDetecting_empty_of_groupoid [∀ {X Y : C} (f : X ⟶ Y), IsIso f] : - IsDetecting (∅ : Set C) := fun _ _ _ _ => inferInstance +lemma isDetecting_bot_of_isGroupoid [IsGroupoid C] : + IsDetecting (⊥ : ObjectProperty C) := + fun _ _ _ _ ↦ inferInstance -theorem groupoid_of_isCodetecting_empty (h : IsCodetecting (∅ : Set C)) {X Y : C} (f : X ⟶ Y) : - IsIso f := - h _ fun _ => False.elim +lemma isGroupoid_of_isCodetecting_bot (h : IsCodetecting (⊥ : ObjectProperty C)) : + IsGroupoid C where + all_isIso f := h _ (by simp) -theorem isCodetecting_empty_of_groupoid [∀ {X Y : C} (f : X ⟶ Y), IsIso f] : - IsCodetecting (∅ : Set C) := fun _ _ _ _ => inferInstance +lemma isCodetecting_bot_of_isGroupoid [IsGroupoid C] : + IsCodetecting (⊥ : ObjectProperty C) := + fun _ _ _ _ ↦ inferInstance end Empty @@ -820,4 +843,71 @@ end Dual end HasGenerator +end ObjectProperty + +@[deprecated (since := "2025-10-06")] alias IsSeparating := ObjectProperty.IsSeparating +@[deprecated (since := "2025-10-06")] alias IsCoseparating := ObjectProperty.IsCoseparating +@[deprecated (since := "2025-10-06")] alias IsDetecting := ObjectProperty.IsDetecting +@[deprecated (since := "2025-10-06")] alias IsCodetecting := ObjectProperty.IsCodetecting +@[deprecated (since := "2025-10-06")] alias IsSeparating.of_equivalence := + ObjectProperty.IsSeparating.of_equivalence +@[deprecated (since := "2025-10-06")] alias IsCoseparating.of_equivalence := + ObjectProperty.IsCoseparating.of_equivalence +@[deprecated (since := "2025-10-06")] alias isSeparating_op_iff := + ObjectProperty.isSeparating_op_iff +@[deprecated (since := "2025-10-06")] alias isCoseparating_op_iff := + ObjectProperty.isCoseparating_op_iff +@[deprecated (since := "2025-10-06")] alias isSeparating_unop_iff := + ObjectProperty.isSeparating_op_iff +@[deprecated (since := "2025-10-06")] alias isCoseparating_unop_iff := + ObjectProperty.isCoseparating_op_iff +@[deprecated (since := "2025-10-06")] alias isDetecting_op_iff := + ObjectProperty.isDetecting_op_iff +@[deprecated (since := "2025-10-06")] alias isCodetecting_op_iff := + ObjectProperty.isCodetecting_op_iff +@[deprecated (since := "2025-10-06")] alias isDetecting_unop_iff := + ObjectProperty.isDetecting_op_iff +@[deprecated (since := "2025-10-06")] alias isCodetecting_unop_iff := + ObjectProperty.isCodetecting_op_iff +@[deprecated (since := "2025-10-06")] alias IsDetecting.isSeparating := + ObjectProperty.IsDetecting.isSeparating +@[deprecated (since := "2025-10-06")] alias IsCodetecting.isCoseparating := + ObjectProperty.IsCodetecting.isCoseparating +@[deprecated (since := "2025-10-06")] alias IsSeparating.isDetecting := + ObjectProperty.IsSeparating.isDetecting +@[deprecated (since := "2025-10-06")] alias IsDetecting.isIso_iff_of_mono := + ObjectProperty.IsDetecting.isIso_iff_of_mono +@[deprecated (since := "2025-10-06")] alias IsCodetecting.isIso_iff_of_epi := + ObjectProperty.IsCodetecting.isIso_iff_of_epi +@[deprecated (since := "2025-10-06")] alias IsCoseparating.isCodetecting := + ObjectProperty.IsCoseparating.isCodetecting +@[deprecated (since := "2025-10-06")] alias isDetecting_iff_isSeparating := + ObjectProperty.isDetecting_iff_isSeparating +@[deprecated (since := "2025-10-06")] alias isCodetecting_iff_isCoseparating := + ObjectProperty.isCodetecting_iff_isCoseparating +@[deprecated (since := "2025-10-06")] alias IsSeparating.mono := + ObjectProperty.IsSeparating.of_le +@[deprecated (since := "2025-10-06")] alias IsCoseparating.mono := + ObjectProperty.IsCoseparating.of_le +@[deprecated (since := "2025-10-06")] alias IsDetecting.mono := + ObjectProperty.IsDetecting.of_le +@[deprecated (since := "2025-10-06")] alias IsCodetecting.mono := + ObjectProperty.IsCodetecting.of_le +@[deprecated (since := "2025-10-06")] alias thin_of_isSeparating_empty := + ObjectProperty.isThin_of_isSeparating_bot +@[deprecated (since := "2025-10-06")] alias isSeparating_empty_of_thin := + ObjectProperty.isSeparating_bot_of_isThin +@[deprecated (since := "2025-10-06")] alias thin_of_isCoseparating_empty := + ObjectProperty.isThin_of_isCoseparating_bot +@[deprecated (since := "2025-10-06")] alias isCoseparating_empty_of_thin := + ObjectProperty.isCoseparating_bot_of_isThin +@[deprecated (since := "2025-10-06")] alias groupoid_of_isDetecting_empty := + ObjectProperty.isGroupoid_of_isDetecting_bot +@[deprecated (since := "2025-10-06")] alias isDetecting_empty_of_groupoid := + ObjectProperty.isDetecting_bot_of_isGroupoid +@[deprecated (since := "2025-10-06")] alias groupoid_of_isCodetecting_empty := + ObjectProperty.isGroupoid_of_isCodetecting_bot +@[deprecated (since := "2025-10-06")] alias isCodetecting_empty_of_groupoid := + ObjectProperty.isCodetecting_bot_of_isGroupoid + end CategoryTheory diff --git a/Mathlib/CategoryTheory/ObjectProperty/Basic.lean b/Mathlib/CategoryTheory/ObjectProperty/Basic.lean index 7cf7a47eb945ba..210309b1408ea0 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/Basic.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/Basic.lean @@ -66,6 +66,42 @@ 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] +section + +variable {ι : Type u'} (X : ι → C) + +/-- The property of objects that is satisfied by the `X i` for a family +of objects `X : ι : C`. -/ +inductive ofObj : ObjectProperty C + | mk (i : ι) : ofObj (X i) + +@[simp] +lemma prop_ofObj (i : ι) : ofObj X (X i) := ⟨i⟩ + +lemma ofObj_iff (Y : C) : ofObj X Y ↔ ∃ i, X i = Y := by + constructor + · rintro ⟨i⟩ + exact ⟨i, rfl⟩ + · rintro ⟨i, rfl⟩ + exact ⟨i⟩ + +lemma ofObj_le_iff (P : ObjectProperty C) : + ofObj X ≤ P ↔ ∀ i, P (X i) := + ⟨fun h i ↦ h _ (by simp), fun h ↦ by rintro _ ⟨i⟩; exact h i⟩ + +end + +/-- The property of objects in a category that is satisfying by a single object `X : C`. -/ +abbrev singleton (X : C) : ObjectProperty C := ofObj (fun (_ : Unit) ↦ X) + +@[simp] +lemma singleton_iff (X Y : C) : singleton X Y ↔ X = Y := by simp [ofObj_iff] + +@[simp] +lemma singleton_le_iff {X : C} {P : ObjectProperty C} : + singleton X ≤ P ↔ P X := by + simp [ofObj_le_iff] + end ObjectProperty end CategoryTheory 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 From 13098da6ea4d70783760110dbd392b18370c944e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 7 Oct 2025 10:32:27 +0200 Subject: [PATCH 108/309] fix --- Mathlib/CategoryTheory/Generator/Basic.lean | 307 ++++++++++-------- .../CategoryTheory/ObjectProperty/Basic.lean | 41 ++- .../ObjectProperty/Opposite.lean | 30 ++ .../CategoryTheory/ObjectProperty/Small.lean | 17 + 4 files changed, 255 insertions(+), 140 deletions(-) diff --git a/Mathlib/CategoryTheory/Generator/Basic.lean b/Mathlib/CategoryTheory/Generator/Basic.lean index f74bc6ae173673..521c1c73de800c 100644 --- a/Mathlib/CategoryTheory/Generator/Basic.lean +++ b/Mathlib/CategoryTheory/Generator/Basic.lean @@ -6,8 +6,7 @@ Authors: Markus Himmel import Mathlib.CategoryTheory.Limits.EssentiallySmall import Mathlib.CategoryTheory.Limits.Opposites import Mathlib.CategoryTheory.Subobject.Lattice -import Mathlib.CategoryTheory.ObjectProperty.Opposite -import Mathlib.Data.Set.Opposite +import Mathlib.CategoryTheory.ObjectProperty.Small /-! # Separating and detecting sets @@ -101,20 +100,20 @@ variable {P} lemma IsSeparating.of_equivalence (h : IsSeparating P) {D : Type*} [Category D] (α : C ≌ D) : - IsSeparating (P.map α.functor) := fun X Y f g H => - α.inverse.map_injective (h _ _ (fun Z hZ h => by + IsSeparating (P.strictMap α.functor) := fun X Y f g H => + α.inverse.map_injective (h _ _ (fun Z hZ h ↦ by obtain ⟨h', rfl⟩ := (α.toAdjunction.homEquiv _ _).surjective h simp only [Adjunction.homEquiv_unit, Category.assoc, ← Functor.map_comp, - H _ (P.prop_map_obj _ hZ) h'])) + H _ (P.prop_strictMap_obj _ hZ) h'])) lemma IsCoseparating.of_equivalence (h : IsCoseparating P) {D : Type*} [Category D] (α : C ≌ D) : - IsCoseparating (P.map α.functor) := fun X Y f g H => - α.inverse.map_injective (h _ _ (fun Z hZ h => by + IsCoseparating (P.strictMap α.functor) := fun X Y f g H => + α.inverse.map_injective (h _ _ (fun Z hZ h ↦ by obtain ⟨h', rfl⟩ := (α.symm.toAdjunction.homEquiv _ _).symm.surjective h simp only [Equivalence.symm_inverse, Equivalence.symm_functor, Adjunction.homEquiv_counit, ← Functor.map_comp_assoc, - H _ (P.prop_map_obj _ hZ) h'])) + H _ (P.prop_strictMap_obj _ hZ) h'])) end Equivalence @@ -288,24 +287,34 @@ lemma isCodetecting_bot_of_isGroupoid [IsGroupoid C] : end Empty -theorem isSeparating_iff_epi (𝒢 : Set C) - [∀ A : C, HasCoproduct fun f : Σ G : 𝒢, (G : C) ⟶ A => (f.1 : C)] : - IsSeparating 𝒢 ↔ ∀ A : C, Epi (Sigma.desc (@Sigma.snd 𝒢 fun G => (G : C) ⟶ A)) := by - refine ⟨fun h A => ⟨fun u v huv => h _ _ fun G hG f => ?_⟩, fun h X Y f g hh => ?_⟩ - · simpa using Sigma.ι (fun f : Σ G : 𝒢, (G : C) ⟶ A => (f.1 : C)) ⟨⟨G, hG⟩, f⟩ ≫= huv - · haveI := h X - refine - (cancel_epi (Sigma.desc (@Sigma.snd 𝒢 fun G => (G : C) ⟶ X))).1 (colimit.hom_ext fun j => ?_) - simpa using hh j.as.1.1 j.as.1.2 j.as.2 - -theorem isCoseparating_iff_mono (𝒢 : Set C) - [∀ A : C, HasProduct fun f : Σ G : 𝒢, A ⟶ (G : C) => (f.1 : C)] : - IsCoseparating 𝒢 ↔ ∀ A : C, Mono (Pi.lift (@Sigma.snd 𝒢 fun G => A ⟶ (G : C))) := by - refine ⟨fun h A => ⟨fun u v huv => h _ _ fun G hG f => ?_⟩, fun h X Y f g hh => ?_⟩ - · simpa using huv =≫ Pi.π (fun f : Σ G : 𝒢, A ⟶ (G : C) => (f.1 : C)) ⟨⟨G, hG⟩, f⟩ - · haveI := h Y - refine (cancel_mono (Pi.lift (@Sigma.snd 𝒢 fun G => Y ⟶ (G : C)))).1 (limit.hom_ext fun j => ?_) - simpa using hh j.as.1.1 j.as.1.2 j.as.2 +variable (P) + +theorem isSeparating_iff_epi + [∀ A : C, HasCoproduct fun f : Σ G : Subtype P, G.1 ⟶ A ↦ f.1.1] : + IsSeparating P ↔ + ∀ A : C, Epi (Sigma.desc (Sigma.snd (β := fun (G : Subtype P) ↦ G.1 ⟶ A))) := by + let β (A : C) (G : Subtype P) := G.1 ⟶ A + let b (A : C) (x : Σ G, β A G) := x.1.1 + refine ⟨fun h A ↦ ⟨fun u v huv ↦ h _ _ fun G hG f ↦ ?_⟩, fun h X Y f g hh ↦ ?_⟩ + · simpa [β, b] using Sigma.ι (b A) ⟨⟨G, hG⟩, f⟩ ≫= huv + · rw [← cancel_epi (Sigma.desc (Sigma.snd (β := β X)))] + ext ⟨⟨_, hG⟩, _⟩ + simpa using hh _ hG _ + +theorem isCoseparating_iff_mono + [∀ A : C, HasProduct fun f : Σ G : Subtype P, A ⟶ G.1 ↦ f.1.1] : + IsCoseparating P ↔ + ∀ A : C, Mono (Pi.lift (Sigma.snd (β := fun (G : Subtype P) ↦ A ⟶ G.1))) := by + let β (A : C) (G : Subtype P) := A ⟶ G.1 + let b (A : C) (x : Σ G, β A G) := x.1.1 + refine ⟨fun h A ↦ ⟨fun u v huv ↦ h _ _ fun G hG f ↦ ?_⟩, fun h X Y f g hh ↦ ?_⟩ + · simpa [β, b] using huv =≫ Pi.π (b A) ⟨⟨G, hG⟩, f⟩ + · rw [← cancel_mono (Pi.lift (Sigma.snd (β := β Y)))] + ext ⟨⟨_, hG⟩, _⟩ + simp + simpa using hh _ hG _ + +variable {P} /-- An ingredient of the proof of the Special Adjoint Functor Theorem: a complete well-powered category with a small coseparating set has an initial object. @@ -313,18 +322,18 @@ theorem isCoseparating_iff_mono (𝒢 : Set C) In fact, it follows from the Special Adjoint Functor Theorem that `C` is already cocomplete, see `hasColimits_of_hasLimits_of_isCoseparating`. -/ theorem hasInitial_of_isCoseparating [LocallySmall.{w} C] [WellPowered.{w} C] - [HasLimitsOfSize.{w, w} C] {𝒢 : Set C} [Small.{w} 𝒢] - (h𝒢 : IsCoseparating 𝒢) : HasInitial C := by + [HasLimitsOfSize.{w, w} C] [ObjectProperty.Small.{w} P] + (hP : IsCoseparating P) : HasInitial C := by have := hasFiniteLimits_of_hasLimitsOfSize C - haveI : HasProductsOfShape 𝒢 C := hasProductsOfShape_of_small C 𝒢 - haveI := fun A => hasProductsOfShape_of_small.{w} C (Σ G : 𝒢, A ⟶ (G : C)) - letI := completeLatticeOfCompleteSemilatticeInf (Subobject (piObj (Subtype.val : 𝒢 → C))) - suffices ∀ A : C, Unique (((⊥ : Subobject (piObj (Subtype.val : 𝒢 → C))) : C) ⟶ A) by - exact hasInitial_of_unique ((⊥ : Subobject (piObj (Subtype.val : 𝒢 → C))) : C) + haveI : HasProductsOfShape (Subtype P) C := hasProductsOfShape_of_small C (Subtype P) + haveI := fun A => hasProductsOfShape_of_small.{w} C (Σ G : Subtype P, A ⟶ (G : C)) + letI := completeLatticeOfCompleteSemilatticeInf (Subobject (piObj (Subtype.val : Subtype P → C))) + suffices ∀ A : C, Unique (((⊥ : Subobject (piObj (Subtype.val : Subtype P → C))) : C) ⟶ A) by + exact hasInitial_of_unique ((⊥ : Subobject (piObj (Subtype.val : Subtype P → C))) : C) refine fun A => ⟨⟨?_⟩, fun f => ?_⟩ - · let s := Pi.lift fun f : Σ G : 𝒢, A ⟶ (G : C) => id (Pi.π (Subtype.val : 𝒢 → C)) f.1 - let t := Pi.lift (@Sigma.snd 𝒢 fun G => A ⟶ (G : C)) - haveI : Mono t := (isCoseparating_iff_mono 𝒢).1 h𝒢 A + · let s := Pi.lift fun f : Σ G : Subtype P, A ⟶ (G : C) => Pi.π (Subtype.val : Subtype P → C) f.1 + let t := Pi.lift (@Sigma.snd (Subtype P) fun G => A ⟶ (G : C)) + haveI : Mono t := (isCoseparating_iff_mono P).1 hP A exact Subobject.ofLEMk _ (pullback.fst _ _ : pullback s t ⟶ _) bot_le ≫ pullback.snd _ _ · suffices ∀ (g : Subobject.underlying.obj ⊥ ⟶ A), f = g by apply this @@ -340,18 +349,20 @@ theorem hasInitial_of_isCoseparating [LocallySmall.{w} C] [WellPowered.{w} C] In fact, it follows from the Special Adjoint Functor Theorem that `C` is already complete, see `hasLimits_of_hasColimits_of_isSeparating`. -/ theorem hasTerminal_of_isSeparating [LocallySmall.{w} Cᵒᵖ] [WellPowered.{w} Cᵒᵖ] - [HasColimitsOfSize.{w, w} C] {𝒢 : Set C} [Small.{w} 𝒢] - (h𝒢 : IsSeparating 𝒢) : HasTerminal C := by - haveI : Small.{w} 𝒢.op := small_of_injective (Set.opEquiv_self 𝒢).injective - haveI : HasInitial Cᵒᵖ := hasInitial_of_isCoseparating ((isCoseparating_op_iff _).2 h𝒢) + [HasColimitsOfSize.{w, w} C] [ObjectProperty.Small.{w} P] + (hP : IsSeparating P) : HasTerminal C := by + haveI : HasInitial Cᵒᵖ := hasInitial_of_isCoseparating ((isCoseparating_op_iff _).2 hP) exact hasTerminal_of_hasInitial_op +end ObjectProperty + section WellPowered namespace Subobject -theorem eq_of_le_of_isDetecting {𝒢 : Set C} (h𝒢 : IsDetecting 𝒢) {X : C} (P Q : Subobject X) - (h₁ : P ≤ Q) (h₂ : ∀ G ∈ 𝒢, ∀ {f : G ⟶ X}, Q.Factors f → P.Factors f) : P = Q := by +theorem eq_of_le_of_isDetecting {𝒢 : ObjectProperty C} (h𝒢 : 𝒢.IsDetecting) {X : C} + (P Q : Subobject X) (h₁ : P ≤ Q) + (h₂ : ∀ (G : C) (_ : 𝒢 G), ∀ {f : G ⟶ X}, Q.Factors f → P.Factors f) : P = Q := by suffices IsIso (ofLE _ _ h₁) by exact le_antisymm h₁ (le_of_comm (inv (ofLE _ _ h₁)) (by simp)) refine h𝒢 _ fun G hG f => ?_ have : P.Factors (f ≫ Q.arrow) := h₂ _ hG ((factors_iff _ _).2 ⟨_, rfl⟩) @@ -360,13 +371,15 @@ theorem eq_of_le_of_isDetecting {𝒢 : Set C} (h𝒢 : IsDetecting 𝒢) {X : C · simp only [← cancel_mono (Subobject.ofLE _ _ h₁), ← cancel_mono Q.arrow, hg, Category.assoc, ofLE_arrow, factorThru_arrow] -theorem inf_eq_of_isDetecting [HasPullbacks C] {𝒢 : Set C} (h𝒢 : IsDetecting 𝒢) {X : C} - (P Q : Subobject X) (h : ∀ G ∈ 𝒢, ∀ {f : G ⟶ X}, P.Factors f → Q.Factors f) : P ⊓ Q = P := +theorem inf_eq_of_isDetecting [HasPullbacks C] {𝒢 : ObjectProperty C} (h𝒢 : 𝒢.IsDetecting) {X : C} + (P Q : Subobject X) (h : ∀ (G : C) (_ : 𝒢 G), ∀ {f : G ⟶ X}, P.Factors f → Q.Factors f) : + P ⊓ Q = P := eq_of_le_of_isDetecting h𝒢 _ _ _root_.inf_le_left fun _ hG _ hf => (inf_factors _).2 ⟨hf, h _ hG hf⟩ -theorem eq_of_isDetecting [HasPullbacks C] {𝒢 : Set C} (h𝒢 : IsDetecting 𝒢) {X : C} - (P Q : Subobject X) (h : ∀ G ∈ 𝒢, ∀ {f : G ⟶ X}, P.Factors f ↔ Q.Factors f) : P = Q := +theorem eq_of_isDetecting [HasPullbacks C] {𝒢 : ObjectProperty C} (h𝒢 : 𝒢.IsDetecting) {X : C} + (P Q : Subobject X) (h : ∀ (G : C) (_ : 𝒢 G), + ∀ {f : G ⟶ X}, P.Factors f ↔ Q.Factors f) : P = Q := calc P = P ⊓ Q := Eq.symm <| inf_eq_of_isDetecting h𝒢 _ _ fun G hG _ hf => (h G hG).1 hf _ = Q ⊓ P := inf_comm .. @@ -375,12 +388,13 @@ theorem eq_of_isDetecting [HasPullbacks C] {𝒢 : Set C} (h𝒢 : IsDetecting end Subobject /-- A category with pullbacks and a small detecting set is well-powered. -/ -theorem wellPowered_of_isDetecting [HasPullbacks C] {𝒢 : Set C} [Small.{w} 𝒢] - [LocallySmall.{w} C] (h𝒢 : IsDetecting 𝒢) : WellPowered.{w} C := - ⟨fun X => - @small_of_injective _ _ _ (fun P : Subobject X => { f : Σ G : 𝒢, G.1 ⟶ X | P.Factors f.2 }) +theorem wellPowered_of_isDetecting [HasPullbacks C] {𝒢 : ObjectProperty C} + [ObjectProperty.Small.{w} 𝒢] [LocallySmall.{w} C] + (h𝒢 : 𝒢.IsDetecting) : WellPowered.{w} C where + subobject_small X := small_of_injective + (f := fun P : Subobject X => { f : Σ G : Subtype 𝒢, G.1 ⟶ X | P.Factors f.2 }) fun P Q h => Subobject.eq_of_isDetecting h𝒢 _ _ - (by simpa [Set.ext_iff, Sigma.forall] using h)⟩ + (by simpa [Set.ext_iff, Sigma.forall] using h) end WellPowered @@ -388,9 +402,9 @@ namespace StructuredArrow variable (S : D) (T : C ⥤ D) -theorem isCoseparating_proj_preimage {𝒢 : Set C} (h𝒢 : IsCoseparating 𝒢) : - IsCoseparating ((proj S T).obj ⁻¹' 𝒢) := by - refine fun X Y f g hfg => ext _ _ (h𝒢 _ _ fun G hG h => ?_) +theorem isCoseparating_proj_preimage {P : ObjectProperty C} (hP : P.IsCoseparating) : + (P.inverseImage (proj S T)).IsCoseparating := by + refine fun X Y f g hfg => ext _ _ (hP _ _ fun G hG h => ?_) exact congr_arg CommaMorphism.right (hfg (mk (Y.hom ≫ T.map h)) hG (homMk h rfl)) end StructuredArrow @@ -399,87 +413,90 @@ namespace CostructuredArrow variable (S : C ⥤ D) (T : D) -theorem isSeparating_proj_preimage {𝒢 : Set C} (h𝒢 : IsSeparating 𝒢) : - IsSeparating ((proj S T).obj ⁻¹' 𝒢) := by - refine fun X Y f g hfg => ext _ _ (h𝒢 _ _ fun G hG h => ?_) +theorem isSeparating_proj_preimage {P : ObjectProperty C} (hP : P.IsSeparating) : + (P.inverseImage (proj S T)).IsSeparating := by + refine fun X Y f g hfg => ext _ _ (hP _ _ fun G hG h => ?_) exact congr_arg CommaMorphism.left (hfg (mk (S.map h ≫ X.hom)) hG (homMk h rfl)) end CostructuredArrow /-- We say that `G` is a separator if the functor `C(G, -)` is faithful. -/ def IsSeparator (G : C) : Prop := - IsSeparating ({G} : Set C) + ObjectProperty.IsSeparating (.singleton G) /-- We say that `G` is a coseparator if the functor `C(-, G)` is faithful. -/ def IsCoseparator (G : C) : Prop := - IsCoseparating ({G} : Set C) + ObjectProperty.IsCoseparating (.singleton G) /-- We say that `G` is a detector if the functor `C(G, -)` reflects isomorphisms. -/ def IsDetector (G : C) : Prop := - IsDetecting ({G} : Set C) + ObjectProperty.IsDetecting (.singleton G) /-- We say that `G` is a codetector if the functor `C(-, G)` reflects isomorphisms. -/ def IsCodetector (G : C) : Prop := - IsCodetecting ({G} : Set C) - + ObjectProperty.IsCodetecting (.singleton G) section Equivalence theorem IsSeparator.of_equivalence {G : C} (h : IsSeparator G) (α : C ≌ D) : - IsSeparator (α.functor.obj G) := by simpa using IsSeparating.of_equivalence h α + IsSeparator (α.functor.obj G) := by + simpa using ObjectProperty.IsSeparating.of_equivalence h α theorem IsCoseparator.of_equivalence {G : C} (h : IsCoseparator G) (α : C ≌ D) : - IsCoseparator (α.functor.obj G) := by simpa using IsCoseparating.of_equivalence h α + IsCoseparator (α.functor.obj G) := by + simpa using ObjectProperty.IsCoseparating.of_equivalence h α end Equivalence section Dual +open ObjectProperty + theorem isSeparator_op_iff (G : C) : IsSeparator (op G) ↔ IsCoseparator G := by - rw [IsSeparator, IsCoseparator, ← isSeparating_op_iff, Set.singleton_op] + rw [IsSeparator, IsCoseparator, ← isSeparating_op_iff, op_singleton] theorem isCoseparator_op_iff (G : C) : IsCoseparator (op G) ↔ IsSeparator G := by - rw [IsSeparator, IsCoseparator, ← isCoseparating_op_iff, Set.singleton_op] + rw [IsSeparator, IsCoseparator, ← isCoseparating_op_iff, op_singleton] theorem isCoseparator_unop_iff (G : Cᵒᵖ) : IsCoseparator (unop G) ↔ IsSeparator G := by - rw [IsSeparator, IsCoseparator, ← isCoseparating_unop_iff, Set.singleton_unop] + rw [IsSeparator, IsCoseparator, ← isCoseparating_unop_iff, unop_singleton] theorem isSeparator_unop_iff (G : Cᵒᵖ) : IsSeparator (unop G) ↔ IsCoseparator G := by - rw [IsSeparator, IsCoseparator, ← isSeparating_unop_iff, Set.singleton_unop] + rw [IsSeparator, IsCoseparator, ← isSeparating_unop_iff, unop_singleton] theorem isDetector_op_iff (G : C) : IsDetector (op G) ↔ IsCodetector G := by - rw [IsDetector, IsCodetector, ← isDetecting_op_iff, Set.singleton_op] + rw [IsDetector, IsCodetector, ← isDetecting_op_iff, op_singleton] theorem isCodetector_op_iff (G : C) : IsCodetector (op G) ↔ IsDetector G := by - rw [IsDetector, IsCodetector, ← isCodetecting_op_iff, Set.singleton_op] + rw [IsDetector, IsCodetector, ← isCodetecting_op_iff, op_singleton] theorem isCodetector_unop_iff (G : Cᵒᵖ) : IsCodetector (unop G) ↔ IsDetector G := by - rw [IsDetector, IsCodetector, ← isCodetecting_unop_iff, Set.singleton_unop] + rw [IsDetector, IsCodetector, ← isCodetecting_unop_iff, unop_singleton] theorem isDetector_unop_iff (G : Cᵒᵖ) : IsDetector (unop G) ↔ IsCodetector G := by - rw [IsDetector, IsCodetector, ← isDetecting_unop_iff, Set.singleton_unop] + rw [IsDetector, IsCodetector, ← isDetecting_unop_iff, unop_singleton] end Dual theorem IsDetector.isSeparator [HasEqualizers C] {G : C} : IsDetector G → IsSeparator G := - IsDetecting.isSeparating + ObjectProperty.IsDetecting.isSeparating theorem IsCodetector.isCoseparator [HasCoequalizers C] {G : C} : IsCodetector G → IsCoseparator G := - IsCodetecting.isCoseparating + ObjectProperty.IsCodetecting.isCoseparating theorem IsSeparator.isDetector [Balanced C] {G : C} : IsSeparator G → IsDetector G := - IsSeparating.isDetecting + ObjectProperty.IsSeparating.isDetecting theorem IsCoseparator.isCodetector [Balanced C] {G : C} : IsCoseparator G → IsCodetector G := - IsCoseparating.isCodetecting + ObjectProperty.IsCoseparating.isCodetecting theorem isSeparator_def (G : C) : IsSeparator G ↔ ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), (∀ h : G ⟶ X, h ≫ f = h ≫ g) → f = g := ⟨fun hG X Y f g hfg => hG _ _ fun H hH h => by - obtain rfl := Set.mem_singleton_iff.1 hH + obtain rfl := (ObjectProperty.prop_singleton_iff _ _).1 hH exact hfg h, - fun hG _ _ _ _ hfg => hG _ _ fun _ => hfg _ (Set.mem_singleton _) _⟩ + fun hG _ _ _ _ hfg => hG _ _ fun _ => hfg _ (by simp) _⟩ theorem IsSeparator.def {G : C} : IsSeparator G → ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), (∀ h : G ⟶ X, h ≫ f = h ≫ g) → f = g := @@ -489,9 +506,9 @@ theorem isCoseparator_def (G : C) : IsCoseparator G ↔ ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), (∀ h : Y ⟶ G, f ≫ h = g ≫ h) → f = g := ⟨fun hG X Y f g hfg => hG _ _ fun H hH h => by - obtain rfl := Set.mem_singleton_iff.1 hH + obtain rfl := (ObjectProperty.prop_singleton_iff _ _).1 hH exact hfg h, - fun hG _ _ _ _ hfg => hG _ _ fun _ => hfg _ (Set.mem_singleton _) _⟩ + fun hG _ _ _ _ hfg => hG _ _ fun _ => hfg _ (by simp) _⟩ theorem IsCoseparator.def {G : C} : IsCoseparator G → ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), (∀ h : Y ⟶ G, f ≫ h = g ≫ h) → f = g := @@ -501,9 +518,9 @@ theorem isDetector_def (G : C) : IsDetector G ↔ ∀ ⦃X Y : C⦄ (f : X ⟶ Y), (∀ h : G ⟶ Y, ∃! h', h' ≫ f = h) → IsIso f := ⟨fun hG X Y f hf => hG _ fun H hH h => by - obtain rfl := Set.mem_singleton_iff.1 hH + obtain rfl := (ObjectProperty.prop_singleton_iff _ _).1 hH exact hf h, - fun hG _ _ _ hf => hG _ fun _ => hf _ (Set.mem_singleton _) _⟩ + fun hG _ _ _ hf => hG _ fun _ => hf _ (by simp) _⟩ theorem IsDetector.def {G : C} : IsDetector G → ∀ ⦃X Y : C⦄ (f : X ⟶ Y), (∀ h : G ⟶ Y, ∃! h', h' ≫ f = h) → IsIso f := @@ -513,9 +530,9 @@ theorem isCodetector_def (G : C) : IsCodetector G ↔ ∀ ⦃X Y : C⦄ (f : X ⟶ Y), (∀ h : X ⟶ G, ∃! h', f ≫ h' = h) → IsIso f := ⟨fun hG X Y f hf => hG _ fun H hH h => by - obtain rfl := Set.mem_singleton_iff.1 hH + obtain rfl := (ObjectProperty.prop_singleton_iff _ _).1 hH exact hf h, - fun hG _ _ _ hf => hG _ fun _ => hf _ (Set.mem_singleton _) _⟩ + fun hG _ _ _ hf => hG _ fun _ => hf _ (by simp) _⟩ theorem IsCodetector.def {G : C} : IsCodetector G → ∀ ⦃X Y : C⦄ (f : X ⟶ Y), (∀ h : X ⟶ G, ∃! h', f ≫ h' = h) → IsIso f := @@ -553,81 +570,91 @@ section ZeroMorphisms variable [HasZeroMorphisms C] +lemma isSeparator_of_isColimit_cofan {β : Type w} {f : β → C} + (hf : ObjectProperty.IsSeparating (.ofObj f)) {c : Cofan f} (hc : IsColimit c) : + IsSeparator c.pt := by + rw [isSeparator_def] + refine fun _ _ _ _ huv ↦ hf _ _ (fun _ h g ↦ ?_) + obtain ⟨b⟩ := h + classical simpa using c.inj b ≫= huv (hc.desc (Cofan.mk _ (Pi.single b g))) + +lemma isSeparator_iff_of_isColimit_cofan {β : Type w} {f : β → C} + {c : Cofan f} (hc : IsColimit c) : + IsSeparator c.pt ↔ ObjectProperty.IsSeparating (.ofObj f) := by + refine ⟨fun h X Y u v huv => ?_, fun h => isSeparator_of_isColimit_cofan h hc⟩ + refine h.def _ _ fun g => hc.hom_ext fun b => ?_ + simpa using huv (f b.as) (by simp) (c.inj _ ≫ g) + +theorem isSeparator_sigma {β : Type w} (f : β → C) [HasCoproduct f] : + IsSeparator (∐ f) ↔ ObjectProperty.IsSeparating (.ofObj f) := + isSeparator_iff_of_isColimit_cofan (hc := colimit.isColimit _) + theorem isSeparator_coprod (G H : C) [HasBinaryCoproduct G H] : - IsSeparator (G ⨿ H) ↔ IsSeparating ({G, H} : Set C) := by - refine - ⟨fun h X Y u v huv => ?_, fun h => - (isSeparator_def _).2 fun X Y u v huv => h _ _ fun Z hZ g => ?_⟩ - · refine h.def _ _ fun g => coprod.hom_ext ?_ ?_ - · simpa using huv G (by simp) (coprod.inl ≫ g) - · simpa using huv H (by simp) (coprod.inr ≫ g) - · simp only [Set.mem_insert_iff, Set.mem_singleton_iff] at hZ - rcases hZ with (rfl | rfl) - · simpa using coprod.inl ≫= huv (coprod.desc g 0) - · simpa using coprod.inr ≫= huv (coprod.desc 0 g) + IsSeparator (G ⨿ H) ↔ ObjectProperty.IsSeparating (.pair G H) := by + refine (isSeparator_iff_of_isColimit_cofan (coprodIsCoprod G H)).trans ?_ + convert Iff.rfl + ext X + simp only [ObjectProperty.prop_pair_iff, ObjectProperty.prop_ofObj_iff] + constructor + · rintro (rfl | rfl); exacts [⟨.left, rfl⟩, ⟨.right, rfl⟩] + · rintro ⟨⟨_ | _⟩, rfl⟩ <;> tauto theorem isSeparator_coprod_of_isSeparator_left (G H : C) [HasBinaryCoproduct G H] (hG : IsSeparator G) : IsSeparator (G ⨿ H) := - (isSeparator_coprod _ _).2 <| IsSeparating.mono hG <| by simp + (isSeparator_coprod _ _).2 <| ObjectProperty.IsSeparating.of_le hG <| by simp theorem isSeparator_coprod_of_isSeparator_right (G H : C) [HasBinaryCoproduct G H] (hH : IsSeparator H) : IsSeparator (G ⨿ H) := - (isSeparator_coprod _ _).2 <| IsSeparating.mono hH <| by simp - -lemma isSeparator_of_isColimit_cofan {β : Type w} {f : β → C} - (hf : IsSeparating (Set.range f)) {c : Cofan f} (hc : IsColimit c) : IsSeparator c.pt := by - refine (isSeparator_def _).2 fun X Y u v huv => hf _ _ fun Z hZ g => ?_ - obtain ⟨b, rfl⟩ := Set.mem_range.1 hZ - classical simpa using c.ι.app ⟨b⟩ ≫= huv (hc.desc (Cofan.mk _ (Pi.single b g))) - -theorem isSeparator_sigma {β : Type w} (f : β → C) [HasCoproduct f] : - IsSeparator (∐ f) ↔ IsSeparating (Set.range f) := by - refine ⟨fun h X Y u v huv => ?_, fun h => isSeparator_of_isColimit_cofan h (colimit.isColimit _)⟩ - refine h.def _ _ fun g => colimit.hom_ext fun b => ?_ - simpa using huv (f b.as) (by simp) (colimit.ι (Discrete.functor f) _ ≫ g) + (isSeparator_coprod _ _).2 <| ObjectProperty.IsSeparating.of_le hH <| by simp theorem IsSeparating.isSeparator_coproduct {β : Type w} {f : β → C} [HasCoproduct f] - (hS : IsSeparating (Set.range f)) : IsSeparator (∐ f) := + (hS : ObjectProperty.IsSeparating (.ofObj f)) : IsSeparator (∐ f) := (isSeparator_sigma _).2 hS theorem isSeparator_sigma_of_isSeparator {β : Type w} (f : β → C) [HasCoproduct f] (b : β) (hb : IsSeparator (f b)) : IsSeparator (∐ f) := - (isSeparator_sigma _).2 <| IsSeparating.mono hb <| by simp + (isSeparator_sigma _).2 <| ObjectProperty.IsSeparating.of_le hb <| by simp + +lemma isCoseparator_of_isLimit_fan {β : Type w} {f : β → C} + (hf : ObjectProperty.IsCoseparating (.ofObj f)) {c : Fan f} (hc : IsLimit c) : + IsCoseparator c.pt := by + rw [isCoseparator_def] + refine fun _ _ _ _ huv ↦ hf _ _ (fun _ h g ↦ ?_) + obtain ⟨b⟩ := h + classical simpa using huv (hc.lift (Fan.mk _ (Pi.single b g))) =≫ c.proj b + +lemma isCoseparator_iff_of_isLimit_fan {β : Type w} {f : β → C} + {c : Fan f} (hc : IsLimit c) : + IsCoseparator c.pt ↔ ObjectProperty.IsCoseparating (.ofObj f) := by + refine ⟨fun h X Y u v huv => ?_, fun h => isCoseparator_of_isLimit_fan h hc⟩ + refine h.def _ _ fun g => hc.hom_ext fun b => ?_ + simpa using huv (f b.as) (by simp) (g ≫ c.proj _) + +theorem isCoseparator_pi {β : Type w} (f : β → C) [HasProduct f] : + IsCoseparator (∏ᶜ f) ↔ ObjectProperty.IsCoseparating (.ofObj f) := + isCoseparator_iff_of_isLimit_fan (hc := limit.isLimit _) theorem isCoseparator_prod (G H : C) [HasBinaryProduct G H] : - IsCoseparator (G ⨯ H) ↔ IsCoseparating ({G, H} : Set C) := by - refine - ⟨fun h X Y u v huv => ?_, fun h => - (isCoseparator_def _).2 fun X Y u v huv => h _ _ fun Z hZ g => ?_⟩ - · refine h.def _ _ fun g => Limits.prod.hom_ext ?_ ?_ - · simpa using huv G (by simp) (g ≫ Limits.prod.fst) - · simpa using huv H (by simp) (g ≫ Limits.prod.snd) - · simp only [Set.mem_insert_iff, Set.mem_singleton_iff] at hZ - rcases hZ with (rfl | rfl) - · simpa using huv (prod.lift g 0) =≫ Limits.prod.fst - · simpa using huv (prod.lift 0 g) =≫ Limits.prod.snd + IsCoseparator (G ⨯ H) ↔ ObjectProperty.IsCoseparating (.pair G H) := by + refine (isCoseparator_iff_of_isLimit_fan (prodIsProd G H)).trans ?_ + convert Iff.rfl + ext X + simp only [ObjectProperty.prop_pair_iff, ObjectProperty.prop_ofObj_iff] + constructor + · rintro (rfl | rfl); exacts [⟨.left, rfl⟩, ⟨.right, rfl⟩] + · rintro ⟨⟨_ | _⟩, rfl⟩ <;> tauto theorem isCoseparator_prod_of_isCoseparator_left (G H : C) [HasBinaryProduct G H] (hG : IsCoseparator G) : IsCoseparator (G ⨯ H) := - (isCoseparator_prod _ _).2 <| IsCoseparating.mono hG <| by simp + (isCoseparator_prod _ _).2 <| ObjectProperty.IsCoseparating.of_le hG <| by simp theorem isCoseparator_prod_of_isCoseparator_right (G H : C) [HasBinaryProduct G H] (hH : IsCoseparator H) : IsCoseparator (G ⨯ H) := - (isCoseparator_prod _ _).2 <| IsCoseparating.mono hH <| by simp - -theorem isCoseparator_pi {β : Type w} (f : β → C) [HasProduct f] : - IsCoseparator (∏ᶜ f) ↔ IsCoseparating (Set.range f) := by - refine - ⟨fun h X Y u v huv => ?_, fun h => - (isCoseparator_def _).2 fun X Y u v huv => h _ _ fun Z hZ g => ?_⟩ - · refine h.def _ _ fun g => limit.hom_ext fun b => ?_ - simpa using huv (f b.as) (by simp) (g ≫ limit.π (Discrete.functor f) _) - · obtain ⟨b, rfl⟩ := Set.mem_range.1 hZ - classical simpa using huv (Pi.lift (Pi.single b g)) =≫ Pi.π f b + (isCoseparator_prod _ _).2 <| ObjectProperty.IsCoseparating.of_le hH <| by simp theorem isCoseparator_pi_of_isCoseparator {β : Type w} (f : β → C) [HasProduct f] (b : β) (hb : IsCoseparator (f b)) : IsCoseparator (∏ᶜ f) := - (isCoseparator_pi _).2 <| IsCoseparating.mono hb <| by simp + (isCoseparator_pi _).2 <| ObjectProperty.IsCoseparating.of_le hb <| by simp end ZeroMorphisms @@ -843,8 +870,6 @@ end Dual end HasGenerator -end ObjectProperty - @[deprecated (since := "2025-10-06")] alias IsSeparating := ObjectProperty.IsSeparating @[deprecated (since := "2025-10-06")] alias IsCoseparating := ObjectProperty.IsCoseparating @[deprecated (since := "2025-10-06")] alias IsDetecting := ObjectProperty.IsDetecting @@ -909,5 +934,13 @@ end ObjectProperty ObjectProperty.isGroupoid_of_isCodetecting_bot @[deprecated (since := "2025-10-06")] alias isCodetecting_empty_of_groupoid := ObjectProperty.isCodetecting_bot_of_isGroupoid +@[deprecated (since := "2025-10-07")] alias isSeparating_iff_epi := + ObjectProperty.isSeparating_iff_epi +@[deprecated (since := "2025-10-07")] alias isCoseparating_iff_mono := + ObjectProperty.isCoseparating_iff_mono +@[deprecated (since := "2025-10-07")] alias hasInitial_of_isCoseparating := + ObjectProperty.hasInitial_of_isCoseparating +@[deprecated (since := "2025-10-07")] alias hasTerminal_of_isSeparating := + ObjectProperty.hasTerminal_of_isSeparating end CategoryTheory diff --git a/Mathlib/CategoryTheory/ObjectProperty/Basic.lean b/Mathlib/CategoryTheory/ObjectProperty/Basic.lean index 210309b1408ea0..6f9454ea250227 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/Basic.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/Basic.lean @@ -57,6 +57,18 @@ lemma prop_map_obj (P : ObjectProperty C) (F : C ⥤ D) {X : C} (hX : P X) : P.map F (F.obj X) := ⟨X, hX, ⟨Iso.refl _⟩⟩ +/-- The strict image of a property of objects by a functor. -/ +inductive strictMap (P : ObjectProperty C) (F : C ⥤ D) : ObjectProperty D + | mk (X : C) (hX : P X) : strictMap P F (F.obj X) + +lemma prop_strictMap_iff (P : ObjectProperty C) (F : C ⥤ D) (Y : D) : + P.strictMap F Y ↔ ∃ (X : C), P X ∧ F.obj X = Y := + ⟨by rintro ⟨X, hX⟩; exact ⟨X, hX, rfl⟩, by rintro ⟨X, hX, rfl⟩; exact ⟨X, hX⟩⟩ + +lemma prop_strictMap_obj (P : ObjectProperty C) (F : C ⥤ D) {X : C} (hX : P X) : + P.strictMap F (F.obj X) := + ⟨X, hX⟩ + /-- The typeclass associated to `P : ObjectProperty C`. -/ @[mk_iff] class Is (P : ObjectProperty C) (X : C) : Prop where @@ -78,7 +90,7 @@ inductive ofObj : ObjectProperty C @[simp] lemma prop_ofObj (i : ι) : ofObj X (X i) := ⟨i⟩ -lemma ofObj_iff (Y : C) : ofObj X Y ↔ ∃ i, X i = Y := by +lemma prop_ofObj_iff (Y : C) : ofObj X Y ↔ ∃ i, X i = Y := by constructor · rintro ⟨i⟩ exact ⟨i, rfl⟩ @@ -89,19 +101,42 @@ lemma ofObj_le_iff (P : ObjectProperty C) : ofObj X ≤ P ↔ ∀ i, P (X i) := ⟨fun h i ↦ h _ (by simp), fun h ↦ by rintro _ ⟨i⟩; exact h i⟩ +@[simp] +lemma strictMap_ofObj (F : C ⥤ D) : + (ofObj X).strictMap F = ofObj (F.obj ∘ X) := by + ext Y + simp [prop_ofObj_iff, prop_strictMap_iff] + end -/-- The property of objects in a category that is satisfying by a single object `X : C`. -/ +/-- The property of objects in a category that is satisfied by a single object `X : C`. -/ abbrev singleton (X : C) : ObjectProperty C := ofObj (fun (_ : Unit) ↦ X) @[simp] -lemma singleton_iff (X Y : C) : singleton X Y ↔ X = Y := by simp [ofObj_iff] +lemma prop_singleton_iff (X Y : C) : singleton X Y ↔ X = Y := by simp [prop_ofObj_iff] @[simp] lemma singleton_le_iff {X : C} {P : ObjectProperty C} : singleton X ≤ P ↔ P X := by simp [ofObj_le_iff] +@[simp high] +lemma strictMap_singleton (X : C) (F : C ⥤ D) : + (singleton X).strictMap F = singleton (F.obj X) := by + ext + simp [prop_strictMap_iff] + +/-- The property of objects in a category that is satisfied by `X : C` and `Y : C`. -/ +def pair (X Y : C) : ObjectProperty C := + ofObj (Sum.elim (fun (_ : Unit) ↦ X) (fun (_ : Unit) ↦ Y)) + +@[simp] +lemma prop_pair_iff (X Y Z : C) : + pair X Y Z ↔ X = Z ∨ Y = Z := by + constructor + · rintro ⟨_ | _⟩ <;> tauto + · rintro (rfl | rfl); exacts [⟨Sum.inl .unit⟩, ⟨Sum.inr .unit⟩] + end ObjectProperty end CategoryTheory diff --git a/Mathlib/CategoryTheory/ObjectProperty/Opposite.lean b/Mathlib/CategoryTheory/ObjectProperty/Opposite.lean index a29ff32316363e..90344e9f12b61f 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/Opposite.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/Opposite.lean @@ -73,4 +73,34 @@ 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] +/-- The bijection `Subtype P.op ≃ Subtype P` for `P : ObjectProperty C`. -/ +def subtypeOpEquiv (P : ObjectProperty C) : + Subtype P.op ≃ Subtype P where + toFun x := ⟨x.1.unop, x.2⟩ + invFun x := ⟨op x.1, x.2⟩ + +@[simp] +lemma op_ofObj {ι : Type*} (X : ι → C) : (ofObj X).op = ofObj (fun i ↦ op (X i)) := by + ext Z + simp only [op_iff, prop_ofObj_iff] + constructor + · rintro ⟨i, hi⟩ + exact ⟨i, by rw [hi]⟩ + · rintro ⟨i, hi⟩ + exact ⟨i, by rw [← hi]⟩ + +@[simp] +lemma unop_ofObj {ι : Type*} (X : ι → Cᵒᵖ) : (ofObj X).unop = ofObj (fun i ↦ (X i).unop) := + op_injective ((op_ofObj _).symm) + +@[simp high] +lemma op_singleton (X : C) : + (singleton X).op = singleton (op X) := by + simp + +@[simp high] +lemma unop_singleton (X : Cᵒᵖ) : + (singleton X).unop = singleton X.unop := by + simp + end CategoryTheory.ObjectProperty diff --git a/Mathlib/CategoryTheory/ObjectProperty/Small.lean b/Mathlib/CategoryTheory/ObjectProperty/Small.lean index b1aeaff273e6f8..ba9e6a5736dbd7 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.Opposite import Mathlib.Logic.Small.Basic /-! @@ -33,4 +34,20 @@ lemma Small.of_le {P Q : ObjectProperty C} [ObjectProperty.Small.{w} Q] (h : P ObjectProperty.Small.{w} P := small_of_injective (Subtype.map_injective h Function.injective_id) +instance (P : ObjectProperty C) [ObjectProperty.Small.{w} P] : + ObjectProperty.Small.{w} P.op := + small_of_injective P.subtypeOpEquiv.injective + +instance (P : ObjectProperty Cᵒᵖ) [ObjectProperty.Small.{w} P] : + ObjectProperty.Small.{w} P.unop := by + simpa only [← small_congr P.unop.subtypeOpEquiv] + +instance {ι : Type*} (X : ι → C) [Small.{w} ι] : + ObjectProperty.Small.{w} (ofObj X) := + small_of_surjective (f := fun i ↦ ⟨X i, by simp⟩) (by rintro ⟨_, ⟨i⟩⟩;simp ) + +instance (X Y : C) : ObjectProperty.Small.{w} (.pair X Y) := by + dsimp [pair] + infer_instance + end CategoryTheory.ObjectProperty From 8189bf8d1d955f2d14a448a9233bd8a20bda0c72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 7 Oct 2025 10:48:10 +0200 Subject: [PATCH 109/309] fix --- Mathlib/CategoryTheory/Generator/Basic.lean | 25 ++++++++----------- .../Generator/HomologicalComplex.lean | 9 ++++--- .../CategoryTheory/Generator/Indization.lean | 3 ++- .../CategoryTheory/Generator/Preadditive.lean | 12 +++++---- .../CategoryTheory/Generator/Presheaf.lean | 10 ++++---- Mathlib/CategoryTheory/Generator/Sheaf.lean | 11 ++++---- 6 files changed, 36 insertions(+), 34 deletions(-) diff --git a/Mathlib/CategoryTheory/Generator/Basic.lean b/Mathlib/CategoryTheory/Generator/Basic.lean index 521c1c73de800c..8c134f34534683 100644 --- a/Mathlib/CategoryTheory/Generator/Basic.lean +++ b/Mathlib/CategoryTheory/Generator/Basic.lean @@ -314,7 +314,7 @@ theorem isCoseparating_iff_mono simp simpa using hh _ hG _ -variable {P} +end ObjectProperty /-- An ingredient of the proof of the Special Adjoint Functor Theorem: a complete well-powered category with a small coseparating set has an initial object. @@ -322,8 +322,8 @@ variable {P} In fact, it follows from the Special Adjoint Functor Theorem that `C` is already cocomplete, see `hasColimits_of_hasLimits_of_isCoseparating`. -/ theorem hasInitial_of_isCoseparating [LocallySmall.{w} C] [WellPowered.{w} C] - [HasLimitsOfSize.{w, w} C] [ObjectProperty.Small.{w} P] - (hP : IsCoseparating P) : HasInitial C := by + [HasLimitsOfSize.{w, w} C] {P : ObjectProperty C} [ObjectProperty.Small.{w} P] + (hP : P.IsCoseparating) : HasInitial C := by have := hasFiniteLimits_of_hasLimitsOfSize C haveI : HasProductsOfShape (Subtype P) C := hasProductsOfShape_of_small C (Subtype P) haveI := fun A => hasProductsOfShape_of_small.{w} C (Σ G : Subtype P, A ⟶ (G : C)) @@ -333,7 +333,7 @@ theorem hasInitial_of_isCoseparating [LocallySmall.{w} C] [WellPowered.{w} C] refine fun A => ⟨⟨?_⟩, fun f => ?_⟩ · let s := Pi.lift fun f : Σ G : Subtype P, A ⟶ (G : C) => Pi.π (Subtype.val : Subtype P → C) f.1 let t := Pi.lift (@Sigma.snd (Subtype P) fun G => A ⟶ (G : C)) - haveI : Mono t := (isCoseparating_iff_mono P).1 hP A + haveI : Mono t := P.isCoseparating_iff_mono.1 hP A exact Subobject.ofLEMk _ (pullback.fst _ _ : pullback s t ⟶ _) bot_le ≫ pullback.snd _ _ · suffices ∀ (g : Subobject.underlying.obj ⊥ ⟶ A), f = g by apply this @@ -349,13 +349,11 @@ theorem hasInitial_of_isCoseparating [LocallySmall.{w} C] [WellPowered.{w} C] In fact, it follows from the Special Adjoint Functor Theorem that `C` is already complete, see `hasLimits_of_hasColimits_of_isSeparating`. -/ theorem hasTerminal_of_isSeparating [LocallySmall.{w} Cᵒᵖ] [WellPowered.{w} Cᵒᵖ] - [HasColimitsOfSize.{w, w} C] [ObjectProperty.Small.{w} P] - (hP : IsSeparating P) : HasTerminal C := by - haveI : HasInitial Cᵒᵖ := hasInitial_of_isCoseparating ((isCoseparating_op_iff _).2 hP) + [HasColimitsOfSize.{w, w} C] {P : ObjectProperty C} [ObjectProperty.Small.{w} P] + (hP : P.IsSeparating) : HasTerminal C := by + haveI : HasInitial Cᵒᵖ := hasInitial_of_isCoseparating (P.isCoseparating_op_iff.2 hP) exact hasTerminal_of_hasInitial_op -end ObjectProperty - section WellPowered namespace Subobject @@ -607,7 +605,8 @@ theorem isSeparator_coprod_of_isSeparator_right (G H : C) [HasBinaryCoproduct G (hH : IsSeparator H) : IsSeparator (G ⨿ H) := (isSeparator_coprod _ _).2 <| ObjectProperty.IsSeparating.of_le hH <| by simp -theorem IsSeparating.isSeparator_coproduct {β : Type w} {f : β → C} [HasCoproduct f] +theorem ObjectProperty.IsSeparating.isSeparator_coproduct + {β : Type w} {f : β → C} [HasCoproduct f] (hS : ObjectProperty.IsSeparating (.ofObj f)) : IsSeparator (∐ f) := (isSeparator_sigma _).2 hS @@ -938,9 +937,7 @@ end HasGenerator ObjectProperty.isSeparating_iff_epi @[deprecated (since := "2025-10-07")] alias isCoseparating_iff_mono := ObjectProperty.isCoseparating_iff_mono -@[deprecated (since := "2025-10-07")] alias hasInitial_of_isCoseparating := - ObjectProperty.hasInitial_of_isCoseparating -@[deprecated (since := "2025-10-07")] alias hasTerminal_of_isSeparating := - ObjectProperty.hasTerminal_of_isSeparating +@[deprecated (since := "2025-10-07")] alias IsSeparating.isSeparator_coproduct := + ObjectProperty.IsSeparating.isSeparator_coproduct end CategoryTheory diff --git a/Mathlib/CategoryTheory/Generator/HomologicalComplex.lean b/Mathlib/CategoryTheory/Generator/HomologicalComplex.lean index cd3b90df9e64ef..65cc55e20f01ad 100644 --- a/Mathlib/CategoryTheory/Generator/HomologicalComplex.lean +++ b/Mathlib/CategoryTheory/Generator/HomologicalComplex.lean @@ -28,7 +28,7 @@ section variable [HasZeroMorphisms C] [HasZeroObject C] -variable {α : Type t} {X : α → C} (hX : IsSeparating (Set.range X)) +variable {α : Type t} {X : α → C} (hX : ObjectProperty.IsSeparating (.ofObj X)) variable (X) in /-- If `X : α → C` is a separating family, and `c : ComplexShape ι` has no loop, @@ -40,14 +40,15 @@ noncomputable def separatingFamily (j : α × ι) : HomologicalComplex C c := include hX in lemma isSeparating_separatingFamily : - IsSeparating (Set.range (separatingFamily c X)) := by + ObjectProperty.IsSeparating (.ofObj (separatingFamily c X)) := by intro K L f g h ext j apply hX - rintro _ ⟨a, rfl⟩ p + rintro _ ⟨a⟩ p have H := evalCompCoyonedaCorepresentable c (X a) j apply H.homEquiv.symm.injective - simpa only [H.homEquiv_symm_comp] using h _ ⟨⟨a, j⟩, rfl⟩ (H.homEquiv.symm p) + simpa only [H.homEquiv_symm_comp] using h _ + (ObjectProperty.prop_ofObj _ ⟨a, j⟩) (H.homEquiv.symm p) end diff --git a/Mathlib/CategoryTheory/Generator/Indization.lean b/Mathlib/CategoryTheory/Generator/Indization.lean index 370e9ed144d900..21a5ad8435b28c 100644 --- a/Mathlib/CategoryTheory/Generator/Indization.lean +++ b/Mathlib/CategoryTheory/Generator/Indization.lean @@ -25,7 +25,8 @@ section variable {C : Type u} [Category.{v} C] -theorem Ind.isSeparating_range_yoneda : IsSeparating (Set.range (Ind.yoneda : C ⥤ _).obj) := by +theorem Ind.isSeparating_range_yoneda : + ObjectProperty.IsSeparating (.ofObj (Ind.yoneda : C ⥤ _).obj) := by refine fun X Y f g h => (cancel_epi (Ind.colimitPresentationCompYoneda X).hom).1 ?_ exact colimit.hom_ext (fun i => by simp [← Category.assoc, h]) diff --git a/Mathlib/CategoryTheory/Generator/Preadditive.lean b/Mathlib/CategoryTheory/Generator/Preadditive.lean index 4df5b3357d3bbc..b0020c7e4e234f 100644 --- a/Mathlib/CategoryTheory/Generator/Preadditive.lean +++ b/Mathlib/CategoryTheory/Generator/Preadditive.lean @@ -17,19 +17,21 @@ preadditive categories. universe v u -open CategoryTheory Opposite +open CategoryTheory Opposite ObjectProperty namespace CategoryTheory variable {C : Type u} [Category.{v} C] [Preadditive C] -theorem Preadditive.isSeparating_iff (𝒢 : Set C) : - IsSeparating 𝒢 ↔ ∀ ⦃X Y : C⦄ (f : X ⟶ Y), (∀ G ∈ 𝒢, ∀ (h : G ⟶ X), h ≫ f = 0) → f = 0 := +theorem Preadditive.isSeparating_iff (P : ObjectProperty C) : + P.IsSeparating ↔ + ∀ ⦃X Y : C⦄ (f : X ⟶ Y), (∀ (G : C) (_ : P G), ∀ (h : G ⟶ X), h ≫ f = 0) → f = 0 := ⟨fun h𝒢 X Y f hf => h𝒢 _ _ (by simpa only [Limits.comp_zero] using hf), fun h𝒢 X Y f g hfg => sub_eq_zero.1 <| h𝒢 _ (by simpa only [Preadditive.comp_sub, sub_eq_zero] using hfg)⟩ -theorem Preadditive.isCoseparating_iff (𝒢 : Set C) : - IsCoseparating 𝒢 ↔ ∀ ⦃X Y : C⦄ (f : X ⟶ Y), (∀ G ∈ 𝒢, ∀ (h : Y ⟶ G), f ≫ h = 0) → f = 0 := +theorem Preadditive.isCoseparating_iff (P : ObjectProperty C) : + P.IsCoseparating ↔ + ∀ ⦃X Y : C⦄ (f : X ⟶ Y), (∀ (G : C) (_ : P G), ∀ (h : Y ⟶ G), f ≫ h = 0) → f = 0 := ⟨fun h𝒢 X Y f hf => h𝒢 _ _ (by simpa only [Limits.zero_comp] using hf), fun h𝒢 X Y f g hfg => sub_eq_zero.1 <| h𝒢 _ (by simpa only [Preadditive.sub_comp, sub_eq_zero] using hfg)⟩ diff --git a/Mathlib/CategoryTheory/Generator/Presheaf.lean b/Mathlib/CategoryTheory/Generator/Presheaf.lean index 61042589d44a2e..4b3aabd0aba800 100644 --- a/Mathlib/CategoryTheory/Generator/Presheaf.lean +++ b/Mathlib/CategoryTheory/Generator/Presheaf.lean @@ -63,17 +63,17 @@ lemma freeYonedaHomEquiv_symm_comp {X : C} {M : A} {F G : Cᵒᵖ ⥤ A} (α : M variable (C) -lemma isSeparating {ι : Type w} {S : ι → A} (hS : IsSeparating (Set.range S)) : - IsSeparating (Set.range (fun (⟨X, i⟩ : C × ι) ↦ freeYoneda X (S i))) := by +lemma isSeparating {ι : Type w} {S : ι → A} (hS : ObjectProperty.IsSeparating (.ofObj S)) : + ObjectProperty.IsSeparating (.ofObj (fun (⟨X, i⟩ : C × ι) ↦ freeYoneda X (S i))) := by intro F G f g h ext ⟨X⟩ refine hS _ _ ?_ - rintro _ ⟨i, rfl⟩ α + rintro _ ⟨i⟩ α apply freeYonedaHomEquiv.symm.injective simpa only [freeYonedaHomEquiv_symm_comp] using - h _ ⟨⟨X, i⟩, rfl⟩ (freeYonedaHomEquiv.symm α) + h _ (ObjectProperty.prop_ofObj _ ⟨X, i⟩) (freeYonedaHomEquiv.symm α) -lemma isSeparator {ι : Type w} {S : ι → A} (hS : IsSeparating (Set.range S)) +lemma isSeparator {ι : Type w} {S : ι → A} (hS : ObjectProperty.IsSeparating (.ofObj S)) [HasCoproduct (fun (⟨X, i⟩ : C × ι) ↦ freeYoneda X (S i))] [HasZeroMorphisms A] : IsSeparator (∐ (fun (⟨X, i⟩ : C × ι) ↦ freeYoneda X (S i))) := diff --git a/Mathlib/CategoryTheory/Generator/Sheaf.lean b/Mathlib/CategoryTheory/Generator/Sheaf.lean index 5539908fff9819..28452ee8575e94 100644 --- a/Mathlib/CategoryTheory/Generator/Sheaf.lean +++ b/Mathlib/CategoryTheory/Generator/Sheaf.lean @@ -40,16 +40,17 @@ noncomputable def freeYonedaHomEquiv {X : C} {M : A} {F : Sheaf J A} : (freeYoneda J X M ⟶ F) ≃ (M ⟶ F.val.obj (op X)) := ((sheafificationAdjunction J A).homEquiv _ _).trans Presheaf.freeYonedaHomEquiv -lemma isSeparating {ι : Type w} {S : ι → A} (hS : IsSeparating (Set.range S)) : - IsSeparating (Set.range (fun (⟨X, i⟩ : C × ι) ↦ freeYoneda J X (S i))) := by +lemma isSeparating {ι : Type w} {S : ι → A} (hS : ObjectProperty.IsSeparating (.ofObj S)) : + ObjectProperty.IsSeparating (.ofObj (fun (⟨X, i⟩ : C × ι) ↦ freeYoneda J X (S i))) := by intro F G f g hfg refine (sheafToPresheaf J A).map_injective (Presheaf.isSeparating C hS _ _ ?_) - rintro _ ⟨⟨X, i⟩, rfl⟩ a + rintro _ ⟨X, i⟩ a apply ((sheafificationAdjunction _ _).homEquiv _ _).symm.injective simpa only [← Adjunction.homEquiv_naturality_right_symm] using - hfg _ ⟨⟨X, i⟩, rfl⟩ (((sheafificationAdjunction _ _).homEquiv _ _).symm a) + hfg _ (ObjectProperty.prop_ofObj _ ⟨X, i⟩) + (((sheafificationAdjunction _ _).homEquiv _ _).symm a) -lemma isSeparator {ι : Type w} {S : ι → A} (hS : IsSeparating (Set.range S)) +lemma isSeparator {ι : Type w} {S : ι → A} (hS : ObjectProperty.IsSeparating (.ofObj S)) [HasCoproduct (fun (⟨X, i⟩ : C × ι) ↦ freeYoneda J X (S i))] [Preadditive A] : IsSeparator (∐ (fun (⟨X, i⟩ : C × ι) ↦ freeYoneda J X (S i))) := (isSeparating J hS).isSeparator_coproduct From 4c41a3a9b28a1c0560f1570526278c9ee6c783a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 7 Oct 2025 11:21:41 +0200 Subject: [PATCH 110/309] fix --- .../ModuleCat/Presheaf/Generator.lean | 15 +++++----- .../Adjunction/AdjointFunctorTheorems.lean | 28 +++++++++-------- .../Comma/StructuredArrow/Small.lean | 30 ++++++++++++++----- Mathlib/CategoryTheory/Generator/Basic.lean | 8 +++-- 4 files changed, 50 insertions(+), 31 deletions(-) diff --git a/Mathlib/Algebra/Category/ModuleCat/Presheaf/Generator.lean b/Mathlib/Algebra/Category/ModuleCat/Presheaf/Generator.lean index 624fbfffa33fd0..85e2df00afe01e 100644 --- a/Mathlib/Algebra/Category/ModuleCat/Presheaf/Generator.lean +++ b/Mathlib/Algebra/Category/ModuleCat/Presheaf/Generator.lean @@ -69,24 +69,23 @@ lemma freeYonedaEquiv_comp {M N : PresheafOfModules.{v} R} {X : C} variable (R) in /-- The set of `PresheafOfModules.{v} R` consisting of objects of the form `(free R).obj (yoneda.obj X)` for some `X`. -/ -def freeYoneda : Set (PresheafOfModules.{v} R) := Set.range (yoneda ⋙ free R).obj +def freeYoneda : ObjectProperty (PresheafOfModules.{v} R) := .ofObj (yoneda ⋙ free R).obj namespace freeYoneda -instance : Small.{u} (freeYoneda R) := by - let π : C → freeYoneda R := fun X ↦ ⟨_, ⟨X, rfl⟩⟩ - have hπ : Function.Surjective π := by rintro ⟨_, ⟨X, rfl⟩⟩; exact ⟨X, rfl⟩ - exact small_of_surjective hπ +instance : ObjectProperty.Small.{u} (freeYoneda R) := by + dsimp [freeYoneda] + infer_instance variable (R) -lemma isSeparating : IsSeparating (freeYoneda R) := by +lemma isSeparating : ObjectProperty.IsSeparating (freeYoneda R) := by intro M N f₁ f₂ h ext ⟨X⟩ m obtain ⟨g, rfl⟩ := freeYonedaEquiv.surjective m - exact congr_arg freeYonedaEquiv (h _ ⟨X, rfl⟩ g) + exact congr_arg freeYonedaEquiv (h _ ⟨X⟩ g) -lemma isDetecting : IsDetecting (freeYoneda R) := +lemma isDetecting : ObjectProperty.IsDetecting (freeYoneda R) := (isSeparating R).isDetecting end freeYoneda diff --git a/Mathlib/CategoryTheory/Adjunction/AdjointFunctorTheorems.lean b/Mathlib/CategoryTheory/Adjunction/AdjointFunctorTheorems.lean index 70462aa2882952..070991b00e932f 100644 --- a/Mathlib/CategoryTheory/Adjunction/AdjointFunctorTheorems.lean +++ b/Mathlib/CategoryTheory/Adjunction/AdjointFunctorTheorems.lean @@ -101,20 +101,22 @@ variable {D : Type u'} [Category.{v} D] well-powered and has a small coseparating set, then `G` has a left adjoint. -/ lemma isRightAdjoint_of_preservesLimits_of_isCoseparating [HasLimits D] [WellPowered.{v} D] - {𝒢 : Set D} [Small.{v} 𝒢] (h𝒢 : IsCoseparating 𝒢) (G : D ⥤ C) [PreservesLimits G] : - G.IsRightAdjoint := - have : ∀ A, HasInitial (StructuredArrow A G) := fun A => - hasInitial_of_isCoseparating (StructuredArrow.isCoseparating_proj_preimage A G h𝒢) - isRightAdjointOfStructuredArrowInitials _ + {P : ObjectProperty D} [ObjectProperty.Small.{v} P] + (hP : P.IsCoseparating) (G : D ⥤ C) [PreservesLimits G] : + G.IsRightAdjoint := by + have : ∀ A, HasInitial (StructuredArrow A G) := fun A ↦ + hasInitial_of_isCoseparating (StructuredArrow.isCoseparating_inverseImage_proj A G hP) + exact isRightAdjointOfStructuredArrowInitials _ /-- The special adjoint functor theorem: if `F : C ⥤ D` preserves colimits and `C` is cocomplete, well-copowered and has a small separating set, then `F` has a right adjoint. -/ lemma isLeftAdjoint_of_preservesColimits_of_isSeparating [HasColimits C] [WellPowered.{v} Cᵒᵖ] - {𝒢 : Set C} [Small.{v} 𝒢] (h𝒢 : IsSeparating 𝒢) (F : C ⥤ D) [PreservesColimits F] : + {P : ObjectProperty C} [ObjectProperty.Small.{v} P] + (h𝒢 : P.IsSeparating) (F : C ⥤ D) [PreservesColimits F] : F.IsLeftAdjoint := have : ∀ A, HasTerminal (CostructuredArrow F A) := fun A => - hasTerminal_of_isSeparating (CostructuredArrow.isSeparating_proj_preimage F A h𝒢) + hasTerminal_of_isSeparating (CostructuredArrow.isSeparating_inverseImage_proj F A h𝒢) isLeftAdjoint_of_costructuredArrowTerminals _ end SpecialAdjointFunctorTheorem @@ -123,19 +125,19 @@ namespace Limits /-- A consequence of the special adjoint functor theorem: if `C` is complete, well-powered and has a small coseparating set, then it is cocomplete. -/ -theorem hasColimits_of_hasLimits_of_isCoseparating [HasLimits C] [WellPowered.{v} C] {𝒢 : Set C} - [Small.{v} 𝒢] (h𝒢 : IsCoseparating 𝒢) : HasColimits C := +theorem hasColimits_of_hasLimits_of_isCoseparating [HasLimits C] [WellPowered.{v} C] + {P : ObjectProperty C} [ObjectProperty.Small.{v} P] (hP : P.IsCoseparating) : HasColimits C := { has_colimits_of_shape := fun _ _ => hasColimitsOfShape_iff_isRightAdjoint_const.2 - (isRightAdjoint_of_preservesLimits_of_isCoseparating h𝒢 _) } + (isRightAdjoint_of_preservesLimits_of_isCoseparating hP _) } /-- A consequence of the special adjoint functor theorem: if `C` is cocomplete, well-copowered and has a small separating set, then it is complete. -/ -theorem hasLimits_of_hasColimits_of_isSeparating [HasColimits C] [WellPowered.{v} Cᵒᵖ] {𝒢 : Set C} - [Small.{v} 𝒢] (h𝒢 : IsSeparating 𝒢) : HasLimits C := +theorem hasLimits_of_hasColimits_of_isSeparating [HasColimits C] [WellPowered.{v} Cᵒᵖ] + {P : ObjectProperty C} [ObjectProperty.Small.{v} P] (hP : P.IsSeparating) : HasLimits C := { has_limits_of_shape := fun _ _ => hasLimitsOfShape_iff_isLeftAdjoint_const.2 - (isLeftAdjoint_of_preservesColimits_of_isSeparating h𝒢 _) } + (isLeftAdjoint_of_preservesColimits_of_isSeparating hP _) } /-- A consequence of the special adjoint functor theorem: if `C` is complete, well-powered and has a separator, then it is complete. -/ diff --git a/Mathlib/CategoryTheory/Comma/StructuredArrow/Small.lean b/Mathlib/CategoryTheory/Comma/StructuredArrow/Small.lean index 85d468129e6558..80040b58ee5d96 100644 --- a/Mathlib/CategoryTheory/Comma/StructuredArrow/Small.lean +++ b/Mathlib/CategoryTheory/Comma/StructuredArrow/Small.lean @@ -5,6 +5,7 @@ Authors: Markus Himmel -/ import Mathlib.CategoryTheory.Comma.StructuredArrow.Basic import Mathlib.CategoryTheory.EssentiallySmall +import Mathlib.CategoryTheory.ObjectProperty.Small import Mathlib.Logic.Small.Set /-! @@ -25,12 +26,19 @@ namespace StructuredArrow variable {S : D} {T : C ⥤ D} -instance small_proj_preimage_of_locallySmall {𝒢 : Set C} [Small.{v₁} 𝒢] [LocallySmall.{v₁} D] : - Small.{v₁} ((proj S T).obj ⁻¹' 𝒢) := by - suffices (proj S T).obj ⁻¹' 𝒢 = Set.range fun f : Σ G : 𝒢, S ⟶ T.obj G => mk f.2 by +instance small_inverseImage_proj_of_locallySmall + {P : ObjectProperty C} [ObjectProperty.Small.{v₁} P] [LocallySmall.{v₁} D] : + ObjectProperty.Small.{v₁} (P.inverseImage (proj S T)) := by + suffices P.inverseImage (proj S T) = .ofObj fun f : Σ (G : Subtype P), S ⟶ T.obj G => mk f.2 by rw [this] infer_instance - exact Set.ext fun X => ⟨fun h => ⟨⟨⟨_, h⟩, X.hom⟩, (eq_mk _).symm⟩, by cat_disch⟩ + ext X + simp only [ObjectProperty.prop_inverseImage_iff, proj_obj, ObjectProperty.prop_ofObj_iff, + Sigma.exists, Subtype.exists, exists_prop] + exact ⟨fun h ↦ ⟨_, h, _, rfl⟩, by rintro ⟨_, h, _, rfl⟩; exact h⟩ + +@[deprecated (since := "2025-10-07")] alias small_proj_preimage_of_locallySmall := + small_inverseImage_proj_of_locallySmall end StructuredArrow @@ -38,13 +46,19 @@ namespace CostructuredArrow variable {S : C ⥤ D} {T : D} -instance small_proj_preimage_of_locallySmall {𝒢 : Set C} [Small.{v₁} 𝒢] [LocallySmall.{v₁} D] : - Small.{v₁} ((proj S T).obj ⁻¹' 𝒢) := by - suffices (proj S T).obj ⁻¹' 𝒢 = Set.range fun f : Σ G : 𝒢, S.obj G ⟶ T => mk f.2 by +instance small_inverseImage_proj_of_locallySmall + {P : ObjectProperty C} [ObjectProperty.Small.{v₁} P] [LocallySmall.{v₁} D] : + ObjectProperty.Small.{v₁} (P.inverseImage (proj S T)) := by + suffices P.inverseImage (proj S T) = .ofObj fun f : Σ (G : Subtype P), S.obj G ⟶ T => mk f.2 by rw [this] infer_instance - exact Set.ext fun X => ⟨fun h => ⟨⟨⟨_, h⟩, X.hom⟩, (eq_mk _).symm⟩, by cat_disch⟩ + ext X + simp only [ObjectProperty.prop_inverseImage_iff, proj_obj, ObjectProperty.prop_ofObj_iff, + Sigma.exists, Subtype.exists, exists_prop] + exact ⟨fun h ↦ ⟨_, h, _, rfl⟩, by rintro ⟨_, h, _, rfl⟩; exact h⟩ +@[deprecated (since := "2025-10-07")] alias small_proj_preimage_of_locallySmall := + small_inverseImage_proj_of_locallySmall end CostructuredArrow end CategoryTheory diff --git a/Mathlib/CategoryTheory/Generator/Basic.lean b/Mathlib/CategoryTheory/Generator/Basic.lean index 8c134f34534683..152068fd649a0a 100644 --- a/Mathlib/CategoryTheory/Generator/Basic.lean +++ b/Mathlib/CategoryTheory/Generator/Basic.lean @@ -400,7 +400,7 @@ namespace StructuredArrow variable (S : D) (T : C ⥤ D) -theorem isCoseparating_proj_preimage {P : ObjectProperty C} (hP : P.IsCoseparating) : +theorem isCoseparating_inverseImage_proj {P : ObjectProperty C} (hP : P.IsCoseparating) : (P.inverseImage (proj S T)).IsCoseparating := by refine fun X Y f g hfg => ext _ _ (hP _ _ fun G hG h => ?_) exact congr_arg CommaMorphism.right (hfg (mk (Y.hom ≫ T.map h)) hG (homMk h rfl)) @@ -411,7 +411,7 @@ namespace CostructuredArrow variable (S : C ⥤ D) (T : D) -theorem isSeparating_proj_preimage {P : ObjectProperty C} (hP : P.IsSeparating) : +theorem isSeparating_inverseImage_proj {P : ObjectProperty C} (hP : P.IsSeparating) : (P.inverseImage (proj S T)).IsSeparating := by refine fun X Y f g hfg => ext _ _ (hP _ _ fun G hG h => ?_) exact congr_arg CommaMorphism.left (hfg (mk (S.map h ≫ X.hom)) hG (homMk h rfl)) @@ -939,5 +939,9 @@ end HasGenerator ObjectProperty.isCoseparating_iff_mono @[deprecated (since := "2025-10-07")] alias IsSeparating.isSeparator_coproduct := ObjectProperty.IsSeparating.isSeparator_coproduct +@[deprecated (since := "2025-10-07")] alias StructuredArrow.isCoseparating_proj_preimage := + StructuredArrow.isCoseparating_inverseImage_proj +@[deprecated (since := "2025-10-07")] alias CostructuredArrow.isSeparating_proj_preimage := + CostructuredArrow.isSeparating_inverseImage_proj end CategoryTheory From 8c8bf906b018660f6110b06c569ec48ce53b4d21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 7 Oct 2025 11:31:54 +0200 Subject: [PATCH 111/309] fix --- Mathlib/Algebra/Category/ModuleCat/AB.lean | 8 ++++---- .../Abelian/GrothendieckCategory/EnoughInjectives.lean | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Mathlib/Algebra/Category/ModuleCat/AB.lean b/Mathlib/Algebra/Category/ModuleCat/AB.lean index 300c83cf121c7a..6aec76bedd4562 100644 --- a/Mathlib/Algebra/Category/ModuleCat/AB.lean +++ b/Mathlib/Algebra/Category/ModuleCat/AB.lean @@ -36,11 +36,11 @@ instance : AB4Star (ModuleCat.{u} R) where lemma ModuleCat.isSeparator [Small.{v} R] : IsSeparator (ModuleCat.of.{v} R (Shrink.{v} R)) := fun X Y f g h ↦ by - simp only [Set.mem_singleton_iff, forall_eq, ModuleCat.hom_ext_iff, LinearMap.ext_iff] at h + simp only [ObjectProperty.prop_singleton_iff, ModuleCat.hom_ext_iff, hom_comp, + LinearMap.ext_iff, LinearMap.coe_comp, Function.comp_apply, forall_eq'] at h ext x - simpa [Shrink.linearEquiv, Equiv.linearEquiv] using - h (ModuleCat.ofHom ((LinearMap.toSpanSingleton R X x).comp - (Shrink.linearEquiv R R : Shrink R →ₗ[R] R))) 1 + simpa using h (ModuleCat.ofHom ((LinearMap.toSpanSingleton R X x).comp + (Shrink.linearEquiv R R : Shrink R →ₗ[R] R))) 1 instance [Small.{v} R] : HasSeparator (ModuleCat.{v} R) where hasSeparator := ⟨ModuleCat.of R (Shrink.{v} R), ModuleCat.isSeparator R⟩ diff --git a/Mathlib/CategoryTheory/Abelian/GrothendieckCategory/EnoughInjectives.lean b/Mathlib/CategoryTheory/Abelian/GrothendieckCategory/EnoughInjectives.lean index 3a323a14d4dae5..090828e8c3df38 100644 --- a/Mathlib/CategoryTheory/Abelian/GrothendieckCategory/EnoughInjectives.lean +++ b/Mathlib/CategoryTheory/Abelian/GrothendieckCategory/EnoughInjectives.lean @@ -111,8 +111,8 @@ lemma exists_pushouts ∃ (X' : C) (i : X ⟶ X') (p' : X' ⟶ Y) (_ : (generatingMonomorphisms G).pushouts i) (_ : ¬ IsIso i) (_ : Mono p'), i ≫ p' = p := by rw [hG.isDetector.isIso_iff_of_mono] at hp - simp only [coyoneda_obj_obj, coyoneda_obj_map, Set.mem_singleton_iff, forall_eq, - Function.Surjective, not_forall, not_exists] at hp + simp only [ObjectProperty.prop_singleton_iff, Function.Surjective, coyoneda_obj_obj, + coyoneda_obj_map, forall_eq', not_forall, not_exists] at hp -- `f : G ⟶ Y` is a monomorphism the image of which is not contained in `X` obtain ⟨f, hf⟩ := hp -- we use the subobject `X'` of `Y` that is generated by the images of `p : X ⟶ Y` From bf53e9de3c245deecc90789d7536eb7f0c801e68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 7 Oct 2025 11:38:10 +0200 Subject: [PATCH 112/309] fix --- .../GrothendieckCategory/ModuleEmbedding/GabrielPopescu.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Abelian/GrothendieckCategory/ModuleEmbedding/GabrielPopescu.lean b/Mathlib/CategoryTheory/Abelian/GrothendieckCategory/ModuleEmbedding/GabrielPopescu.lean index d65dd4bc03c818..1a99e5b1c10c09 100644 --- a/Mathlib/CategoryTheory/Abelian/GrothendieckCategory/ModuleEmbedding/GabrielPopescu.lean +++ b/Mathlib/CategoryTheory/Abelian/GrothendieckCategory/ModuleEmbedding/GabrielPopescu.lean @@ -40,7 +40,7 @@ namespace CategoryTheory.IsGrothendieckAbelian variable {C : Type u} [Category.{v} C] [Abelian C] [IsGrothendieckAbelian.{v} C] instance {G : C} : (preadditiveCoyonedaObj G).IsRightAdjoint := - isRightAdjoint_of_preservesLimits_of_isCoseparating (isCoseparator_coseparator _) _ + isRightAdjoint_of_preservesLimits_of_isCoseparating.{v} (isCoseparator_coseparator _) _ /-- The left adjoint of the functor `Hom(G, ·)`, which can be thought of as `· ⊗ G`. -/ noncomputable def tensorObj (G : C) : ModuleCat (End G)ᵐᵒᵖ ⥤ C := From 03da717014c10806db11755f8c2d1949b738a7f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 7 Oct 2025 11:42:13 +0200 Subject: [PATCH 113/309] feat(CategoryTheory): the opposite of a property of objects --- Mathlib.lean | 1 + .../CategoryTheory/ObjectProperty/Basic.lean | 71 ++++++++++++ .../ObjectProperty/Opposite.lean | 106 ++++++++++++++++++ .../CategoryTheory/ObjectProperty/Small.lean | 17 +++ 4 files changed, 195 insertions(+) create mode 100644 Mathlib/CategoryTheory/ObjectProperty/Opposite.lean diff --git a/Mathlib.lean b/Mathlib.lean index 985f244b4c64f4..afc86a026ab940 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -2668,6 +2668,7 @@ import Mathlib.CategoryTheory.ObjectProperty.Extensions import Mathlib.CategoryTheory.ObjectProperty.FullSubcategory import Mathlib.CategoryTheory.ObjectProperty.Ind 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/Basic.lean b/Mathlib/CategoryTheory/ObjectProperty/Basic.lean index 7cf7a47eb945ba..6f9454ea250227 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/Basic.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/Basic.lean @@ -57,6 +57,18 @@ lemma prop_map_obj (P : ObjectProperty C) (F : C ⥤ D) {X : C} (hX : P X) : P.map F (F.obj X) := ⟨X, hX, ⟨Iso.refl _⟩⟩ +/-- The strict image of a property of objects by a functor. -/ +inductive strictMap (P : ObjectProperty C) (F : C ⥤ D) : ObjectProperty D + | mk (X : C) (hX : P X) : strictMap P F (F.obj X) + +lemma prop_strictMap_iff (P : ObjectProperty C) (F : C ⥤ D) (Y : D) : + P.strictMap F Y ↔ ∃ (X : C), P X ∧ F.obj X = Y := + ⟨by rintro ⟨X, hX⟩; exact ⟨X, hX, rfl⟩, by rintro ⟨X, hX, rfl⟩; exact ⟨X, hX⟩⟩ + +lemma prop_strictMap_obj (P : ObjectProperty C) (F : C ⥤ D) {X : C} (hX : P X) : + P.strictMap F (F.obj X) := + ⟨X, hX⟩ + /-- The typeclass associated to `P : ObjectProperty C`. -/ @[mk_iff] class Is (P : ObjectProperty C) (X : C) : Prop where @@ -66,6 +78,65 @@ 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] +section + +variable {ι : Type u'} (X : ι → C) + +/-- The property of objects that is satisfied by the `X i` for a family +of objects `X : ι : C`. -/ +inductive ofObj : ObjectProperty C + | mk (i : ι) : ofObj (X i) + +@[simp] +lemma prop_ofObj (i : ι) : ofObj X (X i) := ⟨i⟩ + +lemma prop_ofObj_iff (Y : C) : ofObj X Y ↔ ∃ i, X i = Y := by + constructor + · rintro ⟨i⟩ + exact ⟨i, rfl⟩ + · rintro ⟨i, rfl⟩ + exact ⟨i⟩ + +lemma ofObj_le_iff (P : ObjectProperty C) : + ofObj X ≤ P ↔ ∀ i, P (X i) := + ⟨fun h i ↦ h _ (by simp), fun h ↦ by rintro _ ⟨i⟩; exact h i⟩ + +@[simp] +lemma strictMap_ofObj (F : C ⥤ D) : + (ofObj X).strictMap F = ofObj (F.obj ∘ X) := by + ext Y + simp [prop_ofObj_iff, prop_strictMap_iff] + +end + +/-- The property of objects in a category that is satisfied by a single object `X : C`. -/ +abbrev singleton (X : C) : ObjectProperty C := ofObj (fun (_ : Unit) ↦ X) + +@[simp] +lemma prop_singleton_iff (X Y : C) : singleton X Y ↔ X = Y := by simp [prop_ofObj_iff] + +@[simp] +lemma singleton_le_iff {X : C} {P : ObjectProperty C} : + singleton X ≤ P ↔ P X := by + simp [ofObj_le_iff] + +@[simp high] +lemma strictMap_singleton (X : C) (F : C ⥤ D) : + (singleton X).strictMap F = singleton (F.obj X) := by + ext + simp [prop_strictMap_iff] + +/-- The property of objects in a category that is satisfied by `X : C` and `Y : C`. -/ +def pair (X Y : C) : ObjectProperty C := + ofObj (Sum.elim (fun (_ : Unit) ↦ X) (fun (_ : Unit) ↦ Y)) + +@[simp] +lemma prop_pair_iff (X Y Z : C) : + pair X Y Z ↔ X = Z ∨ Y = Z := by + constructor + · rintro ⟨_ | _⟩ <;> tauto + · rintro (rfl | rfl); exacts [⟨Sum.inl .unit⟩, ⟨Sum.inr .unit⟩] + end ObjectProperty end CategoryTheory diff --git a/Mathlib/CategoryTheory/ObjectProperty/Opposite.lean b/Mathlib/CategoryTheory/ObjectProperty/Opposite.lean new file mode 100644 index 00000000000000..90344e9f12b61f --- /dev/null +++ b/Mathlib/CategoryTheory/ObjectProperty/Opposite.lean @@ -0,0 +1,106 @@ +/- +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] + +/-- The bijection `Subtype P.op ≃ Subtype P` for `P : ObjectProperty C`. -/ +def subtypeOpEquiv (P : ObjectProperty C) : + Subtype P.op ≃ Subtype P where + toFun x := ⟨x.1.unop, x.2⟩ + invFun x := ⟨op x.1, x.2⟩ + +@[simp] +lemma op_ofObj {ι : Type*} (X : ι → C) : (ofObj X).op = ofObj (fun i ↦ op (X i)) := by + ext Z + simp only [op_iff, prop_ofObj_iff] + constructor + · rintro ⟨i, hi⟩ + exact ⟨i, by rw [hi]⟩ + · rintro ⟨i, hi⟩ + exact ⟨i, by rw [← hi]⟩ + +@[simp] +lemma unop_ofObj {ι : Type*} (X : ι → Cᵒᵖ) : (ofObj X).unop = ofObj (fun i ↦ (X i).unop) := + op_injective ((op_ofObj _).symm) + +@[simp high] +lemma op_singleton (X : C) : + (singleton X).op = singleton (op X) := by + simp + +@[simp high] +lemma unop_singleton (X : Cᵒᵖ) : + (singleton X).unop = singleton X.unop := by + simp + +end CategoryTheory.ObjectProperty diff --git a/Mathlib/CategoryTheory/ObjectProperty/Small.lean b/Mathlib/CategoryTheory/ObjectProperty/Small.lean index b1aeaff273e6f8..ba9e6a5736dbd7 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.Opposite import Mathlib.Logic.Small.Basic /-! @@ -33,4 +34,20 @@ lemma Small.of_le {P Q : ObjectProperty C} [ObjectProperty.Small.{w} Q] (h : P ObjectProperty.Small.{w} P := small_of_injective (Subtype.map_injective h Function.injective_id) +instance (P : ObjectProperty C) [ObjectProperty.Small.{w} P] : + ObjectProperty.Small.{w} P.op := + small_of_injective P.subtypeOpEquiv.injective + +instance (P : ObjectProperty Cᵒᵖ) [ObjectProperty.Small.{w} P] : + ObjectProperty.Small.{w} P.unop := by + simpa only [← small_congr P.unop.subtypeOpEquiv] + +instance {ι : Type*} (X : ι → C) [Small.{w} ι] : + ObjectProperty.Small.{w} (ofObj X) := + small_of_surjective (f := fun i ↦ ⟨X i, by simp⟩) (by rintro ⟨_, ⟨i⟩⟩;simp ) + +instance (X Y : C) : ObjectProperty.Small.{w} (.pair X Y) := by + dsimp [pair] + infer_instance + end CategoryTheory.ObjectProperty From 079c5abecb2159a451a2254bae0c8702e7bd2ff6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 7 Oct 2025 11:50:52 +0200 Subject: [PATCH 114/309] fix --- Mathlib/CategoryTheory/Comma/StructuredArrow/Small.lean | 1 - 1 file changed, 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Comma/StructuredArrow/Small.lean b/Mathlib/CategoryTheory/Comma/StructuredArrow/Small.lean index 80040b58ee5d96..f9e87398ce41b9 100644 --- a/Mathlib/CategoryTheory/Comma/StructuredArrow/Small.lean +++ b/Mathlib/CategoryTheory/Comma/StructuredArrow/Small.lean @@ -6,7 +6,6 @@ Authors: Markus Himmel import Mathlib.CategoryTheory.Comma.StructuredArrow.Basic import Mathlib.CategoryTheory.EssentiallySmall import Mathlib.CategoryTheory.ObjectProperty.Small -import Mathlib.Logic.Small.Set /-! # Small sets in the category of structured arrows From 950f503d0ac337e6a311321b481175b97e1559f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 7 Oct 2025 14:49:38 +0200 Subject: [PATCH 115/309] use pointwise left Kan extensions --- Mathlib.lean | 2 +- .../Functor/KanExtension/DenseAt.lean | 98 +++++++++++++++++++ .../Functor/KanExtension/Pointwise.lean | 31 +++++- Mathlib/CategoryTheory/Limits/Canonical.lean | 71 -------------- 4 files changed, 129 insertions(+), 73 deletions(-) create mode 100644 Mathlib/CategoryTheory/Functor/KanExtension/DenseAt.lean delete mode 100644 Mathlib/CategoryTheory/Limits/Canonical.lean diff --git a/Mathlib.lean b/Mathlib.lean index 41b98cd5bc9442..f5cae20ab739a7 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -2281,6 +2281,7 @@ import Mathlib.CategoryTheory.Functor.Functorial import Mathlib.CategoryTheory.Functor.Hom import Mathlib.CategoryTheory.Functor.KanExtension.Adjunction import Mathlib.CategoryTheory.Functor.KanExtension.Basic +import Mathlib.CategoryTheory.Functor.KanExtension.DenseAt import Mathlib.CategoryTheory.Functor.KanExtension.Pointwise import Mathlib.CategoryTheory.Functor.KanExtension.Preserves import Mathlib.CategoryTheory.Functor.OfSequence @@ -2348,7 +2349,6 @@ import Mathlib.CategoryTheory.LiftingProperties.Basic import Mathlib.CategoryTheory.LiftingProperties.Limits import Mathlib.CategoryTheory.LiftingProperties.ParametrizedAdjunction import Mathlib.CategoryTheory.Limits.Bicones -import Mathlib.CategoryTheory.Limits.Canonical import Mathlib.CategoryTheory.Limits.ColimitLimit import Mathlib.CategoryTheory.Limits.Comma import Mathlib.CategoryTheory.Limits.ConcreteCategory.Basic diff --git a/Mathlib/CategoryTheory/Functor/KanExtension/DenseAt.lean b/Mathlib/CategoryTheory/Functor/KanExtension/DenseAt.lean new file mode 100644 index 00000000000000..967eac56e019b8 --- /dev/null +++ b/Mathlib/CategoryTheory/Functor/KanExtension/DenseAt.lean @@ -0,0 +1,98 @@ +/- +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.Functor.KanExtension.Pointwise + +/-! +# Canonical colimits, or functors that are dense at an object + +Given a functor `F : C ⥤ D` and `Y : D`, we say that `F` is dense at `Y` (`F.DenseAt Y`), +if `Y` identifies to the colimit of all `F.obj X` for `X : C` +and `f : F.obj X ⟶ Y`, i.e. `Y` identifies to the colimit of +the obvious functor `CostructuredArrow F Y ⥤ D`. In some references, +it is also said that `Y` is a canonical colimit relatively to `F`. +While `F.DenseAt Y` contains data, we also introduce the +corresponding property `isDenseAt F` of objects of `D`. + +## TODO + +* formalize dense subcategories +* show the presheaves of types are canonical colimits relatively +to the Yoneda embedding + +## References +* https://ncatlab.org/nlab/show/dense+functor + +-/ + +universe v₁ v₂ u₁ u₂ + +namespace CategoryTheory + +open Limits + +variable {C : Type u₁} {D : Type u₂} [Category.{v₁} C] [Category.{v₂} D] + (F : C ⥤ D) + +namespace Functor + +/-- A functor `F : C ⥤ D` is dense at `Y : D` if the obvious natural transformation +`F ⟶ F ⋙ 𝟭 D` makes `𝟭 D` a pointwise left Kan extension of `F` along itself at `Y`, +i.e. `Y` identifies to the colimit of the obvious functor `CostructuredArrow F Y ⥤ D`. -/ +abbrev DenseAt (Y : D) : Type max u₁ u₂ v₂ := + (Functor.LeftExtension.mk (𝟭 D) F.rightUnitor.inv).IsPointwiseLeftKanExtensionAt Y + +variable {F} {Y : D} (hY : F.DenseAt Y) + +/-- If `F : C ⥤ D` is dense at `Y : D`, then it is also at `Y'` +if `Y` and `Y'` are isomorphic. -/ +def DenseAt.ofIso {Y' : D} (e : Y ≅ Y') : F.DenseAt Y' := + LeftExtension.isPointwiseLeftKanExtensionAtOfIso' _ hY e + +/-- If `F : C ⥤ D` is dense at `Y : D`, and `G` is a functor that is isomorphic to `F`, +then `G` is also dense at `Y`. -/ +def DenseAt.ofNatIso {G : C ⥤ D} (e : F ≅ G) : G.DenseAt Y := + (IsColimit.equivOfNatIsoOfIso + ((Functor.associator _ _ _).symm ≪≫ Functor.isoWhiskerLeft _ e) _ _ + (by exact Cocones.ext (Iso.refl _))).1 + (hY.whiskerEquivalence (CostructuredArrow.mapNatIso e.symm)) + +/-- If `F : C ⥤ D` is dense at `Y : D`, then so is `G ⋙ F` if `G` is an equivalence. -/ +noncomputable def DenseAt.precompEquivalence + {C' : Type*} [Category C'] (G : C' ⥤ C) [G.IsEquivalence] : + (G ⋙ F).DenseAt Y := + hY.whiskerEquivalence (CostructuredArrow.pre G F Y).asEquivalence + +/-- If `F : C ⥤ D` is dense at `Y : D` and `G : D ⥤ D'` is an equivalence, +then `F ⋙ G` is dense at `G.obj Y`. -/ +noncomputable def DenseAt.postcompEquivalence + {D' : Type*} [Category D'] (G : D ⥤ D') [G.IsEquivalence] : + (F ⋙ G).DenseAt (G.obj Y) := + IsColimit.ofWhiskerEquivalence (CostructuredArrow.post F G Y).asEquivalence + (IsColimit.ofIsoColimit ((isColimitOfPreserves G hY)) (Cocones.ext (Iso.refl _))) + +variable (F) in +/-- Given a functor `F : C ⥤ D`, this is the property of objects `Y : D` such +that `F` is dense at `Y`. -/ +def isDenseAt : ObjectProperty D := + fun Y ↦ Nonempty (F.DenseAt Y) + +lemma isDenseAt_eq_isPointwiseLeftKanExtensionAt : + F.isDenseAt = + (Functor.LeftExtension.mk (𝟭 D) F.rightUnitor.inv).isPointwiseLeftKanExtensionAt := + rfl + +instance : F.isDenseAt.IsClosedUnderIsomorphisms := by + rw [isDenseAt_eq_isPointwiseLeftKanExtensionAt] + infer_instance + +lemma congr_isDenseAt {G : C ⥤ D} (e : F ≅ G) : + F.isDenseAt = G.isDenseAt := by + ext X + exact ⟨fun ⟨h⟩ ↦ ⟨h.ofNatIso e⟩, fun ⟨h⟩ ↦ ⟨h.ofNatIso e.symm⟩⟩ + +end Functor + +end CategoryTheory diff --git a/Mathlib/CategoryTheory/Functor/KanExtension/Pointwise.lean b/Mathlib/CategoryTheory/Functor/KanExtension/Pointwise.lean index d486715a0e30ab..f9f4c21a3dd59a 100644 --- a/Mathlib/CategoryTheory/Functor/KanExtension/Pointwise.lean +++ b/Mathlib/CategoryTheory/Functor/KanExtension/Pointwise.lean @@ -226,6 +226,12 @@ namespace IsPointwiseLeftKanExtensionAt variable {E} {Y : D} (h : E.IsPointwiseLeftKanExtensionAt Y) +include h in +lemma hom_ext' {T : H} {f g : E.right.obj Y ⟶ T} + (hfg : ∀ ⦃X : C⦄ (φ : L.obj X ⟶ Y), + E.hom.app X ≫ E.right.map φ ≫ f = E.hom.app X ≫ E.right.map φ ≫ g) : f = g := + h.hom_ext (fun j ↦ by simpa using hfg j.hom) + @[reassoc] lemma comp_homEquiv_symm {Z : H} (φ : CostructuredArrow.proj L Y ⋙ F ⟶ (Functor.const _).obj Z) @@ -254,6 +260,14 @@ lemma ι_isoColimit_hom (g : CostructuredArrow L Y) : end IsPointwiseLeftKanExtensionAt +/-- Given `E : Functor.LeftExtension L F`, this is the property of objects where +`E` is a pointwise left Kan extension. -/ +def isPointwiseLeftKanExtensionAt : ObjectProperty D := + fun Y ↦ Nonempty (E.IsPointwiseLeftKanExtensionAt Y) + +instance : E.isPointwiseLeftKanExtensionAt.IsClosedUnderIsomorphisms where + of_iso e h := ⟨E.isPointwiseLeftKanExtensionAtOfIso' h.some e⟩ + /-- A left extension `E : LeftExtension L F` is a pointwise left Kan extension when it is a pointwise left Kan extension at any object. -/ abbrev IsPointwiseLeftKanExtension := ∀ (Y : D), E.IsPointwiseLeftKanExtensionAt Y @@ -391,7 +405,14 @@ def isPointwiseRightKanExtensionAtEquivOfIso' {Y Y' : D} (e : Y ≅ Y') : namespace IsPointwiseRightKanExtensionAt variable {E} {Y : D} (h : E.IsPointwiseRightKanExtensionAt Y) - [HasLimit (StructuredArrow.proj Y L ⋙ F)] + +include h in +lemma hom_ext' {T : H} {f g : T ⟶ E.left.obj Y} + (hfg : ∀ ⦃X : C⦄ (φ : Y ⟶ L.obj X), + f ≫ E.left.map φ ≫ E.hom.app X = g ≫ E.left.map φ ≫ E.hom.app X) : f = g := + h.hom_ext (fun j ↦ hfg j.hom) + +variable [HasLimit (StructuredArrow.proj Y L ⋙ F)] /-- A pointwise right Kan extension of `F` along `L` applied to an object `Y` is isomorphic to `limit (StructuredArrow.proj Y L ⋙ F)`. -/ @@ -412,6 +433,14 @@ lemma isoLimit_inv_π (g : StructuredArrow Y L) : end IsPointwiseRightKanExtensionAt +/-- Given `E : Functor.LeftExtension L F`, this is the property of objects where +`E` is a pointwise right Kan extension. -/ +def isPointwiseRightKanExtensionAt : ObjectProperty D := + fun Y ↦ Nonempty (E.IsPointwiseRightKanExtensionAt Y) + +instance : E.isPointwiseRightKanExtensionAt.IsClosedUnderIsomorphisms where + of_iso e h := ⟨E.isPointwiseRightKanExtensionAtOfIso' h.some e⟩ + /-- A right extension `E : RightExtension L F` is a pointwise right Kan extension when it is a pointwise right Kan extension at any object. -/ abbrev IsPointwiseRightKanExtension := ∀ (Y : D), E.IsPointwiseRightKanExtensionAt Y diff --git a/Mathlib/CategoryTheory/Limits/Canonical.lean b/Mathlib/CategoryTheory/Limits/Canonical.lean deleted file mode 100644 index d7dbb757568783..00000000000000 --- a/Mathlib/CategoryTheory/Limits/Canonical.lean +++ /dev/null @@ -1,71 +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.Limits.IsLimit -import Mathlib.CategoryTheory.Comma.StructuredArrow.Basic - -/-! -# Canonical colimits - -Given a functor `F : C ⥤ D` and `Y : D`, we say that `Y` is a -canonical colimit relatively to `F` if `Y` identifies to the -colimit of all `F.obj X` for `X : C` and `f : F.obj X ⟶ Y`, -i.e. `Y` identifies to the colimit of the obvious functor -`CostructuredArrow F Y ⥤ D` (see definitions `canonicalCocone` -and `CanonicalColimit`). We introduce the corresponding property -`isCanonicalColimit F` of objects of `D`. - -## TODO - -* formalize dense subcategories -* show the presheaves of types are canonical colimits relatively -to the Yoneda embedding - -## References -* https://ncatlab.org/nlab/show/dense+functor - --/ - -universe v₁ v₂ u₁ u₂ - -namespace CategoryTheory - -open Limits - -variable {C : Type u₁} {D : Type u₂} [Category.{v₁} C] [Category.{v₂} D] - (F : C ⥤ D) - -namespace Limits - -/-- Given a functor `F : C ⥤ D` and `Y : D`, this is the canonical cocone -with point `Y` for the functor -`CostructuredArrow.proj F Y ⋙ F : CostructuredArrow F Y ⥤ D`. -/ -@[simps] -def canonicalCocone (Y : D) : - Cocone (CostructuredArrow.proj F Y ⋙ F) where - pt := Y - ι := { app f := f.hom } - -/-- An object `Y : D` is a canonical colimit relatively to `F : C ⥤ D` -when `canonicalCocone F Y` is colimit, i.e. `Y` identifies to the -colimit of all `F.obj X` for `X : C` and `f : F.obj X ⟶ Y`. -/ -abbrev CanonicalColimit (Y : D) : Type _ := IsColimit (canonicalCocone F Y) - -end Limits - -/-- Given a functor `F : C ⥤ D`, this is the property that an object `Y : D` -is a canonical colimit relatively to `F`, i.e. `Y` identifies to the -colimit of all `F.obj X` for `X : C` and `f : F.obj X ⟶ Y`. -/ -def Functor.isCanonicalColimit : ObjectProperty D := - fun Y ↦ Nonempty (CanonicalColimit F Y) - -variable {F} in -lemma Functor.isCanonicalColimit.hom_ext - {Y : D} (hY : F.isCanonicalColimit Y) - {T : D} {f g : Y ⟶ T} - (h : ∀ (X : C) (p : F.obj X ⟶ Y), p ≫ f = p ≫ g) : f = g := - hY.some.hom_ext (fun _ ↦ h _ _) - -end CategoryTheory From 69bd04eb0d662367b12e15816cf917fc010d4af9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 7 Oct 2025 14:51:20 +0200 Subject: [PATCH 116/309] typo --- Mathlib/CategoryTheory/Functor/KanExtension/Pointwise.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Functor/KanExtension/Pointwise.lean b/Mathlib/CategoryTheory/Functor/KanExtension/Pointwise.lean index f9f4c21a3dd59a..2e95321b2454ec 100644 --- a/Mathlib/CategoryTheory/Functor/KanExtension/Pointwise.lean +++ b/Mathlib/CategoryTheory/Functor/KanExtension/Pointwise.lean @@ -433,7 +433,7 @@ lemma isoLimit_inv_π (g : StructuredArrow Y L) : end IsPointwiseRightKanExtensionAt -/-- Given `E : Functor.LeftExtension L F`, this is the property of objects where +/-- Given `E : Functor.RightExtension L F`, this is the property of objects where `E` is a pointwise right Kan extension. -/ def isPointwiseRightKanExtensionAt : ObjectProperty D := fun Y ↦ Nonempty (E.IsPointwiseRightKanExtensionAt Y) From 33a42d78111220b2380429bac5e214cb09f3cdd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 7 Oct 2025 17:25:29 +0200 Subject: [PATCH 117/309] wip --- .../Comma/StructuredArrow/Small.lean | 14 +- Mathlib/CategoryTheory/Generator/Basic.lean | 127 +++++++++--- .../Generator/StrongGenerator.lean | 188 ++++++------------ 3 files changed, 172 insertions(+), 157 deletions(-) diff --git a/Mathlib/CategoryTheory/Comma/StructuredArrow/Small.lean b/Mathlib/CategoryTheory/Comma/StructuredArrow/Small.lean index f9e87398ce41b9..d37e489e39085c 100644 --- a/Mathlib/CategoryTheory/Comma/StructuredArrow/Small.lean +++ b/Mathlib/CategoryTheory/Comma/StructuredArrow/Small.lean @@ -17,7 +17,7 @@ be used in the proof of the Special Adjoint Functor Theorem. namespace CategoryTheory -- morphism levels before object levels. See note [CategoryTheory universes]. -universe v₁ v₂ u₁ u₂ +universe w v₁ v₂ u₁ u₂ variable {C : Type u₁} [Category.{v₁} C] {D : Type u₂} [Category.{v₂} D] @@ -25,6 +25,12 @@ namespace StructuredArrow variable {S : D} {T : C ⥤ D} +instance [Small.{w} C] [LocallySmall.{w} D] : Small.{w} (StructuredArrow S T) := + small_of_surjective (f := fun (f : Σ (X : C), S ⟶ T.obj X) ↦ StructuredArrow.mk f.2) + (fun f ↦ by + obtain ⟨X, f, rfl⟩ := f.mk_surjective + exact ⟨⟨X, f⟩, rfl⟩) + instance small_inverseImage_proj_of_locallySmall {P : ObjectProperty C} [ObjectProperty.Small.{v₁} P] [LocallySmall.{v₁} D] : ObjectProperty.Small.{v₁} (P.inverseImage (proj S T)) := by @@ -45,6 +51,12 @@ namespace CostructuredArrow variable {S : C ⥤ D} {T : D} +instance [Small.{w} C] [LocallySmall.{w} D] : Small.{w} (CostructuredArrow S T) := + small_of_surjective (f := fun (f : Σ (X : C), S.obj X ⟶ T) ↦ CostructuredArrow.mk f.2) + (fun f ↦ by + obtain ⟨X, f, rfl⟩ := f.mk_surjective + exact ⟨⟨X, f⟩, rfl⟩) + instance small_inverseImage_proj_of_locallySmall {P : ObjectProperty C} [ObjectProperty.Small.{v₁} P] [LocallySmall.{v₁} D] : ObjectProperty.Small.{v₁} (P.inverseImage (proj S T)) := by diff --git a/Mathlib/CategoryTheory/Generator/Basic.lean b/Mathlib/CategoryTheory/Generator/Basic.lean index 152068fd649a0a..50d317f68ad59a 100644 --- a/Mathlib/CategoryTheory/Generator/Basic.lean +++ b/Mathlib/CategoryTheory/Generator/Basic.lean @@ -7,6 +7,7 @@ import Mathlib.CategoryTheory.Limits.EssentiallySmall import Mathlib.CategoryTheory.Limits.Opposites import Mathlib.CategoryTheory.Subobject.Lattice import Mathlib.CategoryTheory.ObjectProperty.Small +import Mathlib.CategoryTheory.Comma.StructuredArrow.Small /-! # Separating and detecting sets @@ -287,32 +288,103 @@ lemma isCodetecting_bot_of_isGroupoid [IsGroupoid C] : end Empty +lemma IsSeparating.mk_of_exists_epi + (hP : ∀ (X : C), ∃ (ι : Type w) (s : ι → C) (_ : ∀ i, P (s i)) (c : Cofan s) (_ : IsColimit c) + (p : c.pt ⟶ X), Epi p) : + P.IsSeparating := by + intro X Y f g h + obtain ⟨ι, s, hs, c, hc, p, _⟩ := hP X + rw [← cancel_epi p] + exact Cofan.IsColimit.hom_ext hc _ _ + (fun i ↦ by simpa using h _ (hs i) (c.inj i ≫ p)) + +lemma IsCoseparating.mk_of_exists_mono + (hP : ∀ (X : C), ∃ (ι : Type w) (s : ι → C) (_ : ∀ i, P (s i)) (c : Fan s) (_ : IsLimit c) + (j : X ⟶ c.pt), Mono j) : + P.IsCoseparating := by + intro X Y f g h + obtain ⟨ι, s, hs, c, hc, j, _⟩ := hP Y + rw [← cancel_mono j] + exact Fan.IsLimit.hom_ext hc _ _ + (fun i ↦ by simpa using h _ (hs i) (j ≫ c.proj i)) + variable (P) +section + +/-- Given `P : ObjectProperty C` and `X : C`, this is the map which +sends `i : CostructuredArrow P.ι X` to `i.left.obj : C`. The coproduct +of this family is the source of the morphism `P.coproductFrom X`. -/ +abbrev coproductFromFamily (X : C) (i : CostructuredArrow P.ι X) : C := i.left.obj + +variable (X : C) + +variable [HasCoproduct (P.coproductFromFamily X)] + +/-- Given `P : ObjectProperty C` and `X : C`, this is the coproduct of +all the morphisms `Y ⟶ X` such that `P Y` holds. -/ +noncomputable abbrev coproductFrom : ∐ (P.coproductFromFamily X) ⟶ X := + Sigma.desc (fun i ↦ i.hom) + +variable {X} in +/-- The inclusion morphisms to `∐ (P.coproductFromFamily X)`. -/ +noncomputable abbrev ιCoproductFrom {Y : C} (f : Y ⟶ X) (hY : P Y) : + Y ⟶ ∐ (P.coproductFromFamily X) := by + exact Sigma.ι (P.coproductFromFamily X) (CostructuredArrow.mk (Y := ⟨Y, hY⟩) (by exact f)) + +end + +variable {P} in +lemma IsSeparating.epi_coproductFrom (hP : P.IsSeparating) + (X : C) [HasCoproduct (P.coproductFromFamily X)] : + Epi (P.coproductFrom X) where + left_cancellation u v huv := + hP _ _ (fun G hG h ↦ by simpa using P.ιCoproductFrom h hG ≫= huv) + theorem isSeparating_iff_epi - [∀ A : C, HasCoproduct fun f : Σ G : Subtype P, G.1 ⟶ A ↦ f.1.1] : - IsSeparating P ↔ - ∀ A : C, Epi (Sigma.desc (Sigma.snd (β := fun (G : Subtype P) ↦ G.1 ⟶ A))) := by - let β (A : C) (G : Subtype P) := G.1 ⟶ A - let b (A : C) (x : Σ G, β A G) := x.1.1 - refine ⟨fun h A ↦ ⟨fun u v huv ↦ h _ _ fun G hG f ↦ ?_⟩, fun h X Y f g hh ↦ ?_⟩ - · simpa [β, b] using Sigma.ι (b A) ⟨⟨G, hG⟩, f⟩ ≫= huv - · rw [← cancel_epi (Sigma.desc (Sigma.snd (β := β X)))] - ext ⟨⟨_, hG⟩, _⟩ - simpa using hh _ hG _ + [∀ (X : C), HasCoproduct (P.coproductFromFamily X)] : + IsSeparating P ↔ ∀ X : C, Epi (P.coproductFrom X) := + ⟨fun hP X ↦ hP.epi_coproductFrom X, + fun hP ↦ IsSeparating.mk_of_exists_epi (fun X ↦ ⟨_, P.coproductFromFamily X, + fun i ↦ i.left.2, _, colimit.isColimit _, _, hP X⟩)⟩ + +section + +/-- Given `P : ObjectProperty C` and `X : C`, this is the map which +sends `i : StructuredArrow P.ι X` to `i.right.obj : C`. The product +of this family is the target of the morphism `P.productTo X`. -/ +abbrev productToFamily (X : C) (i : StructuredArrow X P.ι) : C := i.right.obj + +variable (X : C) + +variable [HasProduct (P.productToFamily X)] + +/-- Given `P : ObjectProperty C` and `X : C`, this is the product of +all the morphisms `X ⟶ Y` such that `P Y` holds. -/ +noncomputable abbrev productTo : X ⟶ ∏ᶜ (P.productToFamily X) := + Pi.lift (fun i ↦ i.hom) + +variable {X} in +/-- The projection morphisms from `∏ᶜ (P.productToFamily X)`. -/ +noncomputable abbrev πProductTo {Y : C} (f : X ⟶ Y) (hY : P Y) : + ∏ᶜ (P.productToFamily X) ⟶ Y := by + exact Pi.π (P.productToFamily X) (StructuredArrow.mk (Y := ⟨Y, hY⟩) (by exact f)) + +end + +variable {P} in +lemma IsCoseparating.mono_productTo (hP : P.IsCoseparating) + (X : C) [HasProduct (P.productToFamily X)] : + Mono (P.productTo X) where + right_cancellation u v huv := + hP _ _ (fun G hG h ↦ by simpa using huv =≫ P.πProductTo h hG) theorem isCoseparating_iff_mono - [∀ A : C, HasProduct fun f : Σ G : Subtype P, A ⟶ G.1 ↦ f.1.1] : - IsCoseparating P ↔ - ∀ A : C, Mono (Pi.lift (Sigma.snd (β := fun (G : Subtype P) ↦ A ⟶ G.1))) := by - let β (A : C) (G : Subtype P) := A ⟶ G.1 - let b (A : C) (x : Σ G, β A G) := x.1.1 - refine ⟨fun h A ↦ ⟨fun u v huv ↦ h _ _ fun G hG f ↦ ?_⟩, fun h X Y f g hh ↦ ?_⟩ - · simpa [β, b] using huv =≫ Pi.π (b A) ⟨⟨G, hG⟩, f⟩ - · rw [← cancel_mono (Pi.lift (Sigma.snd (β := β Y)))] - ext ⟨⟨_, hG⟩, _⟩ - simp - simpa using hh _ hG _ + [∀ (X : C), HasProduct (P.productToFamily X)] : + IsCoseparating P ↔ ∀ X : C, Mono (P.productTo X) := + ⟨fun hP X ↦ hP.mono_productTo X, + fun hP ↦ IsCoseparating.mk_of_exists_mono (fun X ↦ ⟨_, P.productToFamily X, + fun i ↦ i.right.2, _, limit.isLimit _, _, hP X⟩)⟩ end ObjectProperty @@ -325,16 +397,17 @@ theorem hasInitial_of_isCoseparating [LocallySmall.{w} C] [WellPowered.{w} C] [HasLimitsOfSize.{w, w} C] {P : ObjectProperty C} [ObjectProperty.Small.{w} P] (hP : P.IsCoseparating) : HasInitial C := by have := hasFiniteLimits_of_hasLimitsOfSize C - haveI : HasProductsOfShape (Subtype P) C := hasProductsOfShape_of_small C (Subtype P) - haveI := fun A => hasProductsOfShape_of_small.{w} C (Σ G : Subtype P, A ⟶ (G : C)) + haveI := hasProductsOfShape_of_small C (Subtype P) + haveI := fun A => hasProductsOfShape_of_small.{w} C (StructuredArrow A P.ι) letI := completeLatticeOfCompleteSemilatticeInf (Subobject (piObj (Subtype.val : Subtype P → C))) suffices ∀ A : C, Unique (((⊥ : Subobject (piObj (Subtype.val : Subtype P → C))) : C) ⟶ A) by exact hasInitial_of_unique ((⊥ : Subobject (piObj (Subtype.val : Subtype P → C))) : C) + have := hP.mono_productTo refine fun A => ⟨⟨?_⟩, fun f => ?_⟩ - · let s := Pi.lift fun f : Σ G : Subtype P, A ⟶ (G : C) => Pi.π (Subtype.val : Subtype P → C) f.1 - let t := Pi.lift (@Sigma.snd (Subtype P) fun G => A ⟶ (G : C)) - haveI : Mono t := P.isCoseparating_iff_mono.1 hP A - exact Subobject.ofLEMk _ (pullback.fst _ _ : pullback s t ⟶ _) bot_le ≫ pullback.snd _ _ + · let s : ∏ᶜ (Subtype.val (p := P)) ⟶ ∏ᶜ P.productToFamily A := + Pi.lift (fun f ↦ Pi.π Subtype.val ⟨f.right.obj, f.right.property⟩) + exact Subobject.ofLEMk _ + (pullback.fst _ _ : pullback s (P.productTo A) ⟶ _) bot_le ≫ pullback.snd _ _ · suffices ∀ (g : Subobject.underlying.obj ⊥ ⟶ A), f = g by apply this intro g diff --git a/Mathlib/CategoryTheory/Generator/StrongGenerator.lean b/Mathlib/CategoryTheory/Generator/StrongGenerator.lean index efd0fcd21ec38c..580967023d5809 100644 --- a/Mathlib/CategoryTheory/Generator/StrongGenerator.lean +++ b/Mathlib/CategoryTheory/Generator/StrongGenerator.lean @@ -9,16 +9,16 @@ import Mathlib.CategoryTheory.Generator.Basic /-! # Strong generators -A set of objects `S` in a category `C` is a strong generator if it is a -generator (in the sense that `IsSeparating S` holds) such that for any -proper subobject `A ⊂ X`, there exists a morphism `G ⟶ X` from an -object in `S` which does not factor through `A`. +If `P : ObjectProperty C`, we say that `P` is a strong generator if it is a +generator (in the sense that `IsSeparating P` holds) such that for any +proper subobject `A ⊂ X`, there exists a morphism `G ⟶ X` which does not factor +through `A` from an object satisfying `P`. The main result is the lemma `isStrongGenerator_iff_exists_extremalEpi` which -says that if `S` is `w`-small, `C` is locally `w`-small and -has coproducts of size `w`, then `S` is a strong generator iff any +says that if `P` is `w`-small, `C` is locally `w`-small and +has coproducts of size `w`, then `P` is a strong generator iff any object of `C` is the target of an extremal epimorphism from a coproduct of -objects in `S`. A similar iff lemma for `IsSeparating` is also obtained. +objects satisfying `P`. ## References * [Adámek, J. and Rosický, J., *Locally presentable and accessible categories*][Adamek_Rosicky_1994] @@ -31,175 +31,105 @@ namespace CategoryTheory open Limits -variable {C : Type u} [Category.{v} C] (S : Set C) -/-- A set of objects is a strong generator if it is separating and for any -proper subobject `A ⊂ X`, there exists a morphism `G ⟶ X` from an -object in `S` which does not factor through `A`. -/ +namespace ObjectProperty + +variable {C : Type u} [Category.{v} C] (P : ObjectProperty C) + +/-- A property `P : ObjectProperty C` is a strong generator +if it is separating and for any proper subobject `A ⊂ X`, there exists +a morphism `G ⟶ X` which does not factor through `A` from an object +such that `P G` holds. -/ def IsStrongGenerator : Prop := - IsSeparating S ∧ ∀ ⦃X : C⦄ (A : Subobject X), - (∀ (G : S) (f : G.1 ⟶ X), Subobject.Factors A f) → A = ⊤ + P.IsSeparating ∧ ∀ ⦃X : C⦄ (A : Subobject X), + (∀ (G : C) (_ : P G) (f : G ⟶ X), Subobject.Factors A f) → A = ⊤ -variable {S} +variable {P} lemma isStrongGenerator_iff : - IsStrongGenerator S ↔ IsSeparating S ∧ + P.IsStrongGenerator ↔ P.IsSeparating ∧ ∀ ⦃X Y : C⦄ (i : X ⟶ Y) [Mono i], - (∀ (G : S), Function.Surjective (fun (f : G.1 ⟶ X) ↦ f ≫ i)) → IsIso i := by + (∀ (G : C) (_ : P G), Function.Surjective (fun (f : G ⟶ X) ↦ f ≫ i)) → IsIso i := by refine ⟨fun ⟨hS₁, hS₂⟩ ↦ ⟨hS₁, fun X Y i _ h ↦ ?_⟩, fun ⟨hS₁, hS₂⟩ ↦ ⟨hS₁, fun X A hA ↦ ?_⟩⟩ · rw [Subobject.isIso_iff_mk_eq_top] - refine hS₂ _ (fun G g ↦ ?_) + refine hS₂ _ (fun G hG g ↦ ?_) rw [Subobject.mk_factors_iff] - exact h G g + exact h G hG g · rw [← Subobject.isIso_arrow_iff_eq_top] - exact hS₂ A.arrow (fun G g ↦ ⟨_, Subobject.factorThru_arrow _ _ (hA G g)⟩) + exact hS₂ A.arrow (fun G hG g ↦ ⟨_, Subobject.factorThru_arrow _ _ (hA G hG g)⟩) namespace IsStrongGenerator section -variable (hS : IsStrongGenerator S) +variable (hP : P.IsStrongGenerator) -include hS +include hP -lemma isSeparating : IsSeparating S := hS.1 +lemma isSeparating : P.IsSeparating := hP.1 lemma subobject_eq_top {X : C} {A : Subobject X} - (hA : ∀ (G : S) (f : G.1 ⟶ X), Subobject.Factors A f) : + (hA : ∀ (G : C) (_ : P G) (f : G ⟶ X), Subobject.Factors A f) : A = ⊤ := - hS.2 _ hA + hP.2 _ hA lemma isIso_of_mono ⦃X Y : C⦄ (i : X ⟶ Y) [Mono i] - (hi : ∀ (G : S), Function.Surjective (fun (f : G.1 ⟶ X) ↦ f ≫ i)) : IsIso i := - (isStrongGenerator_iff.1 hS).2 i hi + (hi : ∀ (G : C) (_ : P G), Function.Surjective (fun (f : G ⟶ X) ↦ f ≫ i)) : IsIso i := + (isStrongGenerator_iff.1 hP).2 i hi lemma exists_of_subobject_ne_top {X : C} {A : Subobject X} (hA : A ≠ ⊤) : - ∃ (G : S) (f : G.1 ⟶ X), ¬ Subobject.Factors A f := by + ∃ (G : C) (_ : P G) (f : G ⟶ X), ¬ Subobject.Factors A f := by by_contra! - exact hA (hS.subobject_eq_top this) + exact hA (hP.subobject_eq_top this) lemma exists_of_mono_not_isIso {X Y : C} (i : X ⟶ Y) [Mono i] (hi : ¬ IsIso i) : - ∃ (G : S) (g : G.1 ⟶ Y), ∀ (f : G.1 ⟶ X), f ≫ i ≠ g := by + ∃ (G : C) (_ : P G) (g : G ⟶ Y), ∀ (f : G ⟶ X), f ≫ i ≠ g := by by_contra! - exact hi (hS.isIso_of_mono i this) + exact hi (hP.isIso_of_mono i this) end end IsStrongGenerator -section - -variable (S) [HasCoproducts.{w} C] [LocallySmall.{w} C] [Small.{w} S] (X : C) - -/-- Given `S : Set C` and `X : C`, this is the family of source objects -in the family of all maps `G ⟶ X` with `G ∈ S`. -/ -abbrev coproductOfSet.obj (p : Σ (s : S), s.1 ⟶ X) : C := p.1.1 - -lemma coproductOfSet.hasCoproduct : - HasCoproduct (coproductOfSet.obj S X) := - hasColimit_of_equivalence_comp - (Discrete.equivalence (equivShrink.{w} _)).symm - -/-- Given `S : Set C` and `X : C`, this is the coproduct of -`G` indexed by the type of all maps `G ⟶ X` with `G ∈ S`. -/ -noncomputable def coproductOfSet (X : C) : C := - have := coproductOfSet.hasCoproduct S X - ∐ (coproductOfSet.obj S X) - -namespace coproductOfSet - -/-- The canonical morphism `coproductOfSet S X ⟶ X`. -/ -noncomputable def π (X : C) : coproductOfSet S X ⟶ X := - have := coproductOfSet.hasCoproduct S X - Sigma.desc (fun p ↦ p.2) - -section - -variable {S} {X : C} (s : S) (f : s.1 ⟶ X) - -/-- The inclusion morphisms in the coproduct `coproductOfSet S X`. -/ -noncomputable def ι : s.1 ⟶ coproductOfSet S X := - have := coproductOfSet.hasCoproduct S X - Sigma.ι (coproductOfSet.obj S X) ⟨s, f⟩ - -@[reassoc (attr := simp)] -lemma ι_π : ι s f ≫ π S X = f := by simp [ι, π] - -end - -end coproductOfSet - -end - -namespace IsSeparating - -lemma epi_coproductOfSetπ (hS : IsSeparating S) - [HasCoproducts.{w} C] [LocallySmall.{w} C] [Small.{w} S] (X : C) : - Epi (coproductOfSet.π S X) where - left_cancellation {Z} f g h := - hS _ _ (fun G hG p ↦ by simpa using coproductOfSet.ι ⟨_, hG⟩ p ≫= h) - -lemma mk_of_exists_epi - (hS : ∀ (X : C), ∃ (ι : Type w) (s : ι → S) (c : Cofan (fun i ↦ (s i).1)) (_ : IsColimit c) - (p : c.pt ⟶ X), Epi p) : - IsSeparating S := by - intro X Y f g h - obtain ⟨ι, s, c, hc, p, _⟩ := hS X - rw [← cancel_epi p] - exact Cofan.IsColimit.hom_ext hc _ _ - (fun i ↦ by simpa using h _ (s i).2 (c.inj i ≫ p)) - -end IsSeparating - -lemma isSeparating_iff_exists_epi - [HasCoproducts.{w} C] [LocallySmall.{w} C] [Small.{w} S] : - IsSeparating S ↔ - ∀ (X : C), ∃ (ι : Type w) (s : ι → S) (c : Cofan (fun i ↦ (s i).1)) (_ : IsColimit c) - (p : c.pt ⟶ X), Epi p := by - refine ⟨fun hS X ↦ ?_, fun hS ↦ .mk_of_exists_epi hS⟩ - have := coproductOfSet.hasCoproduct S X - exact ⟨_, fun j ↦ ((equivShrink (Σ (s : S), s.1 ⟶ X)).symm j).1, _, - (colimit.isColimit (Discrete.functor (coproductOfSet.obj S X))).whiskerEquivalence - ((Discrete.equivalence (equivShrink.{w} _))).symm, _, - hS.epi_coproductOfSetπ X⟩ - namespace IsStrongGenerator -lemma extremalEpi_coproductOfSetπ - (hS : IsStrongGenerator S) [HasCoproducts.{w} C] [LocallySmall.{w} C] - [Small.{w} S] (X : C) : - ExtremalEpi (coproductOfSet.π S X) where - toEpi := hS.isSeparating.epi_coproductOfSetπ X - isIso {Z} p i fac _ := hS.isIso_of_mono _ - (fun G f ↦ ⟨coproductOfSet.ι G f ≫ p, by simp [fac]⟩) - lemma mk_of_exists_extremalEpi - (hS : ∀ (X : C), ∃ (ι : Type w) (s : ι → S) (c : Cofan (fun i ↦ (s i).1)) (_ : IsColimit c) + (hS : ∀ (X : C), ∃ (ι : Type w) (s : ι → C) (_ : ∀ i, P (s i)) (c : Cofan s) (_ : IsColimit c) (p : c.pt ⟶ X), ExtremalEpi p) : - IsStrongGenerator S := by + P.IsStrongGenerator := by rw [isStrongGenerator_iff] refine ⟨IsSeparating.mk_of_exists_epi.{w} (fun X ↦ ?_), fun X Y i _ hi ↦ ?_⟩ - · obtain ⟨ι, s, c, hc, p, _⟩ := hS X - exact ⟨ι, s, c, hc, p, inferInstance⟩ - · obtain ⟨ι, s, c, hc, p, _⟩ := hS Y - replace hi (j : ι) := hi (s j) (c.inj j ≫ p) + · obtain ⟨ι, s, hs, c, hc, p, _⟩ := hS X + exact ⟨ι, s, hs, c, hc, p, inferInstance⟩ + · obtain ⟨ι, s, hs, c, hc, p, _⟩ := hS Y + replace hi (j : ι) := hi (s j) (hs j) (c.inj j ≫ p) choose φ hφ using hi exact ExtremalEpi.isIso p (Cofan.IsColimit.desc hc φ) _ (Cofan.IsColimit.hom_ext hc _ _ (by simp [hφ])) +lemma extremalEpi_coproductFrom + (hP : IsStrongGenerator P) (X : C) [HasCoproduct (P.coproductFromFamily X)] : + ExtremalEpi (P.coproductFrom X) where + toEpi := hP.isSeparating.epi_coproductFrom X + isIso p i fac _ := hP.isIso_of_mono _ (fun G hG f ↦ ⟨P.ιCoproductFrom f hG ≫ p, by simp [fac]⟩) + end IsStrongGenerator lemma isStrongGenerator_iff_exists_extremalEpi - [HasCoproducts.{w} C] [LocallySmall.{w} C] [Small.{w} S] : - IsStrongGenerator S ↔ - ∀ (X : C), ∃ (ι : Type w) (s : ι → S) (c : Cofan (fun i ↦ (s i).1)) (_ : IsColimit c) + [HasCoproducts.{w} C] [LocallySmall.{w} C] [ObjectProperty.Small.{w} P] : + P.IsStrongGenerator ↔ + ∀ (X : C), ∃ (ι : Type w) (s : ι → C) (_ : ∀ i, P (s i)) (c : Cofan s) (_ : IsColimit c) (p : c.pt ⟶ X), ExtremalEpi p := by - refine ⟨fun hS X ↦ ?_, fun hS ↦ .mk_of_exists_extremalEpi hS⟩ - have := coproductOfSet.hasCoproduct S X - exact ⟨_, fun j ↦ ((equivShrink (Σ (s : S), s.1 ⟶ X)).symm j).1, _, - (colimit.isColimit (Discrete.functor (coproductOfSet.obj S X))).whiskerEquivalence - ((Discrete.equivalence (equivShrink.{w} _))).symm, _, - hS.extremalEpi_coproductOfSetπ X⟩ + refine ⟨fun hP X ↦ ?_, fun hP ↦ .mk_of_exists_extremalEpi hP⟩ + have := hasCoproductsOfShape_of_small.{w} C (CostructuredArrow P.ι X) + have := (coproductIsCoproduct (P.coproductFromFamily X)).whiskerEquivalence + ((Discrete.equivalence (equivShrink.{w} _))).symm + refine ⟨_, fun j ↦ ((equivShrink.{w} (CostructuredArrow P.ι X)).symm j).left.1, + fun j ↦ ((equivShrink.{w} _).symm j).1.2, _, + (coproductIsCoproduct (P.coproductFromFamily X)).whiskerEquivalence + ((Discrete.equivalence (equivShrink.{w} _))).symm, _, hP.extremalEpi_coproductFrom X⟩ + +end ObjectProperty end CategoryTheory From 9c3779290b47651804d5759e3f50d69f9fb031e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 7 Oct 2025 17:59:43 +0200 Subject: [PATCH 118/309] fix --- Mathlib/CategoryTheory/Generator/Basic.lean | 16 +++++++ .../Generator/StrongGenerator.lean | 42 +++++-------------- 2 files changed, 26 insertions(+), 32 deletions(-) diff --git a/Mathlib/CategoryTheory/Generator/Basic.lean b/Mathlib/CategoryTheory/Generator/Basic.lean index 50d317f68ad59a..eab87331babf88 100644 --- a/Mathlib/CategoryTheory/Generator/Basic.lean +++ b/Mathlib/CategoryTheory/Generator/Basic.lean @@ -7,6 +7,8 @@ import Mathlib.CategoryTheory.Limits.EssentiallySmall import Mathlib.CategoryTheory.Limits.Opposites import Mathlib.CategoryTheory.Subobject.Lattice import Mathlib.CategoryTheory.ObjectProperty.Small +import Mathlib.CategoryTheory.ObjectProperty.ColimitsOfShape +import Mathlib.CategoryTheory.ObjectProperty.LimitsOfShape import Mathlib.CategoryTheory.Comma.StructuredArrow.Small /-! @@ -308,6 +310,20 @@ lemma IsCoseparating.mk_of_exists_mono exact Fan.IsLimit.hom_ext hc _ _ (fun i ↦ by simpa using h _ (hs i) (j ≫ c.proj i)) +lemma IsSeparating.mk_of_exists_colimitsOfShape + (hP : ∀ (X : C), ∃ (J : Type w) (_ : SmallCategory J), Nonempty (P.ColimitOfShape J X)) : + P.IsSeparating := by + intro X Y f g h + obtain ⟨J, _, ⟨p⟩⟩ := hP X + exact p.isColimit.hom_ext (fun j ↦ h _ (p.prop_diag_obj _) _) + +lemma IsCoseparating.mk_of_exists_limitsOfShape + (hP : ∀ (X : C), ∃ (J : Type w) (_ : SmallCategory J), Nonempty (P.LimitOfShape J X)) : + P.IsCoseparating := by + intro X Y f g h + obtain ⟨J, _, ⟨p⟩⟩ := hP Y + exact p.isLimit.hom_ext (fun j ↦ h _ (p.prop_diag_obj _) _) + variable (P) section diff --git a/Mathlib/CategoryTheory/Generator/StrongGenerator.lean b/Mathlib/CategoryTheory/Generator/StrongGenerator.lean index afb3679cefd5ea..1dbe5b19100f17 100644 --- a/Mathlib/CategoryTheory/Generator/StrongGenerator.lean +++ b/Mathlib/CategoryTheory/Generator/StrongGenerator.lean @@ -134,47 +134,25 @@ lemma isStrongGenerator_iff_exists_extremalEpi (coproductIsCoproduct (P.coproductFromFamily X)).whiskerEquivalence ((Discrete.equivalence (equivShrink.{w} _))).symm, _, hP.extremalEpi_coproductFrom X⟩ -end ObjectProperty - -section - -variable (hS : ∀ (X : C), ∃ (J : Type w) (_ : SmallCategory J) - (p : ColimitPresentation J X), ∀ (j : J), ∃ (G : S), Nonempty (p.diag.obj j ≅ G.1)) - -include hS - -lemma IsSeparating.mk_of_exists_colimitPresentation : - IsSeparating S := by - intro X Y f g h - obtain ⟨J, _, p, hp⟩ := hS X - choose t ht using hp - let e (j : J) := (ht j).some - refine p.isColimit.hom_ext (fun j ↦ ?_) - rw [← cancel_epi (e j).inv] - simpa only [Category.assoc] using h _ (t j).2 ((e j).inv ≫ p.ι.app j) - -lemma IsStrongGenerator.mk_of_exists_colimitPresentation : - IsStrongGenerator S := by +lemma IsStrongGenerator.mk_of_exists_colimitPresentation + (hP : ∀ (X : C), ∃ (J : Type w) (_ : SmallCategory J), Nonempty (P.ColimitOfShape J X)) : + P.IsStrongGenerator := by rw [isStrongGenerator_iff] - refine ⟨IsSeparating.mk_of_exists_colimitPresentation hS, + refine ⟨IsSeparating.mk_of_exists_colimitsOfShape hP, fun X Y i _ hi ↦ ?_⟩ suffices ∃ (r : Y ⟶ X), r ≫ i = 𝟙 Y by obtain ⟨r, fac⟩ := this exact ⟨r, by simp [← cancel_mono i, fac], fac⟩ - obtain ⟨J, _, p, hp⟩ := hS Y - have (j : J) : ∃ (l : p.diag.obj j ⟶ X), l ≫ i = p.ι.app j := by - obtain ⟨G, ⟨e⟩⟩ := hp j - obtain ⟨l, hl⟩ := hi G (e.inv ≫ p.ι.app j) - exact ⟨e.hom ≫ l, by simp [hl]⟩ - choose φ hφ using this + obtain ⟨J, _, ⟨p⟩⟩ := hP Y + choose φ hφ using fun j ↦ hi _ (p.prop_diag_obj j) (p.ι.app j) + dsimp at hφ let c : Cocone p.diag := Cocone.mk _ { app := φ naturality j₁ j₂ f := by simp [← cancel_mono i, hφ] } refine ⟨p.isColimit.desc c, p.isColimit.hom_ext (fun j ↦ ?_)⟩ - have := p.isColimit.fac c j - dsimp [c] at this ⊢ - rw [reassoc_of% this, hφ, Category.comp_id] + dsimp + rw [p.isColimit.fac_assoc, hφ, Category.comp_id] -end +end ObjectProperty end CategoryTheory From 5f0fefea43822d790c001d61700db1daf2bbd814 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 7 Oct 2025 18:00:18 +0200 Subject: [PATCH 119/309] better name --- Mathlib/CategoryTheory/Generator/StrongGenerator.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Generator/StrongGenerator.lean b/Mathlib/CategoryTheory/Generator/StrongGenerator.lean index 1dbe5b19100f17..36b940cdda3911 100644 --- a/Mathlib/CategoryTheory/Generator/StrongGenerator.lean +++ b/Mathlib/CategoryTheory/Generator/StrongGenerator.lean @@ -134,7 +134,7 @@ lemma isStrongGenerator_iff_exists_extremalEpi (coproductIsCoproduct (P.coproductFromFamily X)).whiskerEquivalence ((Discrete.equivalence (equivShrink.{w} _))).symm, _, hP.extremalEpi_coproductFrom X⟩ -lemma IsStrongGenerator.mk_of_exists_colimitPresentation +lemma IsStrongGenerator.mk_of_exists_colimitsOfShape (hP : ∀ (X : C), ∃ (J : Type w) (_ : SmallCategory J), Nonempty (P.ColimitOfShape J X)) : P.IsStrongGenerator := by rw [isStrongGenerator_iff] From be9237b0e57ed8e8f4baf93e43137347555a81e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= <37772949+joelriou@users.noreply.github.com> Date: Tue, 7 Oct 2025 21:17:33 +0200 Subject: [PATCH 120/309] Apply suggestion from @chrisflav Co-authored-by: Christian Merten <136261474+chrisflav@users.noreply.github.com> --- Mathlib/CategoryTheory/ObjectProperty/Opposite.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/ObjectProperty/Opposite.lean b/Mathlib/CategoryTheory/ObjectProperty/Opposite.lean index 90344e9f12b61f..f942ed28789b8c 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/Opposite.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/Opposite.lean @@ -69,7 +69,7 @@ lemma isoClosure_op (P : ObjectProperty C) : 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ᵒᵖ) : +lemma unop_isoClosure (P : ObjectProperty Cᵒᵖ) : P.isoClosure.unop = P.unop.isoClosure := by rw [← op_injective_iff, P.unop.isoClosure_op, op_unop, op_unop] From 9a5146daea82d4ab5351c2e36a9225b6fbc506ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= <37772949+joelriou@users.noreply.github.com> Date: Tue, 7 Oct 2025 21:17:41 +0200 Subject: [PATCH 121/309] Apply suggestion from @chrisflav Co-authored-by: Christian Merten <136261474+chrisflav@users.noreply.github.com> --- Mathlib/CategoryTheory/ObjectProperty/Opposite.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/ObjectProperty/Opposite.lean b/Mathlib/CategoryTheory/ObjectProperty/Opposite.lean index f942ed28789b8c..11d830d9bc906b 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/Opposite.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/Opposite.lean @@ -63,7 +63,7 @@ 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) : +lemma op_isoClosure (P : ObjectProperty C) : P.isoClosure.op = P.op.isoClosure := by ext ⟨X⟩ exact ⟨fun ⟨Y, h, ⟨e⟩⟩ ↦ ⟨op Y, h, ⟨e.op.symm⟩⟩, From 3a0923c5736c6af63f6c50c4cf87fe6d48b62025 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 7 Oct 2025 21:23:37 +0200 Subject: [PATCH 122/309] op_monotone --- .../CategoryTheory/ObjectProperty/Opposite.lean | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/ObjectProperty/Opposite.lean b/Mathlib/CategoryTheory/ObjectProperty/Opposite.lean index 11d830d9bc906b..dc7de2ffe4f269 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/Opposite.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/Opposite.lean @@ -55,6 +55,20 @@ lemma unop_injective_iff {P Q : ObjectProperty Cᵒᵖ} : P.unop = Q.unop ↔ P = Q := ⟨unop_injective, by rintro rfl; rfl⟩ +lemma op_monotone {P Q : ObjectProperty C} (h : P ≤ Q) : P.op ≤ Q.op := + fun _ hX ↦ h _ hX + +lemma unop_monotone {P Q : ObjectProperty Cᵒᵖ} (h : P ≤ Q) : P.unop ≤ Q.unop := + fun _ hX ↦ h _ hX + +@[simp] +lemma op_monotone_iff {P Q : ObjectProperty C} : P.op ≤ Q.op ↔ P ≤ Q := + ⟨unop_monotone, op_monotone⟩ + +@[simp] +lemma unop_monotone_iff {P Q : ObjectProperty Cᵒᵖ} : P.unop ≤ Q.unop ↔ P ≤ Q := + ⟨op_monotone, unop_monotone⟩ + instance (P : ObjectProperty C) [P.IsClosedUnderIsomorphisms] : P.op.IsClosedUnderIsomorphisms where of_iso e hX := P.prop_of_iso e.symm.unop hX @@ -71,7 +85,7 @@ lemma op_isoClosure (P : ObjectProperty C) : lemma unop_isoClosure (P : ObjectProperty Cᵒᵖ) : P.isoClosure.unop = P.unop.isoClosure := by - rw [← op_injective_iff, P.unop.isoClosure_op, op_unop, op_unop] + rw [← op_injective_iff, P.unop.op_isoClosure, op_unop, op_unop] /-- The bijection `Subtype P.op ≃ Subtype P` for `P : ObjectProperty C`. -/ def subtypeOpEquiv (P : ObjectProperty C) : From f2cbc1bb2ba6e6c418e9161f2c1a5a36fe84d788 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 7 Oct 2025 21:29:00 +0200 Subject: [PATCH 123/309] better names --- Mathlib/CategoryTheory/ObjectProperty/Basic.lean | 16 ++++++++-------- .../CategoryTheory/ObjectProperty/Opposite.lean | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Mathlib/CategoryTheory/ObjectProperty/Basic.lean b/Mathlib/CategoryTheory/ObjectProperty/Basic.lean index 6f9454ea250227..01c6f8ab89f8a2 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/Basic.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/Basic.lean @@ -61,11 +61,11 @@ lemma prop_map_obj (P : ObjectProperty C) (F : C ⥤ D) {X : C} (hX : P X) : inductive strictMap (P : ObjectProperty C) (F : C ⥤ D) : ObjectProperty D | mk (X : C) (hX : P X) : strictMap P F (F.obj X) -lemma prop_strictMap_iff (P : ObjectProperty C) (F : C ⥤ D) (Y : D) : +lemma strictMap_iff (P : ObjectProperty C) (F : C ⥤ D) (Y : D) : P.strictMap F Y ↔ ∃ (X : C), P X ∧ F.obj X = Y := ⟨by rintro ⟨X, hX⟩; exact ⟨X, hX, rfl⟩, by rintro ⟨X, hX, rfl⟩; exact ⟨X, hX⟩⟩ -lemma prop_strictMap_obj (P : ObjectProperty C) (F : C ⥤ D) {X : C} (hX : P X) : +lemma strictMap_obj (P : ObjectProperty C) (F : C ⥤ D) {X : C} (hX : P X) : P.strictMap F (F.obj X) := ⟨X, hX⟩ @@ -88,9 +88,9 @@ inductive ofObj : ObjectProperty C | mk (i : ι) : ofObj (X i) @[simp] -lemma prop_ofObj (i : ι) : ofObj X (X i) := ⟨i⟩ +lemma ofObj_apply (i : ι) : ofObj X (X i) := ⟨i⟩ -lemma prop_ofObj_iff (Y : C) : ofObj X Y ↔ ∃ i, X i = Y := by +lemma ofObj_iff (Y : C) : ofObj X Y ↔ ∃ i, X i = Y := by constructor · rintro ⟨i⟩ exact ⟨i, rfl⟩ @@ -105,7 +105,7 @@ lemma ofObj_le_iff (P : ObjectProperty C) : lemma strictMap_ofObj (F : C ⥤ D) : (ofObj X).strictMap F = ofObj (F.obj ∘ X) := by ext Y - simp [prop_ofObj_iff, prop_strictMap_iff] + simp [ofObj_iff, strictMap_iff] end @@ -113,7 +113,7 @@ end abbrev singleton (X : C) : ObjectProperty C := ofObj (fun (_ : Unit) ↦ X) @[simp] -lemma prop_singleton_iff (X Y : C) : singleton X Y ↔ X = Y := by simp [prop_ofObj_iff] +lemma singleton_iff (X Y : C) : singleton X Y ↔ X = Y := by simp [ofObj_iff] @[simp] lemma singleton_le_iff {X : C} {P : ObjectProperty C} : @@ -124,14 +124,14 @@ lemma singleton_le_iff {X : C} {P : ObjectProperty C} : lemma strictMap_singleton (X : C) (F : C ⥤ D) : (singleton X).strictMap F = singleton (F.obj X) := by ext - simp [prop_strictMap_iff] + simp [strictMap_iff] /-- The property of objects in a category that is satisfied by `X : C` and `Y : C`. -/ def pair (X Y : C) : ObjectProperty C := ofObj (Sum.elim (fun (_ : Unit) ↦ X) (fun (_ : Unit) ↦ Y)) @[simp] -lemma prop_pair_iff (X Y Z : C) : +lemma pair_iff (X Y Z : C) : pair X Y Z ↔ X = Z ∨ Y = Z := by constructor · rintro ⟨_ | _⟩ <;> tauto diff --git a/Mathlib/CategoryTheory/ObjectProperty/Opposite.lean b/Mathlib/CategoryTheory/ObjectProperty/Opposite.lean index dc7de2ffe4f269..d0de958f69c5d2 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/Opposite.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/Opposite.lean @@ -96,7 +96,7 @@ def subtypeOpEquiv (P : ObjectProperty C) : @[simp] lemma op_ofObj {ι : Type*} (X : ι → C) : (ofObj X).op = ofObj (fun i ↦ op (X i)) := by ext Z - simp only [op_iff, prop_ofObj_iff] + simp only [op_iff, ofObj_iff] constructor · rintro ⟨i, hi⟩ exact ⟨i, by rw [hi]⟩ From 6ce7bc49286e16cb955a28b225848f75fecd397d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Wed, 8 Oct 2025 00:06:27 +0200 Subject: [PATCH 124/309] fix --- .../Comma/StructuredArrow/Small.lean | 4 ++-- Mathlib/CategoryTheory/Generator/Basic.lean | 16 ++++++++-------- .../Generator/HomologicalComplex.lean | 2 +- Mathlib/CategoryTheory/Generator/Presheaf.lean | 2 +- Mathlib/CategoryTheory/Generator/Sheaf.lean | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Mathlib/CategoryTheory/Comma/StructuredArrow/Small.lean b/Mathlib/CategoryTheory/Comma/StructuredArrow/Small.lean index f9e87398ce41b9..2b8fd923ce0bc9 100644 --- a/Mathlib/CategoryTheory/Comma/StructuredArrow/Small.lean +++ b/Mathlib/CategoryTheory/Comma/StructuredArrow/Small.lean @@ -32,7 +32,7 @@ instance small_inverseImage_proj_of_locallySmall rw [this] infer_instance ext X - simp only [ObjectProperty.prop_inverseImage_iff, proj_obj, ObjectProperty.prop_ofObj_iff, + simp only [ObjectProperty.prop_inverseImage_iff, proj_obj, ObjectProperty.ofObj_iff, Sigma.exists, Subtype.exists, exists_prop] exact ⟨fun h ↦ ⟨_, h, _, rfl⟩, by rintro ⟨_, h, _, rfl⟩; exact h⟩ @@ -52,7 +52,7 @@ instance small_inverseImage_proj_of_locallySmall rw [this] infer_instance ext X - simp only [ObjectProperty.prop_inverseImage_iff, proj_obj, ObjectProperty.prop_ofObj_iff, + simp only [ObjectProperty.prop_inverseImage_iff, proj_obj, ObjectProperty.ofObj_iff, Sigma.exists, Subtype.exists, exists_prop] exact ⟨fun h ↦ ⟨_, h, _, rfl⟩, by rintro ⟨_, h, _, rfl⟩; exact h⟩ diff --git a/Mathlib/CategoryTheory/Generator/Basic.lean b/Mathlib/CategoryTheory/Generator/Basic.lean index 152068fd649a0a..e8e8b91593f551 100644 --- a/Mathlib/CategoryTheory/Generator/Basic.lean +++ b/Mathlib/CategoryTheory/Generator/Basic.lean @@ -104,7 +104,7 @@ lemma IsSeparating.of_equivalence α.inverse.map_injective (h _ _ (fun Z hZ h ↦ by obtain ⟨h', rfl⟩ := (α.toAdjunction.homEquiv _ _).surjective h simp only [Adjunction.homEquiv_unit, Category.assoc, ← Functor.map_comp, - H _ (P.prop_strictMap_obj _ hZ) h'])) + H _ (P.strictMap_obj _ hZ) h'])) lemma IsCoseparating.of_equivalence (h : IsCoseparating P) {D : Type*} [Category D] (α : C ≌ D) : @@ -113,7 +113,7 @@ lemma IsCoseparating.of_equivalence obtain ⟨h', rfl⟩ := (α.symm.toAdjunction.homEquiv _ _).symm.surjective h simp only [Equivalence.symm_inverse, Equivalence.symm_functor, Adjunction.homEquiv_counit, ← Functor.map_comp_assoc, - H _ (P.prop_strictMap_obj _ hZ) h'])) + H _ (P.strictMap_obj _ hZ) h'])) end Equivalence @@ -492,7 +492,7 @@ theorem isSeparator_def (G : C) : IsSeparator G ↔ ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), (∀ h : G ⟶ X, h ≫ f = h ≫ g) → f = g := ⟨fun hG X Y f g hfg => hG _ _ fun H hH h => by - obtain rfl := (ObjectProperty.prop_singleton_iff _ _).1 hH + obtain rfl := (ObjectProperty.singleton_iff _ _).1 hH exact hfg h, fun hG _ _ _ _ hfg => hG _ _ fun _ => hfg _ (by simp) _⟩ @@ -504,7 +504,7 @@ theorem isCoseparator_def (G : C) : IsCoseparator G ↔ ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), (∀ h : Y ⟶ G, f ≫ h = g ≫ h) → f = g := ⟨fun hG X Y f g hfg => hG _ _ fun H hH h => by - obtain rfl := (ObjectProperty.prop_singleton_iff _ _).1 hH + obtain rfl := (ObjectProperty.singleton_iff _ _).1 hH exact hfg h, fun hG _ _ _ _ hfg => hG _ _ fun _ => hfg _ (by simp) _⟩ @@ -516,7 +516,7 @@ theorem isDetector_def (G : C) : IsDetector G ↔ ∀ ⦃X Y : C⦄ (f : X ⟶ Y), (∀ h : G ⟶ Y, ∃! h', h' ≫ f = h) → IsIso f := ⟨fun hG X Y f hf => hG _ fun H hH h => by - obtain rfl := (ObjectProperty.prop_singleton_iff _ _).1 hH + obtain rfl := (ObjectProperty.singleton_iff _ _).1 hH exact hf h, fun hG _ _ _ hf => hG _ fun _ => hf _ (by simp) _⟩ @@ -528,7 +528,7 @@ theorem isCodetector_def (G : C) : IsCodetector G ↔ ∀ ⦃X Y : C⦄ (f : X ⟶ Y), (∀ h : X ⟶ G, ∃! h', f ≫ h' = h) → IsIso f := ⟨fun hG X Y f hf => hG _ fun H hH h => by - obtain rfl := (ObjectProperty.prop_singleton_iff _ _).1 hH + obtain rfl := (ObjectProperty.singleton_iff _ _).1 hH exact hf h, fun hG _ _ _ hf => hG _ fun _ => hf _ (by simp) _⟩ @@ -592,7 +592,7 @@ theorem isSeparator_coprod (G H : C) [HasBinaryCoproduct G H] : refine (isSeparator_iff_of_isColimit_cofan (coprodIsCoprod G H)).trans ?_ convert Iff.rfl ext X - simp only [ObjectProperty.prop_pair_iff, ObjectProperty.prop_ofObj_iff] + simp only [ObjectProperty.pair_iff, ObjectProperty.ofObj_iff] constructor · rintro (rfl | rfl); exacts [⟨.left, rfl⟩, ⟨.right, rfl⟩] · rintro ⟨⟨_ | _⟩, rfl⟩ <;> tauto @@ -638,7 +638,7 @@ theorem isCoseparator_prod (G H : C) [HasBinaryProduct G H] : refine (isCoseparator_iff_of_isLimit_fan (prodIsProd G H)).trans ?_ convert Iff.rfl ext X - simp only [ObjectProperty.prop_pair_iff, ObjectProperty.prop_ofObj_iff] + simp only [ObjectProperty.pair_iff, ObjectProperty.ofObj_iff] constructor · rintro (rfl | rfl); exacts [⟨.left, rfl⟩, ⟨.right, rfl⟩] · rintro ⟨⟨_ | _⟩, rfl⟩ <;> tauto diff --git a/Mathlib/CategoryTheory/Generator/HomologicalComplex.lean b/Mathlib/CategoryTheory/Generator/HomologicalComplex.lean index 65cc55e20f01ad..0c99e234af2548 100644 --- a/Mathlib/CategoryTheory/Generator/HomologicalComplex.lean +++ b/Mathlib/CategoryTheory/Generator/HomologicalComplex.lean @@ -48,7 +48,7 @@ lemma isSeparating_separatingFamily : have H := evalCompCoyonedaCorepresentable c (X a) j apply H.homEquiv.symm.injective simpa only [H.homEquiv_symm_comp] using h _ - (ObjectProperty.prop_ofObj _ ⟨a, j⟩) (H.homEquiv.symm p) + (ObjectProperty.ofObj_apply _ ⟨a, j⟩) (H.homEquiv.symm p) end diff --git a/Mathlib/CategoryTheory/Generator/Presheaf.lean b/Mathlib/CategoryTheory/Generator/Presheaf.lean index 4b3aabd0aba800..8fc01993932da9 100644 --- a/Mathlib/CategoryTheory/Generator/Presheaf.lean +++ b/Mathlib/CategoryTheory/Generator/Presheaf.lean @@ -71,7 +71,7 @@ lemma isSeparating {ι : Type w} {S : ι → A} (hS : ObjectProperty.IsSeparatin rintro _ ⟨i⟩ α apply freeYonedaHomEquiv.symm.injective simpa only [freeYonedaHomEquiv_symm_comp] using - h _ (ObjectProperty.prop_ofObj _ ⟨X, i⟩) (freeYonedaHomEquiv.symm α) + h _ (ObjectProperty.ofObj_apply _ ⟨X, i⟩) (freeYonedaHomEquiv.symm α) lemma isSeparator {ι : Type w} {S : ι → A} (hS : ObjectProperty.IsSeparating (.ofObj S)) [HasCoproduct (fun (⟨X, i⟩ : C × ι) ↦ freeYoneda X (S i))] diff --git a/Mathlib/CategoryTheory/Generator/Sheaf.lean b/Mathlib/CategoryTheory/Generator/Sheaf.lean index 28452ee8575e94..bd7f0862ce4c53 100644 --- a/Mathlib/CategoryTheory/Generator/Sheaf.lean +++ b/Mathlib/CategoryTheory/Generator/Sheaf.lean @@ -47,7 +47,7 @@ lemma isSeparating {ι : Type w} {S : ι → A} (hS : ObjectProperty.IsSeparatin rintro _ ⟨X, i⟩ a apply ((sheafificationAdjunction _ _).homEquiv _ _).symm.injective simpa only [← Adjunction.homEquiv_naturality_right_symm] using - hfg _ (ObjectProperty.prop_ofObj _ ⟨X, i⟩) + hfg _ (ObjectProperty.ofObj_apply _ ⟨X, i⟩) (((sheafificationAdjunction _ _).homEquiv _ _).symm a) lemma isSeparator {ι : Type w} {S : ι → A} (hS : ObjectProperty.IsSeparating (.ofObj S)) From 63524b26ff7fde9e5c0ae7697775eb226c5fccf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Wed, 8 Oct 2025 00:11:18 +0200 Subject: [PATCH 125/309] fix --- Mathlib/Algebra/Category/ModuleCat/AB.lean | 2 +- .../Abelian/GrothendieckCategory/EnoughInjectives.lean | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Mathlib/Algebra/Category/ModuleCat/AB.lean b/Mathlib/Algebra/Category/ModuleCat/AB.lean index 6aec76bedd4562..8be6e655c045e6 100644 --- a/Mathlib/Algebra/Category/ModuleCat/AB.lean +++ b/Mathlib/Algebra/Category/ModuleCat/AB.lean @@ -36,7 +36,7 @@ instance : AB4Star (ModuleCat.{u} R) where lemma ModuleCat.isSeparator [Small.{v} R] : IsSeparator (ModuleCat.of.{v} R (Shrink.{v} R)) := fun X Y f g h ↦ by - simp only [ObjectProperty.prop_singleton_iff, ModuleCat.hom_ext_iff, hom_comp, + simp only [ObjectProperty.singleton_iff, ModuleCat.hom_ext_iff, hom_comp, LinearMap.ext_iff, LinearMap.coe_comp, Function.comp_apply, forall_eq'] at h ext x simpa using h (ModuleCat.ofHom ((LinearMap.toSpanSingleton R X x).comp diff --git a/Mathlib/CategoryTheory/Abelian/GrothendieckCategory/EnoughInjectives.lean b/Mathlib/CategoryTheory/Abelian/GrothendieckCategory/EnoughInjectives.lean index 090828e8c3df38..7d922e8e2acae7 100644 --- a/Mathlib/CategoryTheory/Abelian/GrothendieckCategory/EnoughInjectives.lean +++ b/Mathlib/CategoryTheory/Abelian/GrothendieckCategory/EnoughInjectives.lean @@ -111,7 +111,7 @@ lemma exists_pushouts ∃ (X' : C) (i : X ⟶ X') (p' : X' ⟶ Y) (_ : (generatingMonomorphisms G).pushouts i) (_ : ¬ IsIso i) (_ : Mono p'), i ≫ p' = p := by rw [hG.isDetector.isIso_iff_of_mono] at hp - simp only [ObjectProperty.prop_singleton_iff, Function.Surjective, coyoneda_obj_obj, + simp only [ObjectProperty.singleton_iff, Function.Surjective, coyoneda_obj_obj, coyoneda_obj_map, forall_eq', not_forall, not_exists] at hp -- `f : G ⟶ Y` is a monomorphism the image of which is not contained in `X` obtain ⟨f, hf⟩ := hp From 5bdcd3c40f1fcad48cb6be10215feef4f7ecabfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sat, 11 Oct 2025 19:53:06 +0200 Subject: [PATCH 126/309] fix --- Mathlib/CategoryTheory/Comma/StructuredArrow/Small.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Comma/StructuredArrow/Small.lean b/Mathlib/CategoryTheory/Comma/StructuredArrow/Small.lean index d5186634b4d2d3..92e7574cea778f 100644 --- a/Mathlib/CategoryTheory/Comma/StructuredArrow/Small.lean +++ b/Mathlib/CategoryTheory/Comma/StructuredArrow/Small.lean @@ -17,7 +17,7 @@ be used in the proof of the Special Adjoint Functor Theorem. namespace CategoryTheory -- morphism levels before object levels. See note [category theory universes]. -universe v₁ v₂ u₁ u₂ +universe w v₁ v₂ u₁ u₂ variable {C : Type u₁} [Category.{v₁} C] {D : Type u₂} [Category.{v₂} D] From 09eec3fed9926f7a3651893753086cab33d015dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sat, 11 Oct 2025 20:11:11 +0200 Subject: [PATCH 127/309] wip --- .../Presentable/CardinalFilteredPresentation.lean | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean b/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean index 0cceed7e1ff836..6c429a8e3df0dd 100644 --- a/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean +++ b/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean @@ -116,13 +116,16 @@ lemma presentable [LocallySmall.{w} C] (X : C) : IsPresentable.{w} X := by have := (h.colimitPresentation X).isCardinalPresentable κ (by infer_instance) κ' le hκ' exact isPresentable_of_isCardinalPresentable _ κ' +-- TODO: Move `AreCardinalFilteredGenerators` to the `ObjectProperty` namespace include h in lemma isStrongGenerator : - IsStrongGenerator (Set.range G) := - .mk_of_exists_colimitPresentation (fun X ↦ by - refine ⟨_, _, h.colimitPresentation X, fun j ↦ ?_⟩ + ObjectProperty.IsStrongGenerator (Set.range G : ObjectProperty C) := + .mk_of_exists_colimitsOfShape (fun X ↦ ⟨h.J X, inferInstance, by + change ObjectProperty.colimitsOfShape (Set.range G) (h.J X) X + rw [← ObjectProperty.colimitsOfShape_isoClosure] + refine ⟨h.colimitPresentation X, fun j ↦ ?_⟩ obtain ⟨i, ⟨e⟩⟩ := h.exists_colimitPresentation_diag_obj_iso X j - exact ⟨⟨_, i, rfl⟩, ⟨e⟩⟩) + exact ⟨_, ⟨i, rfl⟩, ⟨e⟩⟩⟩) end AreCardinalFilteredGenerators From 185a67990a128bc1fa3a81a7bf441fc4b972a3ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sun, 12 Oct 2025 12:15:13 +0200 Subject: [PATCH 128/309] fix --- Mathlib.lean | 2 +- .../Functor/{ => KanExtension}/Dense.lean | 55 +++++++++++-------- 2 files changed, 33 insertions(+), 24 deletions(-) rename Mathlib/CategoryTheory/Functor/{ => KanExtension}/Dense.lean (66%) diff --git a/Mathlib.lean b/Mathlib.lean index c21ea63c4680fb..c53290ccd37b72 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -2280,7 +2280,6 @@ import Mathlib.CategoryTheory.Functor.Category import Mathlib.CategoryTheory.Functor.Const import Mathlib.CategoryTheory.Functor.Currying import Mathlib.CategoryTheory.Functor.CurryingThree -import Mathlib.CategoryTheory.Functor.Dense import Mathlib.CategoryTheory.Functor.Derived.Adjunction import Mathlib.CategoryTheory.Functor.Derived.LeftDerived import Mathlib.CategoryTheory.Functor.Derived.PointwiseRightDerived @@ -2293,6 +2292,7 @@ import Mathlib.CategoryTheory.Functor.Functorial import Mathlib.CategoryTheory.Functor.Hom import Mathlib.CategoryTheory.Functor.KanExtension.Adjunction import Mathlib.CategoryTheory.Functor.KanExtension.Basic +import Mathlib.CategoryTheory.Functor.KanExtension.Dense import Mathlib.CategoryTheory.Functor.KanExtension.DenseAt import Mathlib.CategoryTheory.Functor.KanExtension.Pointwise import Mathlib.CategoryTheory.Functor.KanExtension.Preserves diff --git a/Mathlib/CategoryTheory/Functor/Dense.lean b/Mathlib/CategoryTheory/Functor/KanExtension/Dense.lean similarity index 66% rename from Mathlib/CategoryTheory/Functor/Dense.lean rename to Mathlib/CategoryTheory/Functor/KanExtension/Dense.lean index 909c6710500698..29ff47e11abd51 100644 --- a/Mathlib/CategoryTheory/Functor/Dense.lean +++ b/Mathlib/CategoryTheory/Functor/KanExtension/Dense.lean @@ -3,15 +3,18 @@ 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.Limits.Canonical +import Mathlib.CategoryTheory.Functor.KanExtension.DenseAt import Mathlib.CategoryTheory.Limits.Presheaf import Mathlib.CategoryTheory.Generator.StrongGenerator /-! # Dense functors -A functor `F : C ⥤ D` is dense (`F.IsDense`) if any `Y : D` is a -canonical colimit relatively to `F`. When `F` is full, we show that this +A functor `F : C ⥤ D` is dense (`F.IsDense`) if `𝟭 D` is a pointwise +left Kan extension of `F` along itself, i.e. any `Y : D` is the +colimit of all `F.obj X` for all morphisms `F.obj X ⟶ Y` (which +is the condition `F.DenseAt Y`). +When `F` is full, we show that this is equivalent to saying that the restricted Yoneda functor `D ⥤ Cᵒᵖ ⥤ Type _` is fully faithful (see the lemma `Functor.isDense_iff_fullyFaithful_restrictedULiftYoneda`). @@ -38,20 +41,24 @@ namespace Functor /-- A functor `F : C ⥤ D` is dense if any `Y : D` is a canonical colimit relatively to `F`. -/ class IsDense (F : C ⥤ D) : Prop where - isCanonicalColimit_eq_top (F) : F.isCanonicalColimit = ⊤ + isDenseAt (F) (Y : D) : F.isDenseAt Y -/-- This is a choice of structure `CanonicalColimit F Y` when `F : C ⥤ D` +/-- This is a choice of structure `F.DenseAt Y` when `F : C ⥤ D` is dense, and `Y : D`. -/ -noncomputable def canonicalColimitOfIsDense (F : C ⥤ D) [F.IsDense] (Y : D) : - CanonicalColimit F Y := - ((IsDense.isCanonicalColimit_eq_top F).symm.le _ (by simp)).canonicalColimit +noncomputable def denseAt (F : C ⥤ D) [F.IsDense] (Y : D) : F.DenseAt Y := + (IsDense.isDenseAt F Y).some + +lemma isDense_iff_nonempty_isPointwiseLeftKanExtension (F : C ⥤ D) : + F.IsDense ↔ + Nonempty ((LeftExtension.mk _ (rightUnitor F).inv).IsPointwiseLeftKanExtension) := + ⟨fun _ ↦ ⟨fun _ ↦ F.denseAt _⟩, fun ⟨h⟩ ↦ ⟨fun _ ↦ ⟨h _⟩⟩⟩ variable (F : C ⥤ D) instance [F.IsDense] : (restrictedULiftYoneda.{w} F).Faithful where map_injective h := - (canonicalColimitOfIsDense F _).hom_ext' (fun X p ↦ - ULift.up_injective (congr_fun (NatTrans.congr_app h (op X)) (ULift.up p))) + (F.denseAt _).hom_ext' (fun X p ↦ by + simpa using ULift.up_injective (congr_fun (NatTrans.congr_app h (op X)) (ULift.up p))) instance [F.IsDense] : (restrictedULiftYoneda.{w} F).Full where map_surjective {Y Z} f := by @@ -63,17 +70,17 @@ instance [F.IsDense] : (restrictedULiftYoneda.{w} F).Full where simpa [uliftFunctor, uliftYoneda, restrictedULiftYoneda, ← ULift.down_inj] using (congr_fun (f.naturality φ.left.op) (ULift.up g₂.hom)).symm }} - refine ⟨(canonicalColimitOfIsDense F Y).desc c, ?_⟩ + refine ⟨(F.denseAt Y).desc c, ?_⟩ ext ⟨X⟩ ⟨x⟩ - exact ULift.down_injective ((canonicalColimitOfIsDense F Y).fac c (.mk x)) + have := (F.denseAt Y).fac c (.mk x) + dsimp [c] at this + simpa using ULift.down_injective this variable {F} in lemma IsDense.of_fullyFaithful_restrictedULiftYoneda [F.Full] (h : (restrictedULiftYoneda.{w} F).FullyFaithful) : F.IsDense where - isCanonicalColimit_eq_top := by - ext Y - simp only [Pi.top_apply, «Prop».top_eq_true, iff_true] + isDenseAt Y := by let φ (s : Cocone (CostructuredArrow.proj F Y ⋙ F)) : (restrictedULiftYoneda.{w} F).obj Y ⟶ (restrictedULiftYoneda F).obj s.pt := { app := fun ⟨X⟩ ⟨x⟩ ↦ ULift.up (s.ι.app (.mk x)) @@ -95,20 +102,22 @@ lemma IsDense.of_fullyFaithful_restrictedULiftYoneda [F.Full] fac s j := h.map_injective (by simp [hφ]) uniq s m hm := h.map_injective (by ext ⟨X⟩ ⟨x⟩ - simp [uliftYoneda, φ, ← hm] ) }⟩ + simp [uliftYoneda, φ, ← hm])}⟩ lemma isDense_iff_fullyFaithful_restrictedULiftYoneda [F.Full] : F.IsDense ↔ Nonempty (restrictedULiftYoneda.{w} F).FullyFaithful := ⟨fun _ ↦ ⟨FullyFaithful.ofFullyFaithful _⟩, fun ⟨h⟩ ↦ IsDense.of_fullyFaithful_restrictedULiftYoneda h⟩ -lemma isStrongGenerator_range_of_isDense [F.IsDense] : - IsStrongGenerator (Set.range F.obj) := - IsStrongGenerator.mk_of_exists_colimitPresentation.{max u₁ u₂ v₁ v₂} - (fun Y ↦ ⟨_, _, ColimitPresentation.mk _ _ - (IsColimit.whiskerEquivalence (canonicalColimitOfIsDense F Y) - ((ShrinkHoms.equivalence _).symm.trans ((Shrink.equivalence _)).symm)), - fun j ↦ ⟨⟨_, by simp⟩, ⟨Iso.refl _⟩⟩⟩) +open ObjectProperty in +lemma isStrongGenerator_of_isDense [F.IsDense] : + IsStrongGenerator (.ofObj F.obj) := + (IsStrongGenerator.mk_of_exists_colimitsOfShape.{max u₁ u₂ v₁ v₂} (fun Y ↦ ⟨_, _, ⟨{ + ι := _ + diag := _ + isColimit := (IsColimit.whiskerEquivalence (F.denseAt Y) + ((ShrinkHoms.equivalence _).symm.trans ((Shrink.equivalence _)).symm)) + prop_diag_obj := by simp }⟩⟩)) end Functor From 97d64f8bd543d8921b4256621ce23212539dda04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sun, 12 Oct 2025 12:17:54 +0200 Subject: [PATCH 129/309] fix --- Mathlib/CategoryTheory/Functor/KanExtension/Dense.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Functor/KanExtension/Dense.lean b/Mathlib/CategoryTheory/Functor/KanExtension/Dense.lean index 29ff47e11abd51..060a9ebb99fcc6 100644 --- a/Mathlib/CategoryTheory/Functor/KanExtension/Dense.lean +++ b/Mathlib/CategoryTheory/Functor/KanExtension/Dense.lean @@ -20,7 +20,7 @@ is equivalent to saying that the restricted Yoneda functor `Functor.isDense_iff_fullyFaithful_restrictedULiftYoneda`). We also show that the range of a dense functor is a strong -generator (see `Functor.isStrongGenerator_range_of_isDense`). +generator (see `Functor.isStrongGenerator_of_isDense`). ## References From e763701da238a979b13a62ab41a7cb9f69cd5fcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sun, 12 Oct 2025 13:27:43 +0200 Subject: [PATCH 130/309] chore(CategoryTheory/Presentable): cleaning up HasCardinalFilteredGenerators --- Mathlib.lean | 1 + .../ClosedUnderIsomorphisms.lean | 4 + .../ObjectProperty/CompleteLattice.lean | 75 ++++++++ .../CategoryTheory/ObjectProperty/Small.lean | 94 ++++++++++ Mathlib/CategoryTheory/Presentable/Basic.lean | 19 ++ .../CardinalFilteredPresentation.lean | 168 ++++++++++-------- .../Presentable/LocallyPresentable.lean | 8 +- 7 files changed, 289 insertions(+), 80 deletions(-) create mode 100644 Mathlib/CategoryTheory/ObjectProperty/CompleteLattice.lean diff --git a/Mathlib.lean b/Mathlib.lean index c53290ccd37b72..4ca0be1fb9654c 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -2680,6 +2680,7 @@ 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 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/Small.lean b/Mathlib/CategoryTheory/ObjectProperty/Small.lean index ba9e6a5736dbd7..492e6f93ab6865 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/Small.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/Small.lean @@ -3,6 +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.CompleteLattice import Mathlib.CategoryTheory.ObjectProperty.FullSubcategory import Mathlib.CategoryTheory.ObjectProperty.Opposite import Mathlib.Logic.Small.Basic @@ -50,4 +51,97 @@ instance (X Y : C) : ObjectProperty.Small.{w} (.pair X Y) := by dsimp [pair] infer_instance +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 + +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) + +/-- 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] +protected class EssentiallySmall (P : ObjectProperty C) : Prop where + 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⟩ + +instance (P : ObjectProperty C) [ObjectProperty.EssentiallySmall.{w} P] : + ObjectProperty.EssentiallySmall.{w} P.isoClosure where + exists_small_le' := by + obtain ⟨Q, _, _, _⟩ := EssentiallySmall.exists_small_le.{w} P + exact ⟨Q, inferInstance, by rwa [isoClosure_le_iff]⟩ + +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₁, 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 diff --git a/Mathlib/CategoryTheory/Presentable/Basic.lean b/Mathlib/CategoryTheory/Presentable/Basic.lean index eead4b228e6558..058150811d5f18 100644 --- a/Mathlib/CategoryTheory/Presentable/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/Basic.lean @@ -106,6 +106,13 @@ when the functor `Hom(X, _)` preserves colimits indexed by `κ`-filtered categories. -/ abbrev IsCardinalPresentable : Prop := (coyoneda.obj (op X)).IsCardinalAccessible κ +variable (C) in +/-- The property of objects that are `κ`-presentable. -/ +def isCardinalPresentable : ObjectProperty C := fun X ↦ IsCardinalPresentable X κ + +lemma isCardinalPresentable_iff (X : C) : + isCardinalPresentable C κ X ↔ IsCardinalPresentable X κ := Iff.rfl + lemma preservesColimitsOfShape_of_isCardinalPresentable [IsCardinalPresentable X κ] (J : Type w) [SmallCategory.{w} J] [IsCardinalFiltered J κ] : PreservesColimitsOfShape J (coyoneda.obj (op X)) := @@ -123,11 +130,23 @@ lemma isCardinalPresentable_of_le [IsCardinalPresentable X κ] IsCardinalPresentable X κ' := (coyoneda.obj (op X)).isCardinalAccessible_of_le h +variable (C) {κ} in +lemma isCardinalPresentable_monotone {κ' : Cardinal.{w}} [Fact κ'.IsRegular] (h : κ ≤ κ') : + isCardinalPresentable C κ ≤ isCardinalPresentable C κ' := by + intro X hX + rw [isCardinalPresentable_iff] at hX ⊢ + exact isCardinalPresentable_of_le _ h + include e in variable {X Y} in lemma isCardinalPresentable_of_iso [IsCardinalPresentable X κ] : IsCardinalPresentable Y κ := Functor.isCardinalAccessible_of_natIso (coyoneda.mapIso e.symm.op) κ +instance : (isCardinalPresentable C κ).IsClosedUnderIsomorphisms where + of_iso e hX := by + rw [isCardinalPresentable_iff] at hX ⊢ + exact isCardinalPresentable_of_iso e _ + lemma isCardinalPresentable_of_equivalence {C' : Type u₃} [Category.{v₃} C'] [IsCardinalPresentable X κ] (e : C ≌ C') : IsCardinalPresentable (e.functor.obj X) κ := by diff --git a/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean b/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean index 6c429a8e3df0dd..50812a21fe688a 100644 --- a/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean +++ b/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean @@ -3,27 +3,25 @@ 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.Presentable.Limits import Mathlib.CategoryTheory.Generator.StrongGenerator /-! # Presentable generators -Let `C` be a category, `G : ι → C` a family of objects and `κ` a regular cardinal -(with `ι` and `κ` both in the same universe `w`). In this file, we -introduce a property `h : AreCardinalFilteredGenerators G κ`: -this property says that the objects `G i` are all `κ`-presentable and that -any object in `C` identifies as a `κ`-filtered colimit of these objects. -We show in the lemma `AreCardinalFilteredGenerators.presentable` that it -follows that any object `X` is presentable (relatively to a possibly -larger regular cardinal `κ'`). The lemma `AreCardinalFilteredGenerators.isStrongGenerator` -shows that the objects `G i` form a strong generator of the category `C`. - -Finally, we define a typeclass `HasCardinalFilteredGenerators C κ` saying -that `C` is locally `w`-small and that there exists a family `G : ι → C` -indexed by `ι : Type w` such that `AreCardinalFilteredGenerators G κ` holds. -This is used in the definition of locally presentable and accessible -categories in the file `CategoryTheory.Presentable.LocallyPresentable`. +Let `C` be a category, a regular cardinal `κ` and `P : ObjectProperty C`. +We define a predicate `P.IsCardinalFilteredGenerator κ` saying that +`P` consists of `κ`-presentable objects and that any objects in `C` +is a `κ`-filtered colimit of objects satisfying `P`. +We show that if this condition is satisfied, then `P` is a strong generator +(see `IsCardinalFilteredGenerator.isStrongGenerator`). Moreover, +if `C` is locally small, we show that any object in `C` is presentable +(see `IsCardinalFilteredGenerator.presentable`). + +Finally, we define a typeclass `HasCardinalFilteredGenerator C κ` saying +that `C` is locally `w`-small and that there exists an (essentially) small `P` +such that `P.IsCardinalFilteredGenerator κ` holds. ## References * [Adámek, J. and Rosický, J., *Locally presentable and accessible categories*][Adamek_Rosicky_1994] @@ -51,92 +49,108 @@ end Limits.ColimitPresentation open Limits -section - -variable {ι : Type w} (G : ι → C) (κ : Cardinal.{w}) [Fact κ.IsRegular] - -/-- Given a regular cardinal `κ`, this is the property that a family -of objects `G : ι → C` consists of `κ`-presentable objects and that any -object in `C` identifies to a `κ`-filtered colimit of these objects. -/ -structure AreCardinalFilteredGenerators : Prop where - isCardinalPresentable (i : ι) : IsCardinalPresentable (G i) κ - exists_colimitPresentation (X : C) : - ∃ (J : Type w) (_ : SmallCategory J) (_ : IsCardinalFiltered J κ) - (p : ColimitPresentation J X), - ∀ (j : J), ∃ (i : ι), Nonempty (p.diag.obj j ≅ G i) - -namespace AreCardinalFilteredGenerators +namespace ObjectProperty -variable {G κ} (h : AreCardinalFilteredGenerators G κ) (X : C) +variable {P : ObjectProperty C} -/-- When `G : ι → C` is a family of objects such that `AreCardinalFilteredGenerators G κ` -holds, and `X : C`, this is the index category of a presentation of `X` -as a `κ`-filtered colimit of objects in the family `G`. -/ -def J : Type w := (h.exists_colimitPresentation X).choose +lemma ColimitOfShape.isCardinalPresentable {X : C} {J : Type w} [SmallCategory J] + (p : P.ColimitOfShape J X) {κ : Cardinal.{w}} [Fact κ.IsRegular] + (hP : P ≤ isCardinalPresentable C κ) [LocallySmall.{w} C] + (κ' : Cardinal.{w}) [Fact κ'.IsRegular] (h : κ ≤ κ') + (hJ : HasCardinalLT (Arrow J) κ') : + IsCardinalPresentable X κ' := + p.toColimitPresentation.isCardinalPresentable κ + (fun j ↦ hP _ (p.prop_diag_obj j)) _ h hJ -noncomputable instance : SmallCategory (h.J X) := - (h.exists_colimitPresentation X).choose_spec.choose +variable {κ : Cardinal.{w}} [Fact κ.IsRegular] -noncomputable instance : IsCardinalFiltered (h.J X) κ := - (h.exists_colimitPresentation X).choose_spec.choose_spec.choose +variable (P κ) in +/-- The condition that `P : ObjectProperty C` consists of `κ`-presentable objects +and that any object of `C` is a `κ`-filtered colimit of objects satisfying `P`. +(This notion is particularly relevant when `C` is locally `w`-small and `P` is +essentially `w`-small, see `HasCardinalFilteredGenerators`, which appears in +the definitions of locally presentable and accessible categories.) -/ +structure IsCardinalFilteredGenerator : Prop where + le_isCardinalPresentable : P ≤ isCardinalPresentable C κ + exists_colimitsOfShape (X : C) : + ∃ (J : Type w) (_ : SmallCategory J) (_ : IsCardinalFiltered J κ), + P.colimitsOfShape J X -/-- A choice of a presentation of an object `X` in a category `C` -as a `κ`-filtered colimit of objects in the family `G : ι → C` -when `h : AreCardinalFilteredGenerators G κ`. -/ -noncomputable def colimitPresentation : ColimitPresentation (h.J X) X := - (h.exists_colimitPresentation X).choose_spec.choose_spec.choose_spec.choose +namespace IsCardinalFilteredGenerator -lemma exists_colimitPresentation_diag_obj_iso (j : h.J X) : - ∃ (i : ι), Nonempty ((h.colimitPresentation X).diag.obj j ≅ G i) := - (h.exists_colimitPresentation X).choose_spec.choose_spec.choose_spec.choose_spec j +variable (h : P.IsCardinalFilteredGenerator κ) (X : C) -instance (j : h.J X) : - IsCardinalPresentable.{w} ((h.colimitPresentation X).diag.obj j) κ := by - obtain ⟨i, ⟨e⟩⟩ := h.exists_colimitPresentation_diag_obj_iso X j - have := h.isCardinalPresentable - exact isCardinalPresentable_of_iso e.symm κ +include h in +lemma of_le_isoClosure {P' : ObjectProperty C} (h₁ : P ≤ P'.isoClosure) + (h₂ : P' ≤ isCardinalPresentable C κ) : + P'.IsCardinalFilteredGenerator κ where + le_isCardinalPresentable := h₂ + exists_colimitsOfShape X := by + obtain ⟨J, _, _, hX⟩ := h.exists_colimitsOfShape X + exact ⟨J, inferInstance, inferInstance, by + simpa only [colimitsOfShape_isoClosure] using colimitsOfShape_monotone J h₁ _ hX⟩ include h in -lemma isPresentable (i : ι) : IsPresentable.{w} (G i) := - have := h.isCardinalPresentable - isPresentable_of_isCardinalPresentable _ κ +lemma isoClosure : P.isoClosure.IsCardinalFilteredGenerator κ := + h.of_le_isoClosure (P.le_isoClosure.trans P.isoClosure.le_isoClosure) + (by simpa only [ObjectProperty.isoClosure_le_iff] using h.le_isCardinalPresentable) -instance (j : h.J X) : IsPresentable.{w} ((h.colimitPresentation X).diag.obj j) := - isPresentable_of_isCardinalPresentable _ κ +lemma isoClosure_iff : + P.isoClosure.IsCardinalFilteredGenerator κ ↔ P.IsCardinalFilteredGenerator κ := + ⟨fun h ↦ h.of_le_isoClosure (by rfl) (P.le_isoClosure.trans h.le_isCardinalPresentable), + isoClosure⟩ include h in -lemma presentable [LocallySmall.{w} C] (X : C) : IsPresentable.{w} X := by +lemma presentable [LocallySmall.{w} C] (X : C) : + IsPresentable.{w} X := by + obtain ⟨J, _, _, ⟨hX⟩⟩ := h.exists_colimitsOfShape X obtain ⟨κ', _, le, hκ'⟩ : ∃ (κ' : Cardinal.{w}) (_ : Fact κ'.IsRegular) (_ : κ ≤ κ'), - HasCardinalLT (Arrow (h.J X)) κ' := by + HasCardinalLT (Arrow J) κ' := by obtain ⟨κ', h₁, h₂⟩ := HasCardinalLT.exists_regular_cardinal_forall.{w} - (Sum.elim (fun (_ : Unit) ↦ Arrow (h.J X)) (fun (_ : Unit) ↦ κ.ord.toType)) + (Sum.elim (fun (_ : Unit) ↦ Arrow J) (fun (_ : Unit) ↦ κ.ord.toType)) exact ⟨κ', ⟨h₁⟩, le_of_lt (by simpa [hasCardinalLT_iff_cardinal_mk_lt] using h₂ (Sum.inr ⟨⟩)), h₂ (Sum.inl ⟨⟩)⟩ - have := (h.colimitPresentation X).isCardinalPresentable κ (by infer_instance) κ' le hκ' + have := hX.isCardinalPresentable h.le_isCardinalPresentable _ le hκ' exact isPresentable_of_isCardinalPresentable _ κ' --- TODO: Move `AreCardinalFilteredGenerators` to the `ObjectProperty` namespace include h in -lemma isStrongGenerator : - ObjectProperty.IsStrongGenerator (Set.range G : ObjectProperty C) := - .mk_of_exists_colimitsOfShape (fun X ↦ ⟨h.J X, inferInstance, by - change ObjectProperty.colimitsOfShape (Set.range G) (h.J X) X - rw [← ObjectProperty.colimitsOfShape_isoClosure] - refine ⟨h.colimitPresentation X, fun j ↦ ?_⟩ - obtain ⟨i, ⟨e⟩⟩ := h.exists_colimitPresentation_diag_obj_iso X j - exact ⟨_, ⟨i, rfl⟩, ⟨e⟩⟩⟩) +lemma isStrongGenerator : P.IsStrongGenerator := + IsStrongGenerator.mk_of_exists_colimitsOfShape.{w} (fun X ↦ by + obtain ⟨_, _, _, hX⟩ := h.exists_colimitsOfShape X + exact ⟨_, _, hX⟩) -end AreCardinalFilteredGenerators +end IsCardinalFilteredGenerator -end +end ObjectProperty /-- The property that a category `C` and a regular cardinal `κ` -satisfy `AreCardinalFilteredGenerators G κ` for a suitable family -of objects `G : ι → C`. -/ -class HasCardinalFilteredGenerators (C : Type u) [hC : Category.{v} C] +satisfy `P.IsCardinalFilteredGenerators κ` for an suitable essentially +small `P : ObjectProperty C`. -/ +class HasCardinalFilteredGenerator (C : Type u) [hC : Category.{v} C] (κ : Cardinal.{w}) [hκ : Fact κ.IsRegular] : Prop extends LocallySmall.{w} C where - exists_generators (C κ) [hC] [hκ] : ∃ (ι : Type w) (G : ι → C), - AreCardinalFilteredGenerators G κ + exists_generator (C κ) [hC] [hκ] : + ∃ (P : ObjectProperty C) (_ : ObjectProperty.EssentiallySmall.{w} P), + P.IsCardinalFilteredGenerator κ + +lemma ObjectProperty.IsCardinalFilteredGenerator.hasCardinalFilteredGenerator + {P : ObjectProperty C} [ObjectProperty.EssentiallySmall.{w} P] + [LocallySmall.{w} C] {κ : Cardinal.{w}} [hκ : Fact κ.IsRegular] + (hP : P.IsCardinalFilteredGenerator κ) : + HasCardinalFilteredGenerator C κ where + exists_generator := ⟨P, inferInstance, hP⟩ + +lemma HasCardinalFilteredGenerator.exists_small_generator (C : Type u) [Category.{v} C] + (κ : Cardinal.{w}) [Fact κ.IsRegular] [HasCardinalFilteredGenerator C κ] : + ∃ (P : ObjectProperty C) (_ : ObjectProperty.Small.{w} P), + P.IsCardinalFilteredGenerator κ := by + obtain ⟨P, _, hP⟩ := HasCardinalFilteredGenerator.exists_generator C κ + obtain ⟨Q, _, h₁, h₂⟩ := ObjectProperty.EssentiallySmall.exists_small_le P + exact ⟨Q, inferInstance, hP.of_le_isoClosure h₂ (h₁.trans hP.le_isCardinalPresentable)⟩ + +@[deprecated (since := "2025-10-12")] alias AreCardinalFilteredGenerators := + ObjectProperty.IsCardinalFilteredGenerator +@[deprecated (since := "2025-10-12")] alias HasCardinalFilteredGenerators := + HasCardinalFilteredGenerator end CategoryTheory diff --git a/Mathlib/CategoryTheory/Presentable/LocallyPresentable.lean b/Mathlib/CategoryTheory/Presentable/LocallyPresentable.lean index 0af2bca046cdad..34d8bc6058321e 100644 --- a/Mathlib/CategoryTheory/Presentable/LocallyPresentable.lean +++ b/Mathlib/CategoryTheory/Presentable/LocallyPresentable.lean @@ -35,13 +35,13 @@ variable (C : Type u) [Category.{v} C] (κ : Cardinal.{w}) [Fact κ.IsRegular] if it is cocomplete and admits a (small) family `G : ι → C` of `κ`-presentable objects such that any object identifies as a `κ`-filtered colimit of these objects. -/ class IsCardinalLocallyPresentable : Prop - extends HasCardinalFilteredGenerators C κ, HasColimitsOfSize.{w, w} C where + extends HasCardinalFilteredGenerator C κ, HasColimitsOfSize.{w, w} C where /-- Given a regular cardinal `κ`, a category `C` is `κ`-accessible if it has `κ`-filtered colimits and admits a (small) family `G : ι → C` of `κ`-presentable objects such that any object identifies as a `κ`-filtered colimit of these objects. -/ class IsCardinalAccessibleCategory : Prop - extends HasCardinalFilteredGenerators C κ, HasCardinalFilteredColimits.{w} C κ where + extends HasCardinalFilteredGenerator C κ, HasCardinalFilteredColimits.{w} C κ where instance [IsCardinalLocallyPresentable C κ] : IsCardinalAccessibleCategory C κ where @@ -72,9 +72,11 @@ instance [IsLocallyPresentable.{w} C] : IsAccessibleCategory.{w} C where instance [IsAccessibleCategory.{w} C] (X : C) : IsPresentable.{w} X := by obtain ⟨κ, _, _⟩ := IsAccessibleCategory.exists_cardinal C - obtain ⟨ι, G, h⟩ := HasCardinalFilteredGenerators.exists_generators C κ + obtain ⟨_, _, h⟩ := HasCardinalFilteredGenerator.exists_generator C κ apply h.presentable +example [IsLocallyPresentable.{w} C] (X : C) : IsPresentable.{w} X := inferInstance + end end CategoryTheory 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 131/309] 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 59c53277478df138e8d1d085ad2e4140bc647253 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Wed, 15 Oct 2025 18:24:00 +0200 Subject: [PATCH 132/309] wip --- Mathlib.lean | 1 + .../CategoryTheory/Presentable/Directed.lean | 148 ++++++++++++++++++ 2 files changed, 149 insertions(+) create mode 100644 Mathlib/CategoryTheory/Presentable/Directed.lean diff --git a/Mathlib.lean b/Mathlib.lean index 4bd065511461a8..6f1c6083906773 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -2734,6 +2734,7 @@ 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.Directed import Mathlib.CategoryTheory.Presentable.Finite import Mathlib.CategoryTheory.Presentable.IsCardinalFiltered import Mathlib.CategoryTheory.Presentable.Limits diff --git a/Mathlib/CategoryTheory/Presentable/Directed.lean b/Mathlib/CategoryTheory/Presentable/Directed.lean new file mode 100644 index 00000000000000..4f6c0d173cede8 --- /dev/null +++ b/Mathlib/CategoryTheory/Presentable/Directed.lean @@ -0,0 +1,148 @@ +/- +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.IsCardinalFiltered +import Mathlib.CategoryTheory.MorphismProperty.Basic + +/-! +# `κ`-filtered categories and `κ`-directed poset + +-/ + +universe w + +lemma hasCardinalLT_of_finite + (X : Type*) [Finite X] (κ : Cardinal) (hκ : Cardinal.aleph0 ≤ κ) : + HasCardinalLT X κ := by + exact HasCardinalLT.of_le (by rwa [hasCardinalLT_aleph0_iff]) hκ + +lemma hasCardinalLT_punit (κ : Cardinal) (hκ : Cardinal.aleph0 ≤ κ) : + HasCardinalLT PUnit κ := + hasCardinalLT_of_finite _ _ hκ + +namespace CategoryTheory + +namespace IsCardinalFiltered + +variable (J : Type w) [SmallCategory J] (κ : Cardinal.{w}) + +namespace ExistsDirected + +@[ext] +structure PreDiagram where + W : MorphismProperty J + P : ObjectProperty J + src {i j : J} {f : i ⟶ j} : W f → P i + tgt {i j : J} {f : i ⟶ j} : W f → P j + hW : HasCardinalLT W.toSet κ + hP : HasCardinalLT (Subtype P) κ + +namespace PreDiagram + +variable {J κ} + +structure Terminal (D : PreDiagram J κ) (e : J) where + prop_id : D.W (𝟙 e) + lift {j : J} (hj : D.P j) : j ⟶ e + hlift {j : J} (hj : D.P j) : D.W (lift hj) + uniq {j : J} (hj : D.P j) {φ : j ⟶ e} (hφ : D.W φ) : lift hj = φ + comm {i j : J} (f : i ⟶ j) (hf : D.W f) : f ≫ lift (D.tgt hf) = lift (D.src hf) + +namespace Terminal + +attribute [reassoc] Terminal.comm + +variable {D : PreDiagram J κ} {e : J} + +lemma prop (h : D.Terminal e) : D.P e := D.src (h.prop_id) + +@[simp] +lemma lift_self (h : D.Terminal e) : h.lift h.prop = 𝟙 e := h.uniq _ h.prop_id + +instance : Subsingleton (D.Terminal e) where + allEq h₁ h₂ := by + have : @h₁.lift = @h₂.lift := by + ext j hj + exact h₁.uniq hj (h₂.hlift hj) + cases h₁ + cases h₂ + aesop + +end Terminal + +end PreDiagram + +structure Diagram extends PreDiagram J κ where + e : J + terminal : toPreDiagram.Terminal e + uniq_terminal (j : J) (hj : toPreDiagram.Terminal j) : j = e + +@[ext] +lemma Diagram.ext {D₁ D₂ : Diagram J κ} (hW : D₁.W = D₂.W) (hP : D₁.P = D₂.P) : D₁ = D₂ := by + obtain ⟨D₁, e, h₁, h₁'⟩ := D₁ + obtain ⟨D₂, e', h₂, h₂'⟩ := D₂ + obtain rfl : D₁ = D₂ := by aesop + obtain rfl : e = e' := h₂' _ h₁ + obtain rfl : h₁ = h₂ := by subsingleton + rfl + +instance : PartialOrder (Diagram J κ) where + le D₁ D₂ := D₁.W ≤ D₂.W ∧ D₁.P ≤ D₂.P + le_refl _ := ⟨by rfl, by rfl⟩ + le_trans _ _ _ h₁ h₂ := ⟨h₁.1.trans h₂.1, h₁.2.trans h₂.2⟩ + le_antisymm _ _ h₁ h₂ := by + ext : 1 + · exact le_antisymm h₁.1 h₂.1 + · exact le_antisymm h₁.2 h₂.2 + +section + +variable {J κ} + +def functorMap {D₁ D₂ : Diagram J κ} (h : D₁ ≤ D₂) : D₁.e ⟶ D₂.e := + D₂.terminal.lift (h.2 _ D₁.terminal.prop) + +@[simp] +lemma functorMap_id (D : Diagram J κ) : functorMap (le_refl D) = 𝟙 D.e := by + simp [functorMap] + +@[reassoc (attr := simp)] +lemma functorMap_comp {D₁ D₂ D₃ : Diagram J κ} (h₁₂ : D₁ ≤ D₂) (h₂₃ : D₂ ≤ D₃) : + functorMap h₁₂ ≫ functorMap h₂₃ = functorMap (h₁₂.trans h₂₃) := + D₃.terminal.comm _ (h₂₃.1 _ (D₂.terminal.hlift _)) + +end + +@[simps] +def functor : Diagram J κ ⥤ J where + obj D := D.e + map h := functorMap (leOfHom h) + +variable [Fact κ.IsRegular] + +def PreDiagram.single (j : J) : PreDiagram J κ where + W := .ofHoms (fun (_ : Unit) ↦ 𝟙 j) + P := .ofObj (fun (_ : Unit) ↦ j) + src := by rintro _ _ _ ⟨⟩; exact ⟨⟨⟩⟩ + tgt := by rintro _ _ _ ⟨⟩; exact ⟨⟨⟩⟩ + hW := + (hasCardinalLT_punit κ (Cardinal.IsRegular.aleph0_le Fact.out)).of_surjective + (f := fun (_ : Unit) ↦ ⟨Arrow.mk (𝟙 j), ⟨⟨⟩⟩⟩) (by + rintro ⟨f, hf⟩ + refine ⟨⟨⟩, ?_⟩ + ext + exact ((MorphismProperty.ofHoms_iff _ _).1 + ((MorphismProperty.arrow_mk_mem_toSet_iff _ _).1 hf)).choose_spec.symm) + hP := + (hasCardinalLT_punit κ (Cardinal.IsRegular.aleph0_le Fact.out)).of_surjective + (f := fun (_ : Unit) ↦ ⟨j, by simp⟩) (fun ⟨k, hk⟩ ↦ ⟨⟨⟩, by aesop⟩) + +variable (hJ : ∀ (e : J), (∀ (j : J), Nonempty (j ⟶ e)) → False) + +end ExistsDirected + +end IsCardinalFiltered + +end CategoryTheory From bbd2dba04aa80f7dbb295939530583cbf58adfe8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Wed, 15 Oct 2025 19:28:56 +0200 Subject: [PATCH 133/309] wip --- Mathlib/CategoryTheory/Presentable/Directed.lean | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Mathlib/CategoryTheory/Presentable/Directed.lean b/Mathlib/CategoryTheory/Presentable/Directed.lean index 4f6c0d173cede8..336525377666e2 100644 --- a/Mathlib/CategoryTheory/Presentable/Directed.lean +++ b/Mathlib/CategoryTheory/Presentable/Directed.lean @@ -122,6 +122,8 @@ def functor : Diagram J κ ⥤ J where variable [Fact κ.IsRegular] +variable {J κ} in +@[simps] def PreDiagram.single (j : J) : PreDiagram J κ where W := .ofHoms (fun (_ : Unit) ↦ 𝟙 j) P := .ofObj (fun (_ : Unit) ↦ j) @@ -139,6 +141,18 @@ def PreDiagram.single (j : J) : PreDiagram J κ where (hasCardinalLT_punit κ (Cardinal.IsRegular.aleph0_le Fact.out)).of_surjective (f := fun (_ : Unit) ↦ ⟨j, by simp⟩) (fun ⟨k, hk⟩ ↦ ⟨⟨⟩, by aesop⟩) +variable {J κ} in +def Diagram.single (j : J) : Diagram J κ where + toPreDiagram := .single j + e := j + terminal := + { prop_id := ⟨⟨⟩⟩ + lift := by rintro j hj; simp at hj; subst hj; exact 𝟙 _ + hlift := by rintro j hj; simp at hj; subst hj; exact ⟨⟨⟩⟩ + uniq := by rintro j hj φ hφ; simp at hj; subst hj; obtain ⟨⟨⟩⟩ := hφ; simp + comm := by rintro _ _ f hf; obtain ⟨⟨⟩⟩ := hf; simp } + uniq_terminal := by rintro _ ⟨⟨⟩⟩; rfl + variable (hJ : ∀ (e : J), (∀ (j : J), Nonempty (j ⟶ e)) → False) end ExistsDirected From 408a8b152248ec457b0533549b98d316932cc681 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Wed, 15 Oct 2025 20:42:00 +0200 Subject: [PATCH 134/309] wip --- .../CategoryTheory/Presentable/Directed.lean | 73 ++++++++++++++++++- 1 file changed, 70 insertions(+), 3 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/Directed.lean b/Mathlib/CategoryTheory/Presentable/Directed.lean index 336525377666e2..2f41233938d0dc 100644 --- a/Mathlib/CategoryTheory/Presentable/Directed.lean +++ b/Mathlib/CategoryTheory/Presentable/Directed.lean @@ -4,6 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.CategoryTheory.Presentable.IsCardinalFiltered +import Mathlib.CategoryTheory.Limits.Final import Mathlib.CategoryTheory.MorphismProperty.Basic /-! @@ -15,8 +16,8 @@ universe w lemma hasCardinalLT_of_finite (X : Type*) [Finite X] (κ : Cardinal) (hκ : Cardinal.aleph0 ≤ κ) : - HasCardinalLT X κ := by - exact HasCardinalLT.of_le (by rwa [hasCardinalLT_aleph0_iff]) hκ + HasCardinalLT X κ := + .of_le (by rwa [hasCardinalLT_aleph0_iff]) hκ lemma hasCardinalLT_punit (κ : Cardinal) (hκ : Cardinal.aleph0 ≤ κ) : HasCardinalLT PUnit κ := @@ -153,10 +154,76 @@ def Diagram.single (j : J) : Diagram J κ where comm := by rintro _ _ f hf; obtain ⟨⟨⟩⟩ := hf; simp } uniq_terminal := by rintro _ ⟨⟨⟩⟩; rfl -variable (hJ : ∀ (e : J), (∀ (j : J), Nonempty (j ⟶ e)) → False) +variable {J κ} in +@[simps] +def PreDiagram.iSup {ι : Type*} (D : ι → PreDiagram J κ) (hι : HasCardinalLT ι κ) : + PreDiagram J κ where + W := ⨆ (i : ι), (D i).W + P := ⨆ (i : ι), (D i).P + src hf := by + simp at hf ⊢ + obtain ⟨i, hi⟩ := hf + exact ⟨i, (D i).src hi⟩ + tgt hf := by + simp at hf ⊢ + obtain ⟨i, hi⟩ := hf + exact ⟨i, (D i).tgt hi⟩ + hW := sorry + hP := by + rw [hasCardinalLT_iff_cardinal_mk_lt] + sorry + +variable {J κ} in +@[simps] +def PreDiagram.max (D₁ D₂ : PreDiagram J κ) : + PreDiagram J κ where + W := D₁.W ⊔ D₂.W + P := D₁.P ⊔ D₂.P + src := by + rintro _ _ _ (h | h) + · exact Or.inl (D₁.src h) + · exact Or.inr (D₂.src h) + tgt := by + rintro _ _ _ (h | h) + · exact Or.inl (D₁.tgt h) + · exact Or.inr (D₂.tgt h) + hW := sorry + hP := sorry + +variable [IsCardinalFiltered J κ] + (hJ : ∀ (e : J), ∃ (m : J) (_ : e ⟶ m), IsEmpty (m ⟶ e)) + +include hJ in +lemma isCardinalFiltered : IsCardinalFiltered (Diagram J κ) κ := + isCardinalFiltered_preorder _ _ (fun ι D hι ↦ by + simp only [← hasCardinalLT_iff_cardinal_mk_lt] at hι + choose m₀ t₀ hm₀ using fun i ↦ hJ (D i).e + let m₁ := IsCardinalFiltered.max m₀ hι + let t₁ (i : ι) : m₀ i ⟶ m₁ := IsCardinalFiltered.toMax m₀ hι i + let u (i : ι) : (D i).e ⟶ m₁ := t₀ i ≫ t₁ i + obtain ⟨m₂, t₂, hm₂⟩ : ∃ (m₂ : J) (t₂ : m₁ ⟶ m₂), + ∀ (i₁ i₂ : ι) (j : J) (hj₁ : (D i₁).P j) (hj₂ : (D i₂).P j), + (D i₁).terminal.lift hj₁ ≫ u i₁ ≫ t₂ = (D i₂).terminal.lift hj₂ ≫ u i₂ ≫ t₂ := by + sorry + let φ (x : (Σ (i : ι), (Subtype (D i).P))) : (D x.1).e ⟶ m₂ := + (D x.1).terminal.lift (D x.1).terminal.prop ≫ u x.1 ≫ t₂ + let D₀ := PreDiagram.iSup (fun i ↦ (D i).toPreDiagram) hι + let D₁ := D₀.max (.single m₂) + let D₂ : PreDiagram J κ := + { W := D₁.W ⊔ .ofHoms φ + P := D₁.P + src := sorry + tgt := sorry + hW := sorry + hP := sorry } + sorry) end ExistsDirected +lemma exists_cardinal_directed [Fact κ.IsRegular] [IsCardinalFiltered J κ] : + ∃ (α : Type w) (_ : PartialOrder α) (_ : IsCardinalFiltered α κ) + (F : α ⥤ J), F.Final := sorry + end IsCardinalFiltered end CategoryTheory From 89a50d89cf2025ff930fc812fdbe68f466b73ce8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Wed, 15 Oct 2025 22:25:26 +0200 Subject: [PATCH 135/309] wip --- .../CategoryTheory/Presentable/Directed.lean | 94 +++++++++++++++++-- 1 file changed, 88 insertions(+), 6 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/Directed.lean b/Mathlib/CategoryTheory/Presentable/Directed.lean index 2f41233938d0dc..a5889cf0139e9f 100644 --- a/Mathlib/CategoryTheory/Presentable/Directed.lean +++ b/Mathlib/CategoryTheory/Presentable/Directed.lean @@ -71,6 +71,21 @@ instance : Subsingleton (D.Terminal e) where cases h₂ aesop +noncomputable def ofExistsUnique (prop_id : D.W (𝟙 e)) + (h₁ : ∀ ⦃j : J⦄ (_ : D.P j), ∃ (lift : j ⟶ e), D.W lift) + (h₂ : ∀ ⦃j : J⦄ (_ : D.P j) (l₁ l₂ : j ⟶ e), D.W l₁ → D.W l₂ → l₁ = l₂) + (h₃ : ∀ ⦃i j : J⦄ (f : i ⟶ j) (_ : D.W f), ∃ (li : i ⟶ e) (lj : j ⟶ e), + D.W li ∧ D.W lj ∧ f ≫ lj = li) : + D.Terminal e where + prop_id := prop_id + lift hj := (h₁ hj).choose + hlift hj := (h₁ hj).choose_spec + uniq hj φ hφ := h₂ hj (h₁ hj).choose φ (h₁ hj).choose_spec hφ + comm _ hf := by + obtain ⟨li, lj, hli, hlj, fac⟩ := h₃ _ hf + rw [h₂ (D.src hf) _ li (h₁ (D.src hf)).choose_spec hli, + h₂ (D.tgt hf) _ lj (h₁ (D.tgt hf)).choose_spec hlj, fac] + end Terminal end PreDiagram @@ -168,7 +183,8 @@ def PreDiagram.iSup {ι : Type*} (D : ι → PreDiagram J κ) (hι : HasCardinal simp at hf ⊢ obtain ⟨i, hi⟩ := hf exact ⟨i, (D i).tgt hi⟩ - hW := sorry + hW := by + sorry hP := by rw [hasCardinalLT_iff_cardinal_mk_lt] sorry @@ -205,18 +221,84 @@ lemma isCardinalFiltered : IsCardinalFiltered (Diagram J κ) κ := ∀ (i₁ i₂ : ι) (j : J) (hj₁ : (D i₁).P j) (hj₂ : (D i₂).P j), (D i₁).terminal.lift hj₁ ≫ u i₁ ≫ t₂ = (D i₂).terminal.lift hj₂ ≫ u i₂ ≫ t₂ := by sorry - let φ (x : (Σ (i : ι), (Subtype (D i).P))) : (D x.1).e ⟶ m₂ := - (D x.1).terminal.lift (D x.1).terminal.prop ≫ u x.1 ≫ t₂ + let φ (x : (Σ (i : ι), (Subtype (D i).P))) : x.2.1 ⟶ m₂ := + (D x.1).terminal.lift x.2.2 ≫ u x.1 ≫ t₂ let D₀ := PreDiagram.iSup (fun i ↦ (D i).toPreDiagram) hι + have hD₀ {i : ι} : ¬ (D i).P m₂ := fun hi ↦ + (hm₀ i).false (t₁ _ ≫ t₂ ≫ (D i).terminal.lift hi) let D₁ := D₀.max (.single m₂) let D₂ : PreDiagram J κ := { W := D₁.W ⊔ .ofHoms φ P := D₁.P - src := sorry - tgt := sorry + src := by + simp [D₁, D₀] + rintro _ _ _ ((hf | ⟨⟨⟩⟩) | ⟨i, j, hj⟩) + · simp at hf + obtain ⟨i, hf⟩ := hf + exact Or.inl ⟨i, (D i).src hf⟩ + · exact Or.inr rfl + · exact Or.inl ⟨i, hj⟩ + tgt := by + simp [D₁, D₀] + rintro _ _ _ ((hf | ⟨⟨⟩⟩) | ⟨i, j, hj⟩) + · simp at hf + obtain ⟨i, hf⟩ := hf + exact Or.inl ⟨i, (D i).tgt hf⟩ + · exact Or.inr rfl + · exact Or.inr rfl hW := sorry hP := sorry } - sorry) + have hD₂ {f : m₂ ⟶ m₂} (hf : D₂.W f) : f = 𝟙 _ := by + simp [D₂, D₁, D₀] at hf + obtain ((hf | ⟨⟨⟩⟩) | hf) := hf + · simp at hf + obtain ⟨i, hi⟩ := hf + exact (hD₀ ((D i).src hi)).elim + · rfl + · rw [MorphismProperty.ofHoms_iff] at hf + obtain ⟨⟨i, j, hj⟩, hi⟩ := hf + obtain rfl : m₂ = j := congr_arg Arrow.leftFunc.obj hi + exact (hD₀ hj).elim + let he : D₂.Terminal m₂ := by + have H {i : ι} {j : J} (hj : (D i).P j) {f : j ⟶ m₂} (hf : D₂.W f) : + f = φ ⟨i, ⟨_, hj⟩⟩ := by + simp [D₂, D₁, D₀] at hf + obtain ((hf | ⟨⟨⟩⟩) | ⟨⟨i', j, hj'⟩⟩) := hf + · simp at hf + obtain ⟨i, hf⟩ := hf + exact (hD₀ ((D i).tgt hf)).elim + · exact (hD₀ hj).elim + · apply hm₂ + refine .ofExistsUnique ?_ ?_ ?_ ?_ + · exact Or.inl (Or.inr ⟨⟨⟩⟩) + · simp [D₂, D₁, D₀] + rintro j (⟨i, hi⟩ | rfl) + · exact ⟨φ ⟨i, _, hi⟩, Or.inr (.mk _)⟩ + · exact ⟨𝟙 _, Or.inl (Or.inr ⟨⟨⟩⟩)⟩ + · intro j hj l₁ l₂ hl₁ hl₂ + simp [D₂, D₁, D₀] at hj + obtain (⟨i, hj⟩ | rfl) := hj + · obtain rfl := H hj hl₁ + obtain rfl := H hj hl₂ + rfl + · rw [hD₂ hl₁, hD₂ hl₂] + · sorry + let D₂' : Diagram J κ := + { toPreDiagram := D₂ + e := _ + terminal := he + uniq_terminal j hj := by + have := hj.prop + simp [D₂, D₁, D₀] at this + obtain (⟨i, hi⟩ | rfl) := this + · exfalso + exact (hm₀ i).false (t₁ _ ≫ t₂ ≫ hj.lift + (by simp [D₂, D₁]) ≫ (D i).terminal.lift hi) + · rfl } + refine ⟨D₂', fun i ↦ ⟨?_, ?_⟩⟩ + · exact le_trans (le_trans (le_trans (by rfl) (le_iSup _ i)) + le_sup_left) le_sup_left + · exact le_trans (le_trans (by rfl) (le_iSup _ i)) le_sup_left) end ExistsDirected From aab450c1e577548109e681c739c28ca486e82adc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 16 Oct 2025 12:02:44 +0200 Subject: [PATCH 136/309] mostly done --- .../CategoryTheory/Presentable/Directed.lean | 178 +++++++++++++++++- docs/references.bib | 16 ++ 2 files changed, 188 insertions(+), 6 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/Directed.lean b/Mathlib/CategoryTheory/Presentable/Directed.lean index a5889cf0139e9f..1233b43f0868d4 100644 --- a/Mathlib/CategoryTheory/Presentable/Directed.lean +++ b/Mathlib/CategoryTheory/Presentable/Directed.lean @@ -6,10 +6,31 @@ Authors: Joël Riou import Mathlib.CategoryTheory.Presentable.IsCardinalFiltered import Mathlib.CategoryTheory.Limits.Final import Mathlib.CategoryTheory.MorphismProperty.Basic +import Mathlib.CategoryTheory.Filtered.Final +import Mathlib.CategoryTheory.Products.Unitor /-! # `κ`-filtered categories and `κ`-directed poset +In this file, we formalize the proof by Deligne (SGA 4 I 8.1.6) that for +any (small) filtered category `J`, there exists a final functor `F : α ⥤ J` +where `α` is a directed partially ordered set (`IsFiltered.exists_directed`). +The construction applies more generally to `κ`-filtered categories and +`κ`-directed posets (`IsCardinalFiltered.exists_cardinal_directed`). + +Note: the argument by Deligne is reproduced (without reference) in the book +by Adámek and Rosický (theorem 1.5), but with a mistake: +the construction by Deligne involves considering diagrams +(see `CategoryTheory.IsCardinalFiltered.exists_cardinal_directed.Diagram`) +which are not necessarily *subcategories* (the class of morphisms `W` does not +have to be multiplicativebe.) + +## References +* [Alexander Grothendieck and Jean-Louis Verdier, *Exposé I : Préfaisceaux*, + SGA 4 I 8.1.6][sga-4-tome-1] +* [Adámek, J. and Rosický, J., *Locally presentable and accessible categories*][Adamek_Rosicky_1994] + + -/ universe w @@ -25,11 +46,40 @@ lemma hasCardinalLT_punit (κ : Cardinal) (hκ : Cardinal.aleph0 ≤ κ) : namespace CategoryTheory +open Limits + +namespace Functor.Final + +variable {C D : Type*} [Category C] [Category D] + +instance [IsFiltered D] : (Prod.fst C D).Final := by + let F : D ⥤ Discrete PUnit.{1} := (Functor.const _).obj (Discrete.mk .unit) + have hF : F.Final := Functor.final_of_isFiltered_of_pUnit _ + change (Functor.prod (𝟭 C) F ⋙ (prod.rightUnitorEquivalence.{0} C).functor).Final + infer_instance + +end Functor.Final + namespace IsCardinalFiltered +instance prod (J₁ J₂ : Type*) [Category J₁] [Category J₂] + (κ : Cardinal.{w}) [Fact κ.IsRegular] + [IsCardinalFiltered J₁ κ] [IsCardinalFiltered J₂ κ] : + IsCardinalFiltered (J₁ × J₂) κ where + nonempty_cocone {C _} F hC := ⟨by + let c₁ := cocone (F ⋙ Prod.fst _ _) hC + let c₂ := cocone (F ⋙ Prod.snd _ _) hC + exact + { pt := (c₁.pt, c₂.pt) + ι.app i := (c₁.ι.app i, c₂.ι.app i) + ι.naturality i j f := by + ext + · simpa using c₁.w f + · simpa using c₂.w f}⟩ + variable (J : Type w) [SmallCategory J] (κ : Cardinal.{w}) -namespace ExistsDirected +namespace exists_cardinal_directed @[ext] structure PreDiagram where @@ -209,7 +259,8 @@ def PreDiagram.max (D₁ D₂ : PreDiagram J κ) : variable [IsCardinalFiltered J κ] (hJ : ∀ (e : J), ∃ (m : J) (_ : e ⟶ m), IsEmpty (m ⟶ e)) -include hJ in +include hJ + lemma isCardinalFiltered : IsCardinalFiltered (Diagram J κ) κ := isCardinalFiltered_preorder _ _ (fun ι D hι ↦ by simp only [← hasCardinalLT_iff_cardinal_mk_lt] at hι @@ -220,7 +271,21 @@ lemma isCardinalFiltered : IsCardinalFiltered (Diagram J κ) κ := obtain ⟨m₂, t₂, hm₂⟩ : ∃ (m₂ : J) (t₂ : m₁ ⟶ m₂), ∀ (i₁ i₂ : ι) (j : J) (hj₁ : (D i₁).P j) (hj₂ : (D i₂).P j), (D i₁).terminal.lift hj₁ ≫ u i₁ ≫ t₂ = (D i₂).terminal.lift hj₂ ≫ u i₂ ≫ t₂ := by - sorry + let S := { x : ι × ι × J // (D x.1).P x.2.2 ∧ (D x.2.1).P x.2.2 } + let shape : MultispanShape.{w, w} := + { L := { x : ι × ι × J // (D x.1).P x.2.2 ∧ (D x.2.1).P x.2.2 } + R := PUnit + fst _ := ⟨⟩ + snd _ := ⟨⟩ } + let index : MultispanIndex shape J := + { left x := x.1.2.2 + right _ := m₁ + fst x := (D x.1.1).terminal.lift x.2.1 ≫ u x.1.1 + snd x := (D x.1.2.1).terminal.lift x.2.2 ≫ u x.1.2.1 } + have hshape : HasCardinalLT (Arrow (WalkingMultispan shape)) κ := sorry + let c : Multicofork _ := IsCardinalFiltered.cocone index.multispan hshape + exact ⟨c.pt, c.π ⟨⟩, fun i₁ i₂ j h₁ h₂ ↦ by + simpa [index, shape] using c.condition ⟨⟨i₁, i₂, j⟩, h₁, h₂⟩⟩ let φ (x : (Σ (i : ι), (Subtype (D i).P))) : x.2.1 ⟶ m₂ := (D x.1).terminal.lift x.2.2 ≫ u x.1 ≫ t₂ let D₀ := PreDiagram.iSup (fun i ↦ (D i).toPreDiagram) hι @@ -282,7 +347,13 @@ lemma isCardinalFiltered : IsCardinalFiltered (Diagram J κ) κ := obtain rfl := H hj hl₂ rfl · rw [hD₂ hl₁, hD₂ hl₂] - · sorry + · rintro j k f ((hf | ⟨⟨⟩⟩) | ⟨⟨i, j, hj⟩⟩) + · simp [D₀] at hf + obtain ⟨i, hf⟩ := hf + exact ⟨φ ⟨i, j, (D i).src hf⟩, φ ⟨i, k, (D i).tgt hf⟩, Or.inr ⟨_⟩, Or.inr ⟨_⟩, + by simp [φ, (D i).terminal.comm_assoc _ hf]⟩ + · exact ⟨𝟙 _, 𝟙 _, Or.inl (Or.inr ⟨⟨⟩⟩), Or.inl (Or.inr ⟨⟨⟩⟩), by simp⟩ + · exact ⟨φ ⟨i, j, hj⟩, 𝟙 _, Or.inr ⟨_⟩, Or.inl (Or.inr ⟨⟨⟩⟩), by simp⟩ let D₂' : Diagram J κ := { toPreDiagram := D₂ e := _ @@ -300,12 +371,107 @@ lemma isCardinalFiltered : IsCardinalFiltered (Diagram J κ) κ := le_sup_left) le_sup_left · exact le_trans (le_trans (by rfl) (le_iSup _ i)) le_sup_left) -end ExistsDirected +lemma final_functor : (functor J κ).Final := by + have := isCardinalFiltered J κ hJ + have := isFiltered_of_isCardinalFiltered J κ + have := isFiltered_of_isCardinalFiltered (Diagram J κ) κ + rw [Functor.final_iff_of_isFiltered] + refine ⟨fun j ↦ ⟨.single j, ⟨𝟙 _⟩⟩, fun {j D} (f₁ f₂ : j ⟶ D.e) ↦ ?_⟩ + obtain ⟨m₀, t, hm₀⟩ := hJ D.e + obtain ⟨m₁, u, hu⟩ : ∃ (m₁ : J) (u : m₀ ⟶ m₁), f₁ ≫ t ≫ u = f₂ ≫ t ≫ u := + ⟨_, IsFiltered.coeqHom (f₁ ≫ t) (f₂ ≫ t), + by simpa using IsFiltered.coeq_condition (f₁ ≫ t) (f₂ ≫ t)⟩ + have h₁ : ¬ (D.P m₁) := fun h₁ ↦ hm₀.false (u ≫ D.terminal.lift h₁) + let φ (x : Subtype D.P) : x.1 ⟶ m₁ := D.terminal.lift x.2 ≫ t ≫ u + let D₀ := D.toPreDiagram.max (.single m₁) + let D₁ : PreDiagram J κ := + { W := D₀.W ⊔ .ofHoms φ + P := D₀.P + src := by + rintro i j f (hf | ⟨⟨j, hj⟩⟩) + · exact D₀.src hf + · exact Or.inl hj + tgt := by + rintro i j f (hf | ⟨⟨j, hj⟩⟩) + · exact D₀.tgt hf + · exact Or.inr ⟨⟨⟩⟩ + hW := sorry + hP := sorry } + have h₂ {j : J} (hj : D.P j) {f : j ⟶ m₁} (hf : D₁.W f) : + f = φ ⟨_, hj⟩ := by + obtain ((hf | ⟨⟨⟩⟩) | ⟨⟨⟩⟩) := hf + · exact (h₁ (D.tgt hf)).elim + · exact (h₁ hj).elim + · rfl + have h₃ {f : m₁ ⟶ m₁} (hf : D₁.W f) : f = 𝟙 _ := by + obtain ((hf | ⟨⟨⟩⟩) | hf) := hf + · exact (h₁ (D.src hf)).elim + · rfl + · rw [MorphismProperty.ofHoms_iff] at hf + obtain ⟨⟨j, hj⟩, hf⟩ := hf + obtain rfl : m₁ = j := congr_arg Arrow.leftFunc.obj hf + exact (h₁ hj).elim + let hm₁ : D₁.Terminal m₁ := + .ofExistsUnique (Or.inl (Or.inr ⟨⟨⟩⟩)) (by + rintro j (hj | ⟨⟨⟨⟩⟩⟩) + · exact ⟨φ ⟨_, hj⟩, Or.inr ⟨_⟩⟩ + · exact ⟨𝟙 _, Or.inl (Or.inr ⟨⟨⟩⟩)⟩) (by + rintro j (hj | ⟨⟨⟨⟩⟩⟩) l₁ l₂ hl₁ hl₂ + · obtain rfl := h₂ hj hl₁ + obtain rfl := h₂ hj hl₂ + rfl + · rw [h₃ hl₁, h₃ hl₂]) (by + rintro j k f ((hf | ⟨⟨⟩⟩) | ⟨⟨j, hj⟩⟩) + · exact ⟨φ ⟨_, D.src hf⟩, φ ⟨_, D.tgt hf⟩, + Or.inr ⟨_⟩, Or.inr ⟨_⟩, D.terminal.comm_assoc _ hf _⟩ + · exact ⟨𝟙 _, 𝟙 _, Or.inl (Or.inr ⟨⟨⟩⟩), Or.inl (Or.inr ⟨⟨⟩⟩), by simp⟩ + · exact ⟨φ ⟨_, hj⟩, 𝟙 _, Or.inr ⟨_⟩, Or.inl (Or.inr ⟨⟨⟩⟩), by simp⟩) + have lift_eq (j : J) (hj : D.P j) : hm₁.lift (Or.inl hj) = φ ⟨_, hj⟩ := + hm₁.uniq _ (Or.inr ⟨_⟩) + let D₁' : Diagram J κ := + { toPreDiagram := D₁ + e := m₁ + terminal := hm₁ + uniq_terminal j hj := by + obtain (hj' | ⟨⟨⟩⟩) := hj.prop + · exact hm₀.elim (u ≫ hj.lift (Or.inr ⟨⟨⟩⟩) ≫ D.terminal.lift hj') + · rfl} + exact ⟨D₁', homOfLE ⟨le_sup_left.trans le_sup_left, le_sup_left⟩, + by simpa [functorMap, D₁', lift_eq _ D.terminal.prop, φ]⟩ + +lemma aux : + ∃ (α : Type w) (_ : PartialOrder α) (_ : IsCardinalFiltered α κ) + (F : α ⥤ J), F.Final := + ⟨_, _, isCardinalFiltered J κ hJ, functor J κ, final_functor J κ hJ⟩ + +end exists_cardinal_directed lemma exists_cardinal_directed [Fact κ.IsRegular] [IsCardinalFiltered J κ] : ∃ (α : Type w) (_ : PartialOrder α) (_ : IsCardinalFiltered α κ) - (F : α ⥤ J), F.Final := sorry + (F : α ⥤ J), F.Final := by + have := isFiltered_of_isCardinalFiltered κ.ord.toType κ + obtain ⟨α, _, _, F, _⟩ := + exists_cardinal_directed.aux (J × κ.ord.toType) κ (fun ⟨j, x⟩ ↦ + ⟨⟨j, Order.succ x⟩, (𝟙 _, homOfLE (Order.le_succ x)), ⟨fun ⟨_, f⟩ ↦ by + have : NoMaxOrder κ.ord.toType := + Cardinal.noMaxOrder (Cardinal.IsRegular.aleph0_le Fact.out) + exact not_isMax _ (Order.max_of_succ_le (leOfHom f))⟩⟩) + exact ⟨_, _, inferInstance, F ⋙ Prod.fst _ _, inferInstance⟩ end IsCardinalFiltered +lemma IsFiltered.isDirected (α : Type w) [PartialOrder α] [IsFiltered α] : + IsDirected α (· ≤ ·) where + directed i j := ⟨max i j, leOfHom (leftToMax i j), leOfHom (rightToMax i j)⟩ + +attribute [local instance] Cardinal.fact_isRegular_aleph0 in +lemma IsFiltered.exists_directed + (J : Type w) [SmallCategory J] [IsFiltered J] : + ∃ (α : Type w) (_ : PartialOrder α) (_ : IsDirected α (· ≤ ·)) (_ : Nonempty α) + (F : α ⥤ J), F.Final := by + have := (isCardinalFiltered_aleph0_iff.{w} J).2 inferInstance + obtain ⟨α, _, _, F, _⟩ := IsCardinalFiltered.exists_cardinal_directed J .aleph0 + have : IsFiltered α := by rwa [← isCardinalFiltered_aleph0_iff.{w}] + exact ⟨α, _, IsFiltered.isDirected _, nonempty, F, inferInstance⟩ + end CategoryTheory diff --git a/docs/references.bib b/docs/references.bib index 3095a172d18a41..6762fa3bb0d039 100644 --- a/docs/references.bib +++ b/docs/references.bib @@ -4202,6 +4202,22 @@ @Book{ serre1968 mrnumber = {354618} } +@book{sga-4-tome-1, + editor = {Artin, Michael and Grothendieck, Alexander and Verdier, J. L. and Bourbaki, N. and Deligne, P. and Saint-Donat, Bernard}, + title = {S{\'e}minaire de g{\'e}om{\'e}trie alg{\'e}brique du {Bois}-{Marie} 1963--1964. {Th{\'e}orie} des topos et cohomologie {\'e}tale des sch{\'e}mas. ({SGA} 4). {Un} s{\'e}minaire dirig{\'e} par {M}. {Artin}, {A}. {Grothendieck}, {J}. {L}. {Verdier}. {Avec} la collaboration de {N}. {Bourbaki}, {P}. {Deligne}, {B}. {Saint}-{Donat}. {Tome} 1: {Th{\'e}orie} des topos. {Expos{\'e}s} {I} {\`a} {IV}. 2e {\'e}d.}, + fseries = {Lecture Notes in Mathematics}, + series = {Lect. Notes Math.}, + issn = {0075-8434}, + volume = {269}, + year = {1972}, + publisher = {Springer, Cham}, + language = {French}, + doi = {10.1007/BFb0081551}, + keywords = {00B15,14-06}, + zbMATH = {3370272}, + Zbl = {0234.00007} +} + @Book{ silverman2009, author = {Silverman, Joseph}, publisher = {Springer New York, NY}, From be4e3fff1c5b75fe4d4fc63f9cfca922f2890009 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 16 Oct 2025 12:05:05 +0200 Subject: [PATCH 137/309] whitespace --- Mathlib/CategoryTheory/Presentable/Directed.lean | 1 - 1 file changed, 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Presentable/Directed.lean b/Mathlib/CategoryTheory/Presentable/Directed.lean index 1233b43f0868d4..8f060dce32e373 100644 --- a/Mathlib/CategoryTheory/Presentable/Directed.lean +++ b/Mathlib/CategoryTheory/Presentable/Directed.lean @@ -30,7 +30,6 @@ have to be multiplicativebe.) SGA 4 I 8.1.6][sga-4-tome-1] * [Adámek, J. and Rosický, J., *Locally presentable and accessible categories*][Adamek_Rosicky_1994] - -/ universe w From 1b28b7a35e059024d1f81a5a78cc6820998fdab4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 16 Oct 2025 12:06:14 +0200 Subject: [PATCH 138/309] typo --- Mathlib/CategoryTheory/Presentable/Directed.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Presentable/Directed.lean b/Mathlib/CategoryTheory/Presentable/Directed.lean index 8f060dce32e373..9f77a92c77b793 100644 --- a/Mathlib/CategoryTheory/Presentable/Directed.lean +++ b/Mathlib/CategoryTheory/Presentable/Directed.lean @@ -23,7 +23,7 @@ by Adámek and Rosický (theorem 1.5), but with a mistake: the construction by Deligne involves considering diagrams (see `CategoryTheory.IsCardinalFiltered.exists_cardinal_directed.Diagram`) which are not necessarily *subcategories* (the class of morphisms `W` does not -have to be multiplicativebe.) +have to be multiplicative.) ## References * [Alexander Grothendieck and Jean-Louis Verdier, *Exposé I : Préfaisceaux*, From 3356032a13bf3cf73ae827b9b48a4611e1389331 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 16 Oct 2025 14:11:08 +0200 Subject: [PATCH 139/309] wip --- Mathlib/CategoryTheory/Comma/Arrow.lean | 4 + .../MorphismProperty/Basic.lean | 2 + .../CategoryTheory/Presentable/Directed.lean | 166 ++++++++++++++++-- 3 files changed, 159 insertions(+), 13 deletions(-) diff --git a/Mathlib/CategoryTheory/Comma/Arrow.lean b/Mathlib/CategoryTheory/Comma/Arrow.lean index a2f3c8ff964c71..c3628882e84eaf 100644 --- a/Mathlib/CategoryTheory/Comma/Arrow.lean +++ b/Mathlib/CategoryTheory/Comma/Arrow.lean @@ -72,6 +72,10 @@ theorem mk_eq (f : Arrow T) : Arrow.mk f.hom = f := by cases f rfl +lemma mk_surjective (f : Arrow T) : + ∃ (X Y : T) (g : X ⟶ Y), f = Arrow.mk g := + ⟨_, _, f.hom, rfl⟩ + theorem mk_injective (A B : T) : Function.Injective (Arrow.mk : (A ⟶ B) → Arrow T) := fun f g h => by cases h diff --git a/Mathlib/CategoryTheory/MorphismProperty/Basic.lean b/Mathlib/CategoryTheory/MorphismProperty/Basic.lean index 77d45f0447dc20..fc3aff663c7eae 100644 --- a/Mathlib/CategoryTheory/MorphismProperty/Basic.lean +++ b/Mathlib/CategoryTheory/MorphismProperty/Basic.lean @@ -125,6 +125,8 @@ variable (P : MorphismProperty C) /-- The set in `Set (Arrow C)` which corresponds to `P : MorphismProperty C`. -/ def toSet : Set (Arrow C) := setOf (fun f ↦ P f.hom) +lemma mem_toSet_iff (f : Arrow C) : f ∈ P.toSet ↔ P f.hom := Iff.rfl + /-- The family of morphisms indexed by `P.toSet` which corresponds to `P : MorphismProperty C`, see `MorphismProperty.ofHoms_homFamily`. -/ def homFamily (f : P.toSet) : f.1.left ⟶ f.1.right := f.1.hom diff --git a/Mathlib/CategoryTheory/Presentable/Directed.lean b/Mathlib/CategoryTheory/Presentable/Directed.lean index 9f77a92c77b793..fc3f08cc0a7ad2 100644 --- a/Mathlib/CategoryTheory/Presentable/Directed.lean +++ b/Mathlib/CategoryTheory/Presentable/Directed.lean @@ -34,6 +34,16 @@ have to be multiplicative.) universe w +lemma CategoryTheory.MorphismProperty.toSet_iSup {C : Type*} [Category C] + {ι : Type*} (W : ι → MorphismProperty C) : + (⨆ i , W i).toSet = ⋃ i, (W i).toSet := by + ext + simp [MorphismProperty.toSet] + +lemma CategoryTheory.MorphismProperty.toSet_max {C : Type*} [Category C] + (W₁ W₂ : MorphismProperty C) : + (W₁ ⊔ W₂).toSet = W₁.toSet ∪ W₂.toSet := rfl + lemma hasCardinalLT_of_finite (X : Type*) [Finite X] (κ : Cardinal) (hκ : Cardinal.aleph0 ≤ κ) : HasCardinalLT X κ := @@ -43,6 +53,105 @@ lemma hasCardinalLT_punit (κ : Cardinal) (hκ : Cardinal.aleph0 ≤ κ) : HasCardinalLT PUnit κ := hasCardinalLT_of_finite _ _ hκ +lemma hasCardinalLT_sigma {ι : Type*} (α : ι → Type*) (κ : Cardinal) [Fact κ.IsRegular] + (hι : HasCardinalLT ι κ) (hα : ∀ i, HasCardinalLT (α i) κ) : + HasCardinalLT (Σ i, α i) κ := sorry + +lemma hasCardinalLT_subtype_iSup + {ι : Type*} {X : Type*} (P : ι → X → Prop) {κ : Cardinal} [Fact κ.IsRegular] + (hι : HasCardinalLT ι κ) (hP : ∀ i, HasCardinalLT (Subtype (P i)) κ) : + HasCardinalLT (Subtype (⨆ i, P i)) κ := + (hasCardinalLT_sigma (fun i ↦ Subtype (P i)) κ hι hP).of_surjective + (fun ⟨i, x, hx⟩ ↦ ⟨x, by simp only [iSup_apply, iSup_Prop_eq]; exact ⟨i, hx⟩⟩) (by + rintro ⟨_, h⟩ + simp only [iSup_apply, iSup_Prop_eq] at h + obtain ⟨i, hi⟩ := h + exact ⟨⟨i, _, hi⟩, rfl⟩) + +lemma hasCardinalLT_iUnion + {ι : Type*} {X : Type*} (S : ι → Set X) {κ : Cardinal} [Fact κ.IsRegular] + (hι : HasCardinalLT ι κ) (hS : ∀ i, HasCardinalLT (S i) κ) : + HasCardinalLT (⋃ i, S i) κ := by + convert hasCardinalLT_subtype_iSup S hι hS using 2 + ext x + change _ ↔ ((⨆ i, S i) : X → Prop ) x + aesop + +lemma hasCardinalLT_subtype_max + {X : Type*} {P₁ P₂ : X → Prop} {κ : Cardinal} (hκ : Cardinal.aleph0 ≤ κ) + (h₁ : HasCardinalLT (Subtype P₁) κ) (h₂ : HasCardinalLT (Subtype P₂) κ) : + HasCardinalLT (Subtype (P₁ ⊔ P₂)) κ := by + have : HasCardinalLT (Subtype P₁ ⊕ Subtype P₂) κ := by + rw [hasCardinalLT_sum_iff _ _ _ hκ] + exact ⟨h₁, h₂⟩ + refine this.of_surjective (Sum.elim (fun x ↦ ⟨x.1, Or.inl x.2⟩) + (fun x ↦ ⟨x.1, Or.inr x.2⟩)) ?_ + rintro ⟨x, hx | hx⟩ + · exact ⟨Sum.inl ⟨x, hx⟩, rfl⟩ + · exact ⟨Sum.inr ⟨x, hx⟩, rfl⟩ + +lemma hasCardinalLT_union + {X : Type*} {S₁ S₂ : Set X} {κ : Cardinal} [Fact κ.IsRegular] + (h₁ : HasCardinalLT S₁ κ) (h₂ : HasCardinalLT S₂ κ) : + HasCardinalLT (S₁ ∪ S₂ : Set _) κ := + hasCardinalLT_subtype_max (Cardinal.IsRegular.aleph0_le Fact.out) h₁ h₂ + +lemma hasCardinalLT_prod {T₁ T₂ : Type*} {κ : Cardinal} [Fact κ.IsRegular] + (h₁ : HasCardinalLT T₁ κ) (h₂ : HasCardinalLT T₂ κ) : + HasCardinalLT (T₁ × T₂) κ := + (hasCardinalLT_sigma (fun (t : T₁) ↦ T₂) κ h₁ (fun _ ↦ h₂)).of_surjective + (fun ⟨t₁, t₂⟩ ↦ (t₁, t₂)) (by rintro ⟨t₁, t₂⟩; exact ⟨⟨t₁, t₂⟩, rfl⟩) + +section + +open CategoryTheory Limits + +lemma hasCardinalLT_toSet_morphismPropertyOfHoms {C : Type*} [Category C] + {ι : Type*} {X Y : ι → C} (f : ∀ i, X i ⟶ Y i) + {κ : Cardinal} + (h : HasCardinalLT ι κ) : HasCardinalLT (MorphismProperty.ofHoms f).toSet κ := + h.of_surjective (fun i ↦ ⟨Arrow.mk (f i), ⟨i⟩⟩) (by + rintro ⟨f, hf⟩ + rw [MorphismProperty.mem_toSet_iff, MorphismProperty.ofHoms_iff] at hf + obtain ⟨i, hf⟩ := hf + obtain rfl : f = _ := hf + exact ⟨i, rfl⟩) + +lemma hasCardinalLT_subtype_objectPropertyOfObj {C : Type*} [Category C] + {ι : Type*} (X : ι → C) {κ : Cardinal} + (h : HasCardinalLT ι κ) : HasCardinalLT (Subtype (ObjectProperty.ofObj X)) κ := + h.of_surjective (fun i ↦ ⟨X i, by simp⟩) (by rintro ⟨_, ⟨i⟩⟩; exact ⟨i, rfl⟩) + +lemma hasCardinalLT_arrow_walkingMultispan {h : MultispanShape} {κ : Cardinal} + [Fact κ.IsRegular] + (h₁ : HasCardinalLT h.L κ) (h₂ : HasCardinalLT h.R κ) : + HasCardinalLT (Arrow (WalkingMultispan h)) κ := by + let T := WalkingMultispan h ⊕ h.L ⊕ h.L + have hT₀ : HasCardinalLT (WalkingMultispan h) κ := by + have : HasCardinalLT (h.L ⊕ h.R) κ := by + rw [hasCardinalLT_sum_iff _ _ _ (Cardinal.IsRegular.aleph0_le Fact.out)] + exact ⟨h₁, h₂⟩ + refine this.of_surjective (Sum.elim WalkingMultispan.left WalkingMultispan.right) ?_ + rintro (x | y) + · exact ⟨Sum.inl x, rfl⟩ + · exact ⟨Sum.inr y, rfl⟩ + have hT : HasCardinalLT T κ := by + rw [hasCardinalLT_sum_iff _ _ _ (Cardinal.IsRegular.aleph0_le Fact.out), + hasCardinalLT_sum_iff _ _ _ (Cardinal.IsRegular.aleph0_le Fact.out)] + exact ⟨hT₀, h₁, h₁⟩ + refine hT.of_surjective (fun t ↦ match t with + | Sum.inl x => Arrow.mk (𝟙 x) + | Sum.inr (Sum.inl z) => Arrow.mk (WalkingMultispan.Hom.fst z) + | Sum.inr (Sum.inr z) => Arrow.mk (WalkingMultispan.Hom.snd z)) ?_ + intro f + obtain ⟨x, y, f, rfl⟩ := f.mk_surjective + obtain (_ | z | z) := f + · exact ⟨Sum.inl x, rfl⟩ + · exact ⟨Sum.inr (Sum.inl z), rfl⟩ + · exact ⟨Sum.inr (Sum.inr z), rfl⟩ + +end + namespace CategoryTheory open Limits @@ -196,7 +305,7 @@ def PreDiagram.single (j : J) : PreDiagram J κ where tgt := by rintro _ _ _ ⟨⟩; exact ⟨⟨⟩⟩ hW := (hasCardinalLT_punit κ (Cardinal.IsRegular.aleph0_le Fact.out)).of_surjective - (f := fun (_ : Unit) ↦ ⟨Arrow.mk (𝟙 j), ⟨⟨⟩⟩⟩) (by + (fun (_ : Unit) ↦ ⟨Arrow.mk (𝟙 j), ⟨⟨⟩⟩⟩) (by rintro ⟨f, hf⟩ refine ⟨⟨⟩, ?_⟩ ext @@ -204,7 +313,11 @@ def PreDiagram.single (j : J) : PreDiagram J κ where ((MorphismProperty.arrow_mk_mem_toSet_iff _ _).1 hf)).choose_spec.symm) hP := (hasCardinalLT_punit κ (Cardinal.IsRegular.aleph0_le Fact.out)).of_surjective - (f := fun (_ : Unit) ↦ ⟨j, by simp⟩) (fun ⟨k, hk⟩ ↦ ⟨⟨⟩, by aesop⟩) + (fun (_ : Unit) ↦ ⟨j, by simp⟩) (fun ⟨k, hk⟩ ↦ ⟨⟨⟩, by aesop⟩) + +instance (j : J) : Finite (Subtype (PreDiagram.single (κ := κ) j).P) := + Finite.of_surjective (fun (_ : Unit) ↦ ⟨j, by simp⟩) + (by rintro ⟨_, ⟨⟩⟩; exact ⟨⟨⟩, rfl⟩) variable {J κ} in def Diagram.single (j : J) : Diagram J κ where @@ -233,10 +346,9 @@ def PreDiagram.iSup {ι : Type*} (D : ι → PreDiagram J κ) (hι : HasCardinal obtain ⟨i, hi⟩ := hf exact ⟨i, (D i).tgt hi⟩ hW := by - sorry - hP := by - rw [hasCardinalLT_iff_cardinal_mk_lt] - sorry + rw [MorphismProperty.toSet_iSup] + exact hasCardinalLT_iUnion _ hι (fun i ↦ (D i).hW) + hP := hasCardinalLT_subtype_iSup _ hι (fun i ↦ (D i).hP) variable {J κ} in @[simps] @@ -252,8 +364,8 @@ def PreDiagram.max (D₁ D₂ : PreDiagram J κ) : rintro _ _ _ (h | h) · exact Or.inl (D₁.tgt h) · exact Or.inr (D₂.tgt h) - hW := sorry - hP := sorry + hW := hasCardinalLT_union D₁.hW D₂.hW + hP := hasCardinalLT_union D₁.hP D₂.hP variable [IsCardinalFiltered J κ] (hJ : ∀ (e : J), ∃ (m : J) (_ : e ⟶ m), IsEmpty (m ⟶ e)) @@ -281,7 +393,20 @@ lemma isCardinalFiltered : IsCardinalFiltered (Diagram J κ) κ := right _ := m₁ fst x := (D x.1.1).terminal.lift x.2.1 ≫ u x.1.1 snd x := (D x.1.2.1).terminal.lift x.2.2 ≫ u x.1.2.1 } - have hshape : HasCardinalLT (Arrow (WalkingMultispan shape)) κ := sorry + have hshape : HasCardinalLT (Arrow (WalkingMultispan shape)) κ := by + refine hasCardinalLT_arrow_walkingMultispan ?_ + (hasCardinalLT_of_finite _ _ (Cardinal.IsRegular.aleph0_le Fact.out)) + let T := Σ (i : ι), Subtype (D i).P + have hT : HasCardinalLT (ι × T) κ := + hasCardinalLT_prod hι (hasCardinalLT_sigma _ _ hι (fun i ↦ (D i).hP)) + refine hT.of_injective (fun ⟨⟨i₁, i₂, j⟩, h₁, h₂⟩ ↦ ⟨i₁, i₂, ⟨j, h₂⟩⟩) ?_ + rintro ⟨⟨i₁, i₂, j⟩, _, _⟩ ⟨⟨i₁', i₂', j'⟩, _, _⟩ h + rw [Prod.ext_iff, Sigma.ext_iff] at h + dsimp at h + obtain rfl : i₁ = i₁' := h.1 + obtain rfl : i₂ = i₂' := h.2.1 + obtain rfl : j = j' := by simpa using h + rfl let c : Multicofork _ := IsCardinalFiltered.cocone index.multispan hshape exact ⟨c.pt, c.π ⟨⟩, fun i₁ i₂ j h₁ h₂ ↦ by simpa [index, shape] using c.condition ⟨⟨i₁, i₂, j⟩, h₁, h₂⟩⟩ @@ -310,8 +435,15 @@ lemma isCardinalFiltered : IsCardinalFiltered (Diagram J κ) κ := exact Or.inl ⟨i, (D i).tgt hf⟩ · exact Or.inr rfl · exact Or.inr rfl - hW := sorry - hP := sorry } + hW := by + rw [MorphismProperty.toSet_max] + exact hasCardinalLT_union D₁.hW + (hasCardinalLT_toSet_morphismPropertyOfHoms _ + (hasCardinalLT_sigma _ _ hι (fun i ↦ (D i).hP))) + hP := hasCardinalLT_subtype_max (Cardinal.IsRegular.aleph0_le Fact.out) + (hasCardinalLT_subtype_iSup _ hι (fun i ↦ (D i).hP)) + (hasCardinalLT_of_finite _ _ (Cardinal.IsRegular.aleph0_le Fact.out)) + } have hD₂ {f : m₂ ⟶ m₂} (hf : D₂.W f) : f = 𝟙 _ := by simp [D₂, D₁, D₀] at hf obtain ((hf | ⟨⟨⟩⟩) | hf) := hf @@ -394,8 +526,16 @@ lemma final_functor : (functor J κ).Final := by rintro i j f (hf | ⟨⟨j, hj⟩⟩) · exact D₀.tgt hf · exact Or.inr ⟨⟨⟩⟩ - hW := sorry - hP := sorry } + hW := + hasCardinalLT_union + (hasCardinalLT_union D.hW + (hasCardinalLT_toSet_morphismPropertyOfHoms _ + (hasCardinalLT_of_finite _ _ (Cardinal.IsRegular.aleph0_le Fact.out)))) + (hasCardinalLT_toSet_morphismPropertyOfHoms _ D.hP) + hP := + hasCardinalLT_union D.hP + (hasCardinalLT_subtype_objectPropertyOfObj _ + ((hasCardinalLT_of_finite _ _ (Cardinal.IsRegular.aleph0_le Fact.out)))) } have h₂ {j : J} (hj : D.P j) {f : j ⟶ m₁} (hf : D₁.W f) : f = φ ⟨_, hj⟩ := by obtain ((hf | ⟨⟨⟩⟩) | ⟨⟨⟩⟩) := hf From d02c37f5fb74b0285dbc589f307c86c23213cb9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 16 Oct 2025 15:01:58 +0200 Subject: [PATCH 140/309] wip --- .../CategoryTheory/Presentable/Directed.lean | 62 ++++++++++++++++++- 1 file changed, 59 insertions(+), 3 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/Directed.lean b/Mathlib/CategoryTheory/Presentable/Directed.lean index fc3f08cc0a7ad2..929684ce79411e 100644 --- a/Mathlib/CategoryTheory/Presentable/Directed.lean +++ b/Mathlib/CategoryTheory/Presentable/Directed.lean @@ -8,6 +8,7 @@ import Mathlib.CategoryTheory.Limits.Final import Mathlib.CategoryTheory.MorphismProperty.Basic import Mathlib.CategoryTheory.Filtered.Final import Mathlib.CategoryTheory.Products.Unitor +import Mathlib.Data.Finite.Sigma /-! # `κ`-filtered categories and `κ`-directed poset @@ -32,7 +33,7 @@ have to be multiplicative.) -/ -universe w +universe u v w lemma CategoryTheory.MorphismProperty.toSet_iSup {C : Type*} [Category C] {ι : Type*} (W : ι → MorphismProperty C) : @@ -53,9 +54,64 @@ lemma hasCardinalLT_punit (κ : Cardinal) (hκ : Cardinal.aleph0 ≤ κ) : HasCardinalLT PUnit κ := hasCardinalLT_of_finite _ _ hκ -lemma hasCardinalLT_sigma {ι : Type*} (α : ι → Type*) (κ : Cardinal) [Fact κ.IsRegular] +lemma Cardinal.mk_surjective : + Function.Surjective (Cardinal.mk : Type w → Cardinal) := by + rintro ⟨_⟩; exact ⟨_, rfl⟩ + +lemma hasCardinalLT_sigma' {ι : Type w} (α : ι → Type w) (κ : Cardinal.{w}) [Fact κ.IsRegular] + (hι : HasCardinalLT ι κ) (hα : ∀ i, HasCardinalLT (α i) κ) : + HasCardinalLT (Σ i, α i) κ := by + have hκ : Cardinal.aleph0 ≤ κ := Cardinal.IsRegular.aleph0_le Fact.out + obtain hκ | rfl := hκ.lt_or_eq + · obtain ⟨κ₀, h₁, h₂, h₃, h₄⟩ : ∃ (κ₀ : Cardinal), Cardinal.aleph0 ≤ κ₀ ∧ κ₀ < κ ∧ + Cardinal.mk ι ≤ κ₀ ∧ ∀ i, Cardinal.mk (α i) ≤ κ₀ := sorry + obtain ⟨X, rfl⟩ := κ₀.mk_surjective + rw [hasCardinalLT_iff_cardinal_mk_lt] + obtain ⟨φ⟩ := h₃ + let ψ (i : ι) : α i ↪ X := (h₄ i).some + refine lt_of_le_of_lt ?_ h₂ + trans Cardinal.mk (X × X) + · refine ⟨⟨fun ⟨i, a⟩ ↦ ⟨φ i, ψ i a⟩, fun ⟨i, a⟩ ⟨j, b⟩ h ↦ ?_⟩⟩ + rw [Prod.ext_iff] at h + obtain rfl : i = j := φ.injective h.1 + obtain rfl : a = b := (ψ i).injective h.2 + rfl + · rw [← Cardinal.mul_def] + exact (Cardinal.mul_le_max_of_aleph0_le_left h₁).trans (by simp) + · simp only [hasCardinalLT_aleph0_iff] at hι hα ⊢ + infer_instance + +@[simp] +lemma hasCardinalLT_lift_iff (X : Type v) (κ : Cardinal.{w}) : + HasCardinalLT X (Cardinal.lift.{u} κ) ↔ HasCardinalLT X κ := by + simp [HasCardinalLT, ← (Cardinal.lift_strictMono.{max v w, max u}).lt_iff_lt] + +@[simp] +lemma hasCardinalLT_ulift_iff (X : Type v) (κ : Cardinal.{w}) : + HasCardinalLT (ULift.{u} X) κ ↔ HasCardinalLT X κ := + hasCardinalLT_iff_of_equiv Equiv.ulift κ + +lemma Cardinal.IsRegular.lift {κ : Cardinal.{w}} (hκ : κ.IsRegular) : + (Cardinal.lift.{u} κ).IsRegular := by + obtain ⟨h₁, h₂⟩ := hκ + constructor + · simpa + · rwa [← Cardinal.lift_ord, ← Ordinal.lift_cof, lift_le] + +lemma hasCardinalLT_sigma {ι : Type u} (α : ι → Type v) (κ : Cardinal.{w}) [Fact κ.IsRegular] (hι : HasCardinalLT ι κ) (hα : ∀ i, HasCardinalLT (α i) κ) : - HasCardinalLT (Σ i, α i) κ := sorry + HasCardinalLT (Σ i, α i) κ := by + let ι' : Type max u v w := ULift.{max v w} ι + let α' (i : ι') : Type max u v w := ULift.{max u w} (α (ULift.down i)) + let κ' : Cardinal.{max u v w} := Cardinal.lift.{max u v} κ + have : Fact κ'.IsRegular := ⟨Cardinal.IsRegular.lift Fact.out⟩ + have := hasCardinalLT_sigma' α' κ' + (by rwa [hasCardinalLT_lift_iff, hasCardinalLT_ulift_iff]) (fun i ↦ by + rw [hasCardinalLT_lift_iff, hasCardinalLT_ulift_iff] + exact hα _) + rw [hasCardinalLT_lift_iff] at this + exact this.of_surjective (fun ⟨i, a⟩ ↦ ⟨ULift.down i, ULift.down a⟩) + (fun ⟨i, a⟩ ↦ ⟨⟨ULift.up i, ULift.up a⟩, rfl⟩) lemma hasCardinalLT_subtype_iSup {ι : Type*} {X : Type*} (P : ι → X → Prop) {κ : Cardinal} [Fact κ.IsRegular] From c2dc61c261da90f3d110c8267d403a9f7a59560a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 16 Oct 2025 15:35:29 +0200 Subject: [PATCH 141/309] wip --- .../CategoryTheory/Presentable/Directed.lean | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Presentable/Directed.lean b/Mathlib/CategoryTheory/Presentable/Directed.lean index 929684ce79411e..fa01f1cd03a511 100644 --- a/Mathlib/CategoryTheory/Presentable/Directed.lean +++ b/Mathlib/CategoryTheory/Presentable/Directed.lean @@ -58,13 +58,29 @@ lemma Cardinal.mk_surjective : Function.Surjective (Cardinal.mk : Type w → Cardinal) := by rintro ⟨_⟩; exact ⟨_, rfl⟩ +lemma Cardinal.IsRegular.exists_upper_bound (κ : Cardinal.{w}) [Fact κ.IsRegular] + {ι : Type*} (c : ι → Cardinal.{w}) (hc : ∀ i, c i < κ) (hι : HasCardinalLT ι κ) : + ∃ (κ₀ : Cardinal.{w}), κ₀ < κ ∧ ∀ i, c i ≤ κ₀ := sorry + lemma hasCardinalLT_sigma' {ι : Type w} (α : ι → Type w) (κ : Cardinal.{w}) [Fact κ.IsRegular] (hι : HasCardinalLT ι κ) (hα : ∀ i, HasCardinalLT (α i) κ) : HasCardinalLT (Σ i, α i) κ := by have hκ : Cardinal.aleph0 ≤ κ := Cardinal.IsRegular.aleph0_le Fact.out obtain hκ | rfl := hκ.lt_or_eq · obtain ⟨κ₀, h₁, h₂, h₃, h₄⟩ : ∃ (κ₀ : Cardinal), Cardinal.aleph0 ≤ κ₀ ∧ κ₀ < κ ∧ - Cardinal.mk ι ≤ κ₀ ∧ ∀ i, Cardinal.mk (α i) ≤ κ₀ := sorry + Cardinal.mk ι ≤ κ₀ ∧ ∀ i, Cardinal.mk (α i) ≤ κ₀ := by + obtain ⟨κ₀, h₁, h₂⟩ := + Cardinal.IsRegular.exists_upper_bound κ + (fun (i : Option ι) ↦ match i with + | none => max Cardinal.aleph0 (Cardinal.mk ι) + | some i => Cardinal.mk (α i)) (by + rintro (_ | i) + · simp only [sup_lt_iff, ← hasCardinalLT_iff_cardinal_mk_lt] + exact ⟨hκ, hι⟩ + · exact (hasCardinalLT_iff_cardinal_mk_lt _ _).1 (hα i)) + (by rwa [hasCardinalLT_option_iff _ _ hκ.le]) + exact ⟨κ₀, (le_max_left _ _).trans (h₂ .none), h₁, + (le_max_right _ _).trans (h₂ .none), fun i ↦ h₂ (.some i)⟩ obtain ⟨X, rfl⟩ := κ₀.mk_surjective rw [hasCardinalLT_iff_cardinal_mk_lt] obtain ⟨φ⟩ := h₃ From 34775f40be22bfb14ac189b97270329c36b0c9ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 16 Oct 2025 16:43:47 +0200 Subject: [PATCH 142/309] sorry free --- .../CategoryTheory/Presentable/Directed.lean | 32 +++++++++++++++---- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/Directed.lean b/Mathlib/CategoryTheory/Presentable/Directed.lean index fa01f1cd03a511..521717d7d9f2dd 100644 --- a/Mathlib/CategoryTheory/Presentable/Directed.lean +++ b/Mathlib/CategoryTheory/Presentable/Directed.lean @@ -58,9 +58,28 @@ lemma Cardinal.mk_surjective : Function.Surjective (Cardinal.mk : Type w → Cardinal) := by rintro ⟨_⟩; exact ⟨_, rfl⟩ -lemma Cardinal.IsRegular.exists_upper_bound (κ : Cardinal.{w}) [Fact κ.IsRegular] - {ι : Type*} (c : ι → Cardinal.{w}) (hc : ∀ i, c i < κ) (hι : HasCardinalLT ι κ) : - ∃ (κ₀ : Cardinal.{w}), κ₀ < κ ∧ ∀ i, c i ≤ κ₀ := sorry + +variable (κ : Cardinal.{w}) [Fact κ.IsRegular] + +open CategoryTheory in +lemma Cardinal.IsRegular.exists_upper_bound {κ : Cardinal.{w}} (hκ : κ.IsRegular) + {ι : Type w} (c : ι → Cardinal.{w}) (hc : ∀ i, c i < κ) (hι : Cardinal.mk ι < κ) : + ∃ (κ₀ : Cardinal.{w}), κ₀ < κ ∧ ∀ i, c i ≤ κ₀ := by + have : Fact κ.IsRegular := ⟨hκ⟩ + have : IsCardinalFiltered κ.ord.toType κ := inferInstance + let f (i : ι) : κ.ord.toType := + Ordinal.enumIsoToType _ ⟨(c i).ord, by simpa using hc i⟩ + rw [← hasCardinalLT_iff_cardinal_mk_lt] at hι + let m := IsCardinalFiltered.max f hι + have hm (i : ι) : f i ≤ m := leOfHom (IsCardinalFiltered.toMax f hι i) + have h (j : κ.ord.toType) : -- should be made a lemma? + ((Ordinal.enumIsoToType _).symm j).1.card < κ := by + obtain ⟨⟨a, ha⟩, rfl⟩ := κ.ord.enumIsoToType.surjective j + simpa only [OrderIso.symm_apply_apply, ← lt_ord, Set.mem_Iio] using ha + refine ⟨Cardinal.mk ((Ordinal.enumIsoToType _).symm m).1.toType, by simpa using h m, fun i ↦ ?_⟩ + rw [mk_toType] + exact le_trans (by simp [f]) (Ordinal.card_le_card + (Subtype.mono_coe _ (κ.ord.enumIsoToType.symm.monotone (hm i)))) lemma hasCardinalLT_sigma' {ι : Type w} (α : ι → Type w) (κ : Cardinal.{w}) [Fact κ.IsRegular] (hι : HasCardinalLT ι κ) (hα : ∀ i, HasCardinalLT (α i) κ) : @@ -70,15 +89,16 @@ lemma hasCardinalLT_sigma' {ι : Type w} (α : ι → Type w) (κ : Cardinal.{w} · obtain ⟨κ₀, h₁, h₂, h₃, h₄⟩ : ∃ (κ₀ : Cardinal), Cardinal.aleph0 ≤ κ₀ ∧ κ₀ < κ ∧ Cardinal.mk ι ≤ κ₀ ∧ ∀ i, Cardinal.mk (α i) ≤ κ₀ := by obtain ⟨κ₀, h₁, h₂⟩ := - Cardinal.IsRegular.exists_upper_bound κ + Cardinal.IsRegular.exists_upper_bound (κ := κ) Fact.out (fun (i : Option ι) ↦ match i with | none => max Cardinal.aleph0 (Cardinal.mk ι) | some i => Cardinal.mk (α i)) (by rintro (_ | i) · simp only [sup_lt_iff, ← hasCardinalLT_iff_cardinal_mk_lt] exact ⟨hκ, hι⟩ - · exact (hasCardinalLT_iff_cardinal_mk_lt _ _).1 (hα i)) - (by rwa [hasCardinalLT_option_iff _ _ hκ.le]) + · exact (hasCardinalLT_iff_cardinal_mk_lt _ _).1 (hα i)) (by + rwa [← hasCardinalLT_iff_cardinal_mk_lt, + hasCardinalLT_option_iff _ _ hκ.le]) exact ⟨κ₀, (le_max_left _ _).trans (h₂ .none), h₁, (le_max_right _ _).trans (h₂ .none), fun i ↦ h₂ (.some i)⟩ obtain ⟨X, rfl⟩ := κ₀.mk_surjective From a721f3c839ae9888f05e68bc8cf842dde039c497 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 16 Oct 2025 16:47:59 +0200 Subject: [PATCH 143/309] wip --- Mathlib/CategoryTheory/Presentable/Directed.lean | 1 - 1 file changed, 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Presentable/Directed.lean b/Mathlib/CategoryTheory/Presentable/Directed.lean index 521717d7d9f2dd..a86d3f164c2ad6 100644 --- a/Mathlib/CategoryTheory/Presentable/Directed.lean +++ b/Mathlib/CategoryTheory/Presentable/Directed.lean @@ -66,7 +66,6 @@ lemma Cardinal.IsRegular.exists_upper_bound {κ : Cardinal.{w}} (hκ : κ.IsRegu {ι : Type w} (c : ι → Cardinal.{w}) (hc : ∀ i, c i < κ) (hι : Cardinal.mk ι < κ) : ∃ (κ₀ : Cardinal.{w}), κ₀ < κ ∧ ∀ i, c i ≤ κ₀ := by have : Fact κ.IsRegular := ⟨hκ⟩ - have : IsCardinalFiltered κ.ord.toType κ := inferInstance let f (i : ι) : κ.ord.toType := Ordinal.enumIsoToType _ ⟨(c i).ord, by simpa using hc i⟩ rw [← hasCardinalLT_iff_cardinal_mk_lt] at hι 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 144/309] 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 84436aea7b9547d19a7a21b75bf96dcb282d3288 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 16 Oct 2025 19:15:41 +0200 Subject: [PATCH 145/309] fixed references.bib --- docs/references.bib | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/docs/references.bib b/docs/references.bib index 6762fa3bb0d039..1717ce708543e9 100644 --- a/docs/references.bib +++ b/docs/references.bib @@ -4202,9 +4202,18 @@ @Book{ serre1968 mrnumber = {354618} } -@book{sga-4-tome-1, - editor = {Artin, Michael and Grothendieck, Alexander and Verdier, J. L. and Bourbaki, N. and Deligne, P. and Saint-Donat, Bernard}, - title = {S{\'e}minaire de g{\'e}om{\'e}trie alg{\'e}brique du {Bois}-{Marie} 1963--1964. {Th{\'e}orie} des topos et cohomologie {\'e}tale des sch{\'e}mas. ({SGA} 4). {Un} s{\'e}minaire dirig{\'e} par {M}. {Artin}, {A}. {Grothendieck}, {J}. {L}. {Verdier}. {Avec} la collaboration de {N}. {Bourbaki}, {P}. {Deligne}, {B}. {Saint}-{Donat}. {Tome} 1: {Th{\'e}orie} des topos. {Expos{\'e}s} {I} {\`a} {IV}. 2e {\'e}d.}, +@Book{ sga-4-tome-1, + editor = {Artin, Michael and Grothendieck, Alexander and Verdier, J. + L. and Bourbaki, N. and Deligne, P. and Saint-Donat, + Bernard}, + title = {S{\'e}minaire de g{\'e}om{\'e}trie alg{\'e}brique du + {Bois}-{Marie} 1963--1964. {Th{\'e}orie} des topos et + cohomologie {\'e}tale des sch{\'e}mas. ({SGA} 4). {Un} + s{\'e}minaire dirig{\'e} par {M}. {Artin}, {A}. + {Grothendieck}, {J}. {L}. {Verdier}. {Avec} la + collaboration de {N}. {Bourbaki}, {P}. {Deligne}, {B}. + {Saint}-{Donat}. {Tome} 1: {Th{\'e}orie} des topos. + {Expos{\'e}s} {I} {\`a} {IV}. 2e {\'e}d.}, fseries = {Lecture Notes in Mathematics}, series = {Lect. Notes Math.}, issn = {0075-8434}, From 72af181b2ecea2815258ad32ec892a918dbfe880 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 16 Oct 2025 20:53:05 +0200 Subject: [PATCH 146/309] cleaning up --- .../CategoryTheory/Presentable/Directed.lean | 289 ++++++++++-------- 1 file changed, 167 insertions(+), 122 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/Directed.lean b/Mathlib/CategoryTheory/Presentable/Directed.lean index a86d3f164c2ad6..936cfb7d018b64 100644 --- a/Mathlib/CategoryTheory/Presentable/Directed.lean +++ b/Mathlib/CategoryTheory/Presentable/Directed.lean @@ -22,7 +22,7 @@ The construction applies more generally to `κ`-filtered categories and Note: the argument by Deligne is reproduced (without reference) in the book by Adámek and Rosický (theorem 1.5), but with a mistake: the construction by Deligne involves considering diagrams -(see `CategoryTheory.IsCardinalFiltered.exists_cardinal_directed.Diagram`) +(see `CategoryTheory.IsCardinalFiltered.exists_cardinal_directed.DiagramWithTerminal`) which are not necessarily *subcategories* (the class of morphisms `W` does not have to be multiplicative.) @@ -58,9 +58,6 @@ lemma Cardinal.mk_surjective : Function.Surjective (Cardinal.mk : Type w → Cardinal) := by rintro ⟨_⟩; exact ⟨_, rfl⟩ - -variable (κ : Cardinal.{w}) [Fact κ.IsRegular] - open CategoryTheory in lemma Cardinal.IsRegular.exists_upper_bound {κ : Cardinal.{w}} (hκ : κ.IsRegular) {ι : Type w} (c : ι → Cardinal.{w}) (hc : ∀ i, c i < κ) (hι : Cardinal.mk ι < κ) : @@ -276,42 +273,60 @@ instance prod (J₁ J₂ : Type*) [Category J₁] [Category J₂] · simpa using c₁.w f · simpa using c₂.w f}⟩ +namespace exists_cardinal_directed + variable (J : Type w) [SmallCategory J] (κ : Cardinal.{w}) -namespace exists_cardinal_directed +/-! +Let `J` is a `κ`-filtered category. In order to construct a cofinal functor `α ⥤ J` +with a `κ`-directed poset `α`, we first consider the case where there is no +object `m : J` such that for any object `j : J`, there exists a map `j ⟶ m`. +Under this assumption (`hJ`), the partially ordered type `DiagramWithTerminal J κ` +of `κ`-bounded diagrams with a terminal object in `J` shall be a possible +choice for `α`. +-/ +/-- If `κ` is a cardinal, this structure contains the data of a `κ`-bounded diagram +in a category `J`. -/ @[ext] -structure PreDiagram where +structure Diagram where + /-- the morphisms which belongs to the diagram -/ W : MorphismProperty J + /-- the objects in the diagram -/ P : ObjectProperty J src {i j : J} {f : i ⟶ j} : W f → P i tgt {i j : J} {f : i ⟶ j} : W f → P j hW : HasCardinalLT W.toSet κ hP : HasCardinalLT (Subtype P) κ -namespace PreDiagram +namespace Diagram variable {J κ} -structure Terminal (D : PreDiagram J κ) (e : J) where +/-- Given a `κ`-bounded diagram `D` in a category `J`, an object `e : J` +is terminal if for any object `j` of `D`, there is a unique morphism `j ⟶ e` in `D`, +that these unique morphisms are compatible with precomposition with morphims in `D`, +and that `𝟙 e` belongs to `D`. -/ +structure IsTerminal (D : Diagram J κ) (e : J) where prop_id : D.W (𝟙 e) + /-- the unique map to the terminal object in the diagram -/ lift {j : J} (hj : D.P j) : j ⟶ e hlift {j : J} (hj : D.P j) : D.W (lift hj) uniq {j : J} (hj : D.P j) {φ : j ⟶ e} (hφ : D.W φ) : lift hj = φ comm {i j : J} (f : i ⟶ j) (hf : D.W f) : f ≫ lift (D.tgt hf) = lift (D.src hf) -namespace Terminal +namespace IsTerminal -attribute [reassoc] Terminal.comm +attribute [reassoc] IsTerminal.comm -variable {D : PreDiagram J κ} {e : J} +variable {D : Diagram J κ} {e : J} -lemma prop (h : D.Terminal e) : D.P e := D.src (h.prop_id) +lemma prop (h : D.IsTerminal e) : D.P e := D.src (h.prop_id) @[simp] -lemma lift_self (h : D.Terminal e) : h.lift h.prop = 𝟙 e := h.uniq _ h.prop_id +lemma lift_self (h : D.IsTerminal e) : h.lift h.prop = 𝟙 e := h.uniq _ h.prop_id -instance : Subsingleton (D.Terminal e) where +instance : Subsingleton (D.IsTerminal e) where allEq h₁ h₂ := by have : @h₁.lift = @h₂.lift := by ext j hj @@ -320,12 +335,14 @@ instance : Subsingleton (D.Terminal e) where cases h₂ aesop +/-- Constructor for `Diagram.IsTerminal` for which no data is provided, +but only its existence. -/ noncomputable def ofExistsUnique (prop_id : D.W (𝟙 e)) (h₁ : ∀ ⦃j : J⦄ (_ : D.P j), ∃ (lift : j ⟶ e), D.W lift) (h₂ : ∀ ⦃j : J⦄ (_ : D.P j) (l₁ l₂ : j ⟶ e), D.W l₁ → D.W l₂ → l₁ = l₂) (h₃ : ∀ ⦃i j : J⦄ (f : i ⟶ j) (_ : D.W f), ∃ (li : i ⟶ e) (lj : j ⟶ e), D.W li ∧ D.W lj ∧ f ≫ lj = li) : - D.Terminal e where + D.IsTerminal e where prop_id := prop_id lift hj := (h₁ hj).choose hlift hj := (h₁ hj).choose_spec @@ -335,25 +352,30 @@ noncomputable def ofExistsUnique (prop_id : D.W (𝟙 e)) rw [h₂ (D.src hf) _ li (h₁ (D.src hf)).choose_spec hli, h₂ (D.tgt hf) _ lj (h₁ (D.tgt hf)).choose_spec hlj, fac] -end Terminal +end IsTerminal -end PreDiagram +end Diagram -structure Diagram extends PreDiagram J κ where - e : J - terminal : toPreDiagram.Terminal e - uniq_terminal (j : J) (hj : toPreDiagram.Terminal j) : j = e +/-- If `κ` is a cardinal, this structure contains the data of a `κ`-bounded diagram +with a terminal object in a category `J`. -/ +structure DiagramWithTerminal extends Diagram J κ where + /-- the terminal object -/ + top : J + /-- `top` is terminal -/ + isTerminal : toDiagram.IsTerminal top + uniq_terminal (j : J) (hj : toDiagram.IsTerminal j) : j = top @[ext] -lemma Diagram.ext {D₁ D₂ : Diagram J κ} (hW : D₁.W = D₂.W) (hP : D₁.P = D₂.P) : D₁ = D₂ := by - obtain ⟨D₁, e, h₁, h₁'⟩ := D₁ - obtain ⟨D₂, e', h₂, h₂'⟩ := D₂ +lemma DiagramWithTerminal.ext {D₁ D₂ : DiagramWithTerminal J κ} + (hW : D₁.W = D₂.W) (hP : D₁.P = D₂.P) : D₁ = D₂ := by + obtain ⟨D₁, top, h₁, h₁'⟩ := D₁ + obtain ⟨D₂, top', h₂, h₂'⟩ := D₂ obtain rfl : D₁ = D₂ := by aesop - obtain rfl : e = e' := h₂' _ h₁ + obtain rfl : top = top' := h₂' _ h₁ obtain rfl : h₁ = h₂ := by subsingleton rfl -instance : PartialOrder (Diagram J κ) where +instance : PartialOrder (DiagramWithTerminal J κ) where le D₁ D₂ := D₁.W ≤ D₂.W ∧ D₁.P ≤ D₂.P le_refl _ := ⟨by rfl, by rfl⟩ le_trans _ _ _ h₁ h₂ := ⟨h₁.1.trans h₂.1, h₁.2.trans h₂.2⟩ @@ -366,30 +388,34 @@ section variable {J κ} -def functorMap {D₁ D₂ : Diagram J κ} (h : D₁ ≤ D₂) : D₁.e ⟶ D₂.e := - D₂.terminal.lift (h.2 _ D₁.terminal.prop) +/-- Auxiliary definition for `functor`. -/ +def functorMap {D₁ D₂ : DiagramWithTerminal J κ} (h : D₁ ≤ D₂) : D₁.top ⟶ D₂.top := + D₂.isTerminal.lift (h.2 _ D₁.isTerminal.prop) @[simp] -lemma functorMap_id (D : Diagram J κ) : functorMap (le_refl D) = 𝟙 D.e := by +lemma functorMap_id (D : DiagramWithTerminal J κ) : functorMap (le_refl D) = 𝟙 D.top := by simp [functorMap] @[reassoc (attr := simp)] -lemma functorMap_comp {D₁ D₂ D₃ : Diagram J κ} (h₁₂ : D₁ ≤ D₂) (h₂₃ : D₂ ≤ D₃) : +lemma functorMap_comp {D₁ D₂ D₃ : DiagramWithTerminal J κ} (h₁₂ : D₁ ≤ D₂) (h₂₃ : D₂ ≤ D₃) : functorMap h₁₂ ≫ functorMap h₂₃ = functorMap (h₁₂.trans h₂₃) := - D₃.terminal.comm _ (h₂₃.1 _ (D₂.terminal.hlift _)) + D₃.isTerminal.comm _ (h₂₃.1 _ (D₂.isTerminal.hlift _)) end +/-- The functor which sends a `κ`-bounded diagram with a terminal object to +its terminal object. -/ @[simps] -def functor : Diagram J κ ⥤ J where - obj D := D.e +def functor : DiagramWithTerminal J κ ⥤ J where + obj D := D.top map h := functorMap (leOfHom h) variable [Fact κ.IsRegular] variable {J κ} in +/-- The diagram containing a single object (and its identity morphism). -/ @[simps] -def PreDiagram.single (j : J) : PreDiagram J κ where +def Diagram.single (j : J) : Diagram J κ where W := .ofHoms (fun (_ : Unit) ↦ 𝟙 j) P := .ofObj (fun (_ : Unit) ↦ j) src := by rintro _ _ _ ⟨⟩; exact ⟨⟨⟩⟩ @@ -406,15 +432,16 @@ def PreDiagram.single (j : J) : PreDiagram J κ where (hasCardinalLT_punit κ (Cardinal.IsRegular.aleph0_le Fact.out)).of_surjective (fun (_ : Unit) ↦ ⟨j, by simp⟩) (fun ⟨k, hk⟩ ↦ ⟨⟨⟩, by aesop⟩) -instance (j : J) : Finite (Subtype (PreDiagram.single (κ := κ) j).P) := +instance (j : J) : Finite (Subtype (Diagram.single (κ := κ) j).P) := Finite.of_surjective (fun (_ : Unit) ↦ ⟨j, by simp⟩) (by rintro ⟨_, ⟨⟩⟩; exact ⟨⟨⟩, rfl⟩) variable {J κ} in -def Diagram.single (j : J) : Diagram J κ where - toPreDiagram := .single j - e := j - terminal := +/-- The diagram with a terminal object containing a single object (and its identity morphism). -/ +def DiagramWithTerminal.single (j : J) : DiagramWithTerminal J κ where + toDiagram := .single j + top := j + isTerminal := { prop_id := ⟨⟨⟩⟩ lift := by rintro j hj; simp at hj; subst hj; exact 𝟙 _ hlift := by rintro j hj; simp at hj; subst hj; exact ⟨⟨⟩⟩ @@ -423,9 +450,10 @@ def Diagram.single (j : J) : Diagram J κ where uniq_terminal := by rintro _ ⟨⟨⟩⟩; rfl variable {J κ} in +/-- The union of a `κ`-bounded family of `κ`-bounded diagrams. -/ @[simps] -def PreDiagram.iSup {ι : Type*} (D : ι → PreDiagram J κ) (hι : HasCardinalLT ι κ) : - PreDiagram J κ where +def Diagram.iSup {ι : Type*} (D : ι → Diagram J κ) (hι : HasCardinalLT ι κ) : + Diagram J κ where W := ⨆ (i : ι), (D i).W P := ⨆ (i : ι), (D i).P src hf := by @@ -442,9 +470,10 @@ def PreDiagram.iSup {ι : Type*} (D : ι → PreDiagram J κ) (hι : HasCardinal hP := hasCardinalLT_subtype_iSup _ hι (fun i ↦ (D i).hP) variable {J κ} in +/-- The union of two `κ`-bounded diagrams. -/ @[simps] -def PreDiagram.max (D₁ D₂ : PreDiagram J κ) : - PreDiagram J κ where +def Diagram.max (D₁ D₂ : Diagram J κ) : + Diagram J κ where W := D₁.W ⊔ D₂.W P := D₁.P ⊔ D₂.P src := by @@ -463,51 +492,55 @@ variable [IsCardinalFiltered J κ] include hJ -lemma isCardinalFiltered : IsCardinalFiltered (Diagram J κ) κ := +lemma isCardinalFiltered_aux + {ι : Type w} (D : ι → DiagramWithTerminal J κ) (hι : HasCardinalLT ι κ) : + ∃ (m : J) (u : ∀ i, (D i).top ⟶ m), (∀ (i : ι), IsEmpty (m ⟶ (D i).top)) ∧ + ∀ (i₁ i₂ : ι) (j : J) (hj₁ : (D i₁).P j) (hj₂ : (D i₂).P j), + (D i₁).isTerminal.lift hj₁ ≫ u i₁ = (D i₂).isTerminal.lift hj₂ ≫ u i₂ := by + choose m₀ t₀ hm₀ using fun i ↦ hJ (D i).top + let m₁ := IsCardinalFiltered.max m₀ hι + let t₁ (i : ι) : m₀ i ⟶ m₁ := IsCardinalFiltered.toMax m₀ hι i + let u (i : ι) : (D i).top ⟶ m₁ := t₀ i ≫ t₁ i + let S := { x : ι × ι × J // (D x.1).P x.2.2 ∧ (D x.2.1).P x.2.2 } + let shape : MultispanShape.{w, w} := + { L := { x : ι × ι × J // (D x.1).P x.2.2 ∧ (D x.2.1).P x.2.2 } + R := PUnit + fst _ := ⟨⟩ + snd _ := ⟨⟩ } + let index : MultispanIndex shape J := + { left x := x.1.2.2 + right _ := m₁ + fst x := (D x.1.1).isTerminal.lift x.2.1 ≫ u x.1.1 + snd x := (D x.1.2.1).isTerminal.lift x.2.2 ≫ u x.1.2.1 } + have hshape : HasCardinalLT (Arrow (WalkingMultispan shape)) κ := by + refine hasCardinalLT_arrow_walkingMultispan ?_ + (hasCardinalLT_of_finite _ _ (Cardinal.IsRegular.aleph0_le Fact.out)) + let T := Σ (i : ι), Subtype (D i).P + have hT : HasCardinalLT (ι × T) κ := + hasCardinalLT_prod hι (hasCardinalLT_sigma _ _ hι (fun i ↦ (D i).hP)) + refine hT.of_injective (fun ⟨⟨i₁, i₂, j⟩, h₁, h₂⟩ ↦ ⟨i₁, i₂, ⟨j, h₂⟩⟩) ?_ + rintro ⟨⟨i₁, i₂, j⟩, _, _⟩ ⟨⟨i₁', i₂', j'⟩, _, _⟩ h + rw [Prod.ext_iff, Sigma.ext_iff] at h + dsimp at h + obtain rfl : i₁ = i₁' := h.1 + obtain rfl : i₂ = i₂' := h.2.1 + obtain rfl : j = j' := by simpa using h + rfl + let c : Multicofork _ := IsCardinalFiltered.cocone index.multispan hshape + exact ⟨c.pt, fun i ↦ u i ≫ c.π ⟨⟩, + fun i ↦ ⟨fun hi ↦ (hm₀ i).false (t₁ i ≫ c.π ⟨⟩ ≫ hi)⟩, + fun i₁ i₂ j h₁ h₂ ↦ by simpa [index, shape] using c.condition ⟨⟨i₁, i₂, j⟩, h₁, h₂⟩⟩ + +lemma isCardinalFiltered : IsCardinalFiltered (DiagramWithTerminal J κ) κ := isCardinalFiltered_preorder _ _ (fun ι D hι ↦ by simp only [← hasCardinalLT_iff_cardinal_mk_lt] at hι - choose m₀ t₀ hm₀ using fun i ↦ hJ (D i).e - let m₁ := IsCardinalFiltered.max m₀ hι - let t₁ (i : ι) : m₀ i ⟶ m₁ := IsCardinalFiltered.toMax m₀ hι i - let u (i : ι) : (D i).e ⟶ m₁ := t₀ i ≫ t₁ i - obtain ⟨m₂, t₂, hm₂⟩ : ∃ (m₂ : J) (t₂ : m₁ ⟶ m₂), - ∀ (i₁ i₂ : ι) (j : J) (hj₁ : (D i₁).P j) (hj₂ : (D i₂).P j), - (D i₁).terminal.lift hj₁ ≫ u i₁ ≫ t₂ = (D i₂).terminal.lift hj₂ ≫ u i₂ ≫ t₂ := by - let S := { x : ι × ι × J // (D x.1).P x.2.2 ∧ (D x.2.1).P x.2.2 } - let shape : MultispanShape.{w, w} := - { L := { x : ι × ι × J // (D x.1).P x.2.2 ∧ (D x.2.1).P x.2.2 } - R := PUnit - fst _ := ⟨⟩ - snd _ := ⟨⟩ } - let index : MultispanIndex shape J := - { left x := x.1.2.2 - right _ := m₁ - fst x := (D x.1.1).terminal.lift x.2.1 ≫ u x.1.1 - snd x := (D x.1.2.1).terminal.lift x.2.2 ≫ u x.1.2.1 } - have hshape : HasCardinalLT (Arrow (WalkingMultispan shape)) κ := by - refine hasCardinalLT_arrow_walkingMultispan ?_ - (hasCardinalLT_of_finite _ _ (Cardinal.IsRegular.aleph0_le Fact.out)) - let T := Σ (i : ι), Subtype (D i).P - have hT : HasCardinalLT (ι × T) κ := - hasCardinalLT_prod hι (hasCardinalLT_sigma _ _ hι (fun i ↦ (D i).hP)) - refine hT.of_injective (fun ⟨⟨i₁, i₂, j⟩, h₁, h₂⟩ ↦ ⟨i₁, i₂, ⟨j, h₂⟩⟩) ?_ - rintro ⟨⟨i₁, i₂, j⟩, _, _⟩ ⟨⟨i₁', i₂', j'⟩, _, _⟩ h - rw [Prod.ext_iff, Sigma.ext_iff] at h - dsimp at h - obtain rfl : i₁ = i₁' := h.1 - obtain rfl : i₂ = i₂' := h.2.1 - obtain rfl : j = j' := by simpa using h - rfl - let c : Multicofork _ := IsCardinalFiltered.cocone index.multispan hshape - exact ⟨c.pt, c.π ⟨⟩, fun i₁ i₂ j h₁ h₂ ↦ by - simpa [index, shape] using c.condition ⟨⟨i₁, i₂, j⟩, h₁, h₂⟩⟩ - let φ (x : (Σ (i : ι), (Subtype (D i).P))) : x.2.1 ⟶ m₂ := - (D x.1).terminal.lift x.2.2 ≫ u x.1 ≫ t₂ - let D₀ := PreDiagram.iSup (fun i ↦ (D i).toPreDiagram) hι - have hD₀ {i : ι} : ¬ (D i).P m₂ := fun hi ↦ - (hm₀ i).false (t₁ _ ≫ t₂ ≫ (D i).terminal.lift hi) - let D₁ := D₀.max (.single m₂) - let D₂ : PreDiagram J κ := + obtain ⟨m, u, hm₀, hm⟩ := isCardinalFiltered_aux J κ hJ D hι + let φ (x : (Σ (i : ι), (Subtype (D i).P))) : x.2.1 ⟶ m := + (D x.1).isTerminal.lift x.2.2 ≫ u x.1 + have hD {i : ι} : ¬ (D i).P m := fun hi ↦ (hm₀ i).false ((D i).isTerminal.lift hi) + let D₀ := Diagram.iSup (fun i ↦ (D i).toDiagram) hι + let D₁ := D₀.max (.single m) + let D₂ : Diagram J κ := { W := D₁.W ⊔ .ofHoms φ P := D₁.P src := by @@ -535,27 +568,27 @@ lemma isCardinalFiltered : IsCardinalFiltered (Diagram J κ) κ := (hasCardinalLT_subtype_iSup _ hι (fun i ↦ (D i).hP)) (hasCardinalLT_of_finite _ _ (Cardinal.IsRegular.aleph0_le Fact.out)) } - have hD₂ {f : m₂ ⟶ m₂} (hf : D₂.W f) : f = 𝟙 _ := by + have hD₂ {f : m ⟶ m} (hf : D₂.W f) : f = 𝟙 _ := by simp [D₂, D₁, D₀] at hf obtain ((hf | ⟨⟨⟩⟩) | hf) := hf · simp at hf obtain ⟨i, hi⟩ := hf - exact (hD₀ ((D i).src hi)).elim + exact (hD ((D i).src hi)).elim · rfl · rw [MorphismProperty.ofHoms_iff] at hf obtain ⟨⟨i, j, hj⟩, hi⟩ := hf - obtain rfl : m₂ = j := congr_arg Arrow.leftFunc.obj hi - exact (hD₀ hj).elim - let he : D₂.Terminal m₂ := by - have H {i : ι} {j : J} (hj : (D i).P j) {f : j ⟶ m₂} (hf : D₂.W f) : + obtain rfl : m = j := congr_arg Arrow.leftFunc.obj hi + exact (hD hj).elim + let he : D₂.IsTerminal m := by + have H {i : ι} {j : J} (hj : (D i).P j) {f : j ⟶ m} (hf : D₂.W f) : f = φ ⟨i, ⟨_, hj⟩⟩ := by simp [D₂, D₁, D₀] at hf obtain ((hf | ⟨⟨⟩⟩) | ⟨⟨i', j, hj'⟩⟩) := hf · simp at hf obtain ⟨i, hf⟩ := hf - exact (hD₀ ((D i).tgt hf)).elim - · exact (hD₀ hj).elim - · apply hm₂ + exact (hD ((D i).tgt hf)).elim + · exact (hD hj).elim + · apply hm refine .ofExistsUnique ?_ ?_ ?_ ?_ · exact Or.inl (Or.inr ⟨⟨⟩⟩) · simp [D₂, D₁, D₀] @@ -573,40 +606,38 @@ lemma isCardinalFiltered : IsCardinalFiltered (Diagram J κ) κ := · simp [D₀] at hf obtain ⟨i, hf⟩ := hf exact ⟨φ ⟨i, j, (D i).src hf⟩, φ ⟨i, k, (D i).tgt hf⟩, Or.inr ⟨_⟩, Or.inr ⟨_⟩, - by simp [φ, (D i).terminal.comm_assoc _ hf]⟩ + by simp [φ, (D i).isTerminal.comm_assoc _ hf]⟩ · exact ⟨𝟙 _, 𝟙 _, Or.inl (Or.inr ⟨⟨⟩⟩), Or.inl (Or.inr ⟨⟨⟩⟩), by simp⟩ · exact ⟨φ ⟨i, j, hj⟩, 𝟙 _, Or.inr ⟨_⟩, Or.inl (Or.inr ⟨⟨⟩⟩), by simp⟩ - let D₂' : Diagram J κ := - { toPreDiagram := D₂ - e := _ - terminal := he + let D₂' : DiagramWithTerminal J κ := + { toDiagram := D₂ + top := _ + isTerminal := he uniq_terminal j hj := by have := hj.prop simp [D₂, D₁, D₀] at this obtain (⟨i, hi⟩ | rfl) := this · exfalso - exact (hm₀ i).false (t₁ _ ≫ t₂ ≫ hj.lift - (by simp [D₂, D₁]) ≫ (D i).terminal.lift hi) + exact (hm₀ i).false (hj.lift (by simp [D₂, D₁]) ≫ (D i).isTerminal.lift hi) · rfl } refine ⟨D₂', fun i ↦ ⟨?_, ?_⟩⟩ - · exact le_trans (le_trans (le_trans (by rfl) (le_iSup _ i)) - le_sup_left) le_sup_left + · exact le_trans (le_trans (le_trans (by rfl) (le_iSup _ i)) le_sup_left) le_sup_left · exact le_trans (le_trans (by rfl) (le_iSup _ i)) le_sup_left) lemma final_functor : (functor J κ).Final := by have := isCardinalFiltered J κ hJ have := isFiltered_of_isCardinalFiltered J κ - have := isFiltered_of_isCardinalFiltered (Diagram J κ) κ + have := isFiltered_of_isCardinalFiltered (DiagramWithTerminal J κ) κ rw [Functor.final_iff_of_isFiltered] - refine ⟨fun j ↦ ⟨.single j, ⟨𝟙 _⟩⟩, fun {j D} (f₁ f₂ : j ⟶ D.e) ↦ ?_⟩ - obtain ⟨m₀, t, hm₀⟩ := hJ D.e + refine ⟨fun j ↦ ⟨.single j, ⟨𝟙 _⟩⟩, fun {j D} (f₁ f₂ : j ⟶ D.top) ↦ ?_⟩ + obtain ⟨m₀, t, hm₀⟩ := hJ D.top obtain ⟨m₁, u, hu⟩ : ∃ (m₁ : J) (u : m₀ ⟶ m₁), f₁ ≫ t ≫ u = f₂ ≫ t ≫ u := ⟨_, IsFiltered.coeqHom (f₁ ≫ t) (f₂ ≫ t), by simpa using IsFiltered.coeq_condition (f₁ ≫ t) (f₂ ≫ t)⟩ - have h₁ : ¬ (D.P m₁) := fun h₁ ↦ hm₀.false (u ≫ D.terminal.lift h₁) - let φ (x : Subtype D.P) : x.1 ⟶ m₁ := D.terminal.lift x.2 ≫ t ≫ u - let D₀ := D.toPreDiagram.max (.single m₁) - let D₁ : PreDiagram J κ := + have h₁ : ¬ (D.P m₁) := fun h₁ ↦ hm₀.false (u ≫ D.isTerminal.lift h₁) + let φ (x : Subtype D.P) : x.1 ⟶ m₁ := D.isTerminal.lift x.2 ≫ t ≫ u + let D₀ := D.toDiagram.max (.single m₁) + let D₁ : Diagram J κ := { W := D₀.W ⊔ .ofHoms φ P := D₀.P src := by @@ -626,7 +657,7 @@ lemma final_functor : (functor J κ).Final := by hP := hasCardinalLT_union D.hP (hasCardinalLT_subtype_objectPropertyOfObj _ - ((hasCardinalLT_of_finite _ _ (Cardinal.IsRegular.aleph0_le Fact.out)))) } + (hasCardinalLT_of_finite _ _ (Cardinal.IsRegular.aleph0_le Fact.out))) } have h₂ {j : J} (hj : D.P j) {f : j ⟶ m₁} (hf : D₁.W f) : f = φ ⟨_, hj⟩ := by obtain ((hf | ⟨⟨⟩⟩) | ⟨⟨⟩⟩) := hf @@ -641,7 +672,7 @@ lemma final_functor : (functor J κ).Final := by obtain ⟨⟨j, hj⟩, hf⟩ := hf obtain rfl : m₁ = j := congr_arg Arrow.leftFunc.obj hf exact (h₁ hj).elim - let hm₁ : D₁.Terminal m₁ := + let hm₁ : D₁.IsTerminal m₁ := .ofExistsUnique (Or.inl (Or.inr ⟨⟨⟩⟩)) (by rintro j (hj | ⟨⟨⟨⟩⟩⟩) · exact ⟨φ ⟨_, hj⟩, Or.inr ⟨_⟩⟩ @@ -653,30 +684,44 @@ lemma final_functor : (functor J κ).Final := by · rw [h₃ hl₁, h₃ hl₂]) (by rintro j k f ((hf | ⟨⟨⟩⟩) | ⟨⟨j, hj⟩⟩) · exact ⟨φ ⟨_, D.src hf⟩, φ ⟨_, D.tgt hf⟩, - Or.inr ⟨_⟩, Or.inr ⟨_⟩, D.terminal.comm_assoc _ hf _⟩ + Or.inr ⟨_⟩, Or.inr ⟨_⟩, D.isTerminal.comm_assoc _ hf _⟩ · exact ⟨𝟙 _, 𝟙 _, Or.inl (Or.inr ⟨⟨⟩⟩), Or.inl (Or.inr ⟨⟨⟩⟩), by simp⟩ · exact ⟨φ ⟨_, hj⟩, 𝟙 _, Or.inr ⟨_⟩, Or.inl (Or.inr ⟨⟨⟩⟩), by simp⟩) have lift_eq (j : J) (hj : D.P j) : hm₁.lift (Or.inl hj) = φ ⟨_, hj⟩ := hm₁.uniq _ (Or.inr ⟨_⟩) - let D₁' : Diagram J κ := - { toPreDiagram := D₁ - e := m₁ - terminal := hm₁ + let D₁' : DiagramWithTerminal J κ := + { toDiagram := D₁ + top := m₁ + isTerminal := hm₁ uniq_terminal j hj := by obtain (hj' | ⟨⟨⟩⟩) := hj.prop - · exact hm₀.elim (u ≫ hj.lift (Or.inr ⟨⟨⟩⟩) ≫ D.terminal.lift hj') + · exact hm₀.elim (u ≫ hj.lift (Or.inr ⟨⟨⟩⟩) ≫ D.isTerminal.lift hj') · rfl} exact ⟨D₁', homOfLE ⟨le_sup_left.trans le_sup_left, le_sup_left⟩, - by simpa [functorMap, D₁', lift_eq _ D.terminal.prop, φ]⟩ + by simpa [functorMap, D₁', lift_eq _ D.isTerminal.prop, φ]⟩ lemma aux : ∃ (α : Type w) (_ : PartialOrder α) (_ : IsCardinalFiltered α κ) (F : α ⥤ J), F.Final := - ⟨_, _, isCardinalFiltered J κ hJ, functor J κ, final_functor J κ hJ⟩ + ⟨DiagramWithTerminal J κ, _, isCardinalFiltered J κ hJ, + functor J κ, final_functor J κ hJ⟩ end exists_cardinal_directed -lemma exists_cardinal_directed [Fact κ.IsRegular] [IsCardinalFiltered J κ] : + +/-! +The previous lemma `IsCardinalFiltered.exists_cardinal_directed.aux` +is the particular case of the main lemma +`IsCardinalFiltered.exists_cardinal_directed` below in the particular +case the `κ`-filtered category `J` has no object `m : J` such that for any +object `j : J`, there exists a map `j ⟶ m`. + +The general case is obtained by applying the previous result to +the cartesian product `J × κ.ord.toType`. +-/ + +lemma exists_cardinal_directed (J : Type w) [SmallCategory J] (κ : Cardinal.{w}) + [Fact κ.IsRegular] [IsCardinalFiltered J κ] : ∃ (α : Type w) (_ : PartialOrder α) (_ : IsCardinalFiltered α κ) (F : α ⥤ J), F.Final := by have := isFiltered_of_isCardinalFiltered κ.ord.toType κ From 3827cdd1e123f3c69d0fad53fc6a65f6495a02a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 17 Oct 2025 09:28:38 +0200 Subject: [PATCH 147/309] cleaning up --- .../CategoryTheory/Presentable/Directed.lean | 74 +++---------------- 1 file changed, 9 insertions(+), 65 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/Directed.lean b/Mathlib/CategoryTheory/Presentable/Directed.lean index 936cfb7d018b64..018d5af9b959ec 100644 --- a/Mathlib/CategoryTheory/Presentable/Directed.lean +++ b/Mathlib/CategoryTheory/Presentable/Directed.lean @@ -50,69 +50,6 @@ lemma hasCardinalLT_of_finite HasCardinalLT X κ := .of_le (by rwa [hasCardinalLT_aleph0_iff]) hκ -lemma hasCardinalLT_punit (κ : Cardinal) (hκ : Cardinal.aleph0 ≤ κ) : - HasCardinalLT PUnit κ := - hasCardinalLT_of_finite _ _ hκ - -lemma Cardinal.mk_surjective : - Function.Surjective (Cardinal.mk : Type w → Cardinal) := by - rintro ⟨_⟩; exact ⟨_, rfl⟩ - -open CategoryTheory in -lemma Cardinal.IsRegular.exists_upper_bound {κ : Cardinal.{w}} (hκ : κ.IsRegular) - {ι : Type w} (c : ι → Cardinal.{w}) (hc : ∀ i, c i < κ) (hι : Cardinal.mk ι < κ) : - ∃ (κ₀ : Cardinal.{w}), κ₀ < κ ∧ ∀ i, c i ≤ κ₀ := by - have : Fact κ.IsRegular := ⟨hκ⟩ - let f (i : ι) : κ.ord.toType := - Ordinal.enumIsoToType _ ⟨(c i).ord, by simpa using hc i⟩ - rw [← hasCardinalLT_iff_cardinal_mk_lt] at hι - let m := IsCardinalFiltered.max f hι - have hm (i : ι) : f i ≤ m := leOfHom (IsCardinalFiltered.toMax f hι i) - have h (j : κ.ord.toType) : -- should be made a lemma? - ((Ordinal.enumIsoToType _).symm j).1.card < κ := by - obtain ⟨⟨a, ha⟩, rfl⟩ := κ.ord.enumIsoToType.surjective j - simpa only [OrderIso.symm_apply_apply, ← lt_ord, Set.mem_Iio] using ha - refine ⟨Cardinal.mk ((Ordinal.enumIsoToType _).symm m).1.toType, by simpa using h m, fun i ↦ ?_⟩ - rw [mk_toType] - exact le_trans (by simp [f]) (Ordinal.card_le_card - (Subtype.mono_coe _ (κ.ord.enumIsoToType.symm.monotone (hm i)))) - -lemma hasCardinalLT_sigma' {ι : Type w} (α : ι → Type w) (κ : Cardinal.{w}) [Fact κ.IsRegular] - (hι : HasCardinalLT ι κ) (hα : ∀ i, HasCardinalLT (α i) κ) : - HasCardinalLT (Σ i, α i) κ := by - have hκ : Cardinal.aleph0 ≤ κ := Cardinal.IsRegular.aleph0_le Fact.out - obtain hκ | rfl := hκ.lt_or_eq - · obtain ⟨κ₀, h₁, h₂, h₃, h₄⟩ : ∃ (κ₀ : Cardinal), Cardinal.aleph0 ≤ κ₀ ∧ κ₀ < κ ∧ - Cardinal.mk ι ≤ κ₀ ∧ ∀ i, Cardinal.mk (α i) ≤ κ₀ := by - obtain ⟨κ₀, h₁, h₂⟩ := - Cardinal.IsRegular.exists_upper_bound (κ := κ) Fact.out - (fun (i : Option ι) ↦ match i with - | none => max Cardinal.aleph0 (Cardinal.mk ι) - | some i => Cardinal.mk (α i)) (by - rintro (_ | i) - · simp only [sup_lt_iff, ← hasCardinalLT_iff_cardinal_mk_lt] - exact ⟨hκ, hι⟩ - · exact (hasCardinalLT_iff_cardinal_mk_lt _ _).1 (hα i)) (by - rwa [← hasCardinalLT_iff_cardinal_mk_lt, - hasCardinalLT_option_iff _ _ hκ.le]) - exact ⟨κ₀, (le_max_left _ _).trans (h₂ .none), h₁, - (le_max_right _ _).trans (h₂ .none), fun i ↦ h₂ (.some i)⟩ - obtain ⟨X, rfl⟩ := κ₀.mk_surjective - rw [hasCardinalLT_iff_cardinal_mk_lt] - obtain ⟨φ⟩ := h₃ - let ψ (i : ι) : α i ↪ X := (h₄ i).some - refine lt_of_le_of_lt ?_ h₂ - trans Cardinal.mk (X × X) - · refine ⟨⟨fun ⟨i, a⟩ ↦ ⟨φ i, ψ i a⟩, fun ⟨i, a⟩ ⟨j, b⟩ h ↦ ?_⟩⟩ - rw [Prod.ext_iff] at h - obtain rfl : i = j := φ.injective h.1 - obtain rfl : a = b := (ψ i).injective h.2 - rfl - · rw [← Cardinal.mul_def] - exact (Cardinal.mul_le_max_of_aleph0_le_left h₁).trans (by simp) - · simp only [hasCardinalLT_aleph0_iff] at hι hα ⊢ - infer_instance - @[simp] lemma hasCardinalLT_lift_iff (X : Type v) (κ : Cardinal.{w}) : HasCardinalLT X (Cardinal.lift.{u} κ) ↔ HasCardinalLT X κ := by @@ -130,6 +67,13 @@ lemma Cardinal.IsRegular.lift {κ : Cardinal.{w}} (hκ : κ.IsRegular) : · simpa · rwa [← Cardinal.lift_ord, ← Ordinal.lift_cof, lift_le] +lemma hasCardinalLT_sigma' {ι : Type w} (α : ι → Type w) (κ : Cardinal.{w}) [Fact κ.IsRegular] + (hι : HasCardinalLT ι κ) (hα : ∀ i, HasCardinalLT (α i) κ) : + HasCardinalLT (Σ i, α i) κ := by + simp only [hasCardinalLT_iff_cardinal_mk_lt] at hι hα ⊢ + rw [Cardinal.mk_sigma] + exact Cardinal.sum_lt_lift_of_isRegular.{w, w} Fact.out (by simpa) hα + lemma hasCardinalLT_sigma {ι : Type u} (α : ι → Type v) (κ : Cardinal.{w}) [Fact κ.IsRegular] (hι : HasCardinalLT ι κ) (hα : ∀ i, HasCardinalLT (α i) κ) : HasCardinalLT (Σ i, α i) κ := by @@ -421,7 +365,7 @@ def Diagram.single (j : J) : Diagram J κ where src := by rintro _ _ _ ⟨⟩; exact ⟨⟨⟩⟩ tgt := by rintro _ _ _ ⟨⟩; exact ⟨⟨⟩⟩ hW := - (hasCardinalLT_punit κ (Cardinal.IsRegular.aleph0_le Fact.out)).of_surjective + (hasCardinalLT_of_finite _ κ (Cardinal.IsRegular.aleph0_le Fact.out)).of_surjective (fun (_ : Unit) ↦ ⟨Arrow.mk (𝟙 j), ⟨⟨⟩⟩⟩) (by rintro ⟨f, hf⟩ refine ⟨⟨⟩, ?_⟩ @@ -429,7 +373,7 @@ def Diagram.single (j : J) : Diagram J κ where exact ((MorphismProperty.ofHoms_iff _ _).1 ((MorphismProperty.arrow_mk_mem_toSet_iff _ _).1 hf)).choose_spec.symm) hP := - (hasCardinalLT_punit κ (Cardinal.IsRegular.aleph0_le Fact.out)).of_surjective + (hasCardinalLT_of_finite _ κ (Cardinal.IsRegular.aleph0_le Fact.out)).of_surjective (fun (_ : Unit) ↦ ⟨j, by simp⟩) (fun ⟨k, hk⟩ ↦ ⟨⟨⟩, by aesop⟩) instance (j : J) : Finite (Subtype (Diagram.single (κ := κ) j).P) := From d0a2a09e7795b1fe859be8973d87b66e26450259 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 17 Oct 2025 14:39:21 +0200 Subject: [PATCH 148/309] feat(SetTheory): more API for HasCardinalLT --- Mathlib/SetTheory/Cardinal/HasCardinalLT.lean | 93 +++++++++++++++++++ Mathlib/SetTheory/Cardinal/Regular.lean | 12 +++ 2 files changed, 105 insertions(+) diff --git a/Mathlib/SetTheory/Cardinal/HasCardinalLT.lean b/Mathlib/SetTheory/Cardinal/HasCardinalLT.lean index 0acdb59e0b6f26..85a1a133ec2182 100644 --- a/Mathlib/SetTheory/Cardinal/HasCardinalLT.lean +++ b/Mathlib/SetTheory/Cardinal/HasCardinalLT.lean @@ -75,6 +75,21 @@ lemma hasCardinalLT_aleph0_iff (X : Type u) : HasCardinalLT X Cardinal.aleph0.{v} ↔ Finite X := by simpa [HasCardinalLT] using Cardinal.mk_lt_aleph0_iff +lemma hasCardinalLT_of_finite + (X : Type*) [Finite X] (κ : Cardinal) (hκ : Cardinal.aleph0 ≤ κ) : + HasCardinalLT X κ := + .of_le (by rwa [hasCardinalLT_aleph0_iff]) hκ + +@[simp] +lemma hasCardinalLT_lift_iff (X : Type v) (κ : Cardinal.{w}) : + HasCardinalLT X (Cardinal.lift.{u} κ) ↔ HasCardinalLT X κ := by + simp [HasCardinalLT, ← (Cardinal.lift_strictMono.{max v w, max u}).lt_iff_lt] + +@[simp] +lemma hasCardinalLT_ulift_iff (X : Type v) (κ : Cardinal.{w}) : + HasCardinalLT (ULift.{u} X) κ ↔ HasCardinalLT X κ := + hasCardinalLT_iff_of_equiv Equiv.ulift κ + lemma hasCardinalLT_sum_iff (X : Type u) (Y : Type u') (κ : Cardinal.{w}) (hκ : Cardinal.aleph0 ≤ κ) : HasCardinalLT (X ⊕ Y) κ ↔ HasCardinalLT X κ ∧ HasCardinalLT Y κ := by @@ -98,6 +113,84 @@ lemma hasCardinalLT_option_iff (X : Type u) (κ : Cardinal.{w}) rw [hasCardinalLT_aleph0_iff] infer_instance +lemma hasCardinalLT_subtype_max + {X : Type*} {P₁ P₂ : X → Prop} {κ : Cardinal} (hκ : Cardinal.aleph0 ≤ κ) + (h₁ : HasCardinalLT (Subtype P₁) κ) (h₂ : HasCardinalLT (Subtype P₂) κ) : + HasCardinalLT (Subtype (P₁ ⊔ P₂)) κ := by + have : HasCardinalLT (Subtype P₁ ⊕ Subtype P₂) κ := by + rw [hasCardinalLT_sum_iff _ _ _ hκ] + exact ⟨h₁, h₂⟩ + refine this.of_surjective (Sum.elim (fun x ↦ ⟨x.1, Or.inl x.2⟩) + (fun x ↦ ⟨x.1, Or.inr x.2⟩)) ?_ + rintro ⟨x, hx | hx⟩ + · exact ⟨Sum.inl ⟨x, hx⟩, rfl⟩ + · exact ⟨Sum.inr ⟨x, hx⟩, rfl⟩ + +lemma hasCardinalLT_union + {X : Type*} {S₁ S₂ : Set X} {κ : Cardinal} (hκ : Cardinal.aleph0 ≤ κ) + (h₁ : HasCardinalLT S₁ κ) (h₂ : HasCardinalLT S₂ κ) : + HasCardinalLT (S₁ ∪ S₂ : Set _) κ := + hasCardinalLT_subtype_max hκ h₁ h₂ + +/-- The particular case of `hasCardinatLT_sigma` when all the inputs are in the +same universe `w`. It is used to prove the general case. -/ +lemma hasCardinalLT_sigma' {ι : Type w} (α : ι → Type w) (κ : Cardinal.{w}) [Fact κ.IsRegular] + (hι : HasCardinalLT ι κ) (hα : ∀ i, HasCardinalLT (α i) κ) : + HasCardinalLT (Σ i, α i) κ := by + simp only [hasCardinalLT_iff_cardinal_mk_lt] at hι hα ⊢ + rw [Cardinal.mk_sigma] + exact Cardinal.sum_lt_lift_of_isRegular.{w, w} Fact.out (by simpa) hα + +lemma hasCardinalLT_sigma {ι : Type u} (α : ι → Type v) (κ : Cardinal.{w}) [Fact κ.IsRegular] + (hι : HasCardinalLT ι κ) (hα : ∀ i, HasCardinalLT (α i) κ) : + HasCardinalLT (Σ i, α i) κ := by + have : Fact (Cardinal.lift.{max u v} κ).IsRegular := ⟨Cardinal.IsRegular.lift Fact.out⟩ + have := hasCardinalLT_sigma' + (fun (i : ULift.{max v w} ι) ↦ ULift.{max u w} (α (ULift.down i))) + (Cardinal.lift.{max u v} κ) (by simpa) + (fun i ↦ by simpa using hα (ULift.down i)) + rw [hasCardinalLT_lift_iff] at this + exact this.of_surjective (fun ⟨i, a⟩ ↦ ⟨ULift.down i, ULift.down a⟩) + (fun ⟨i, a⟩ ↦ ⟨⟨ULift.up i, ULift.up a⟩, rfl⟩) + +lemma hasCardinalLT_subtype_iSup + {ι : Type*} {X : Type*} (P : ι → X → Prop) {κ : Cardinal} [Fact κ.IsRegular] + (hι : HasCardinalLT ι κ) (hP : ∀ i, HasCardinalLT (Subtype (P i)) κ) : + HasCardinalLT (Subtype (⨆ i, P i)) κ := + (hasCardinalLT_sigma (fun i ↦ Subtype (P i)) κ hι hP).of_surjective + (fun ⟨i, x, hx⟩ ↦ ⟨x, by simp only [iSup_apply, iSup_Prop_eq]; exact ⟨i, hx⟩⟩) (by + rintro ⟨_, h⟩ + simp only [iSup_apply, iSup_Prop_eq] at h + obtain ⟨i, hi⟩ := h + exact ⟨⟨i, _, hi⟩, rfl⟩) + +lemma hasCardinalLT_iUnion + {ι : Type*} {X : Type*} (S : ι → Set X) {κ : Cardinal} [Fact κ.IsRegular] + (hι : HasCardinalLT ι κ) (hS : ∀ i, HasCardinalLT (S i) κ) : + HasCardinalLT (⋃ i, S i) κ := by + convert hasCardinalLT_subtype_iSup S hι hS using 2 + ext x + change _ ↔ ((⨆ i, S i) : X → Prop) x + aesop + +/-- The particular case of `hasCardinatLT_prod` when all the inputs are in the +same universe `w`. It is used to prove the general case. -/ +lemma hasCardinalLT_prod' {T₁ T₂ : Type w} {κ : Cardinal.{w}} (hκ : Cardinal.aleph0 ≤ κ) + (h₁ : HasCardinalLT T₁ κ) (h₂ : HasCardinalLT T₂ κ) : + HasCardinalLT (T₁ × T₂) κ := by + rw [hasCardinalLT_iff_cardinal_mk_lt] at h₁ h₂ ⊢ + simpa using Cardinal.mul_lt_of_lt hκ h₁ h₂ + +lemma hasCardinalLT_prod {T₁ : Type u} {T₂ : Type u'} + {κ : Cardinal.{w}} (hκ : Cardinal.aleph0 ≤ κ) + (h₁ : HasCardinalLT T₁ κ) (h₂ : HasCardinalLT T₂ κ) : + HasCardinalLT (T₁ × T₂) κ := by + have := hasCardinalLT_prod' (T₁ := ULift.{max u' w} T₁) (T₂ := ULift.{max u w} T₂) + (κ := Cardinal.lift.{max u u'} κ) (by simpa) (by simpa) (by simpa) + simp only [hasCardinalLT_lift_iff] at this + exact this.of_surjective (fun ⟨x₁, x₂⟩ ↦ ⟨ULift.down x₁, ULift.down x₂⟩) (fun ⟨x₁, x₂⟩ ↦ + ⟨⟨ULift.up x₁, ULift.up x₂⟩, rfl⟩) + namespace HasCardinalLT /-- For any `w`-small type `X`, there exists a regular cardinal `κ : Cardinal.{w}` diff --git a/Mathlib/SetTheory/Cardinal/Regular.lean b/Mathlib/SetTheory/Cardinal/Regular.lean index d3796fd0df6c13..e9646b2d9c9d48 100644 --- a/Mathlib/SetTheory/Cardinal/Regular.lean +++ b/Mathlib/SetTheory/Cardinal/Regular.lean @@ -103,6 +103,18 @@ theorem isRegular_aleph_succ (o : Ordinal) : IsRegular (ℵ_ (succ o)) := by rw [aleph_succ] exact isRegular_succ (aleph0_le_aleph o) +lemma IsRegular.lift {κ : Cardinal.{v}} (h : κ.IsRegular) : + (Cardinal.lift.{u} κ).IsRegular := by + obtain ⟨h₁, h₂⟩ := h + constructor + · simpa + · rwa [← Cardinal.lift_ord, ← Ordinal.lift_cof, lift_le] + +@[simp] +lemma isRegular_lift_iff {κ : Cardinal.{v}} : + (Cardinal.lift.{u} κ).IsRegular ↔ κ.IsRegular := + ⟨fun ⟨h₁, h₂⟩ ↦ ⟨by simpa using h₁, by simpa [← lift_le.{u, v}]⟩, fun h ↦ h.lift⟩ + theorem lsub_lt_ord_lift_of_isRegular {ι} {f : ι → Ordinal} {c} (hc : IsRegular c) (hι : Cardinal.lift.{v, u} #ι < c) : (∀ i, f i < c.ord) → Ordinal.lsub.{u, v} f < c.ord := lsub_lt_ord_lift (by rwa [hc.cof_eq]) From 1abd47edc709fca09253c0d658f72734dbfffc76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 17 Oct 2025 15:01:25 +0200 Subject: [PATCH 149/309] =?UTF-8?q?feat(CategoryTheory):=20=CE=BA-filtered?= =?UTF-8?q?=20categories=20are=20stable=20under=20products?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Mathlib/CategoryTheory/Filtered/Final.lean | 26 +++++++++--------- Mathlib/CategoryTheory/Limits/Final.lean | 3 +++ .../Presentable/IsCardinalFiltered.lean | 27 +++++++++++++++++++ 3 files changed, 42 insertions(+), 14 deletions(-) diff --git a/Mathlib/CategoryTheory/Filtered/Final.lean b/Mathlib/CategoryTheory/Filtered/Final.lean index dc754515c96869..82c0cedb435753 100644 --- a/Mathlib/CategoryTheory/Filtered/Final.lean +++ b/Mathlib/CategoryTheory/Filtered/Final.lean @@ -436,24 +436,22 @@ end Pi section Prod -open IsFiltered in -instance final_fst [IsFilteredOrEmpty C] [IsFiltered D] : (Prod.fst C D).Final := by - apply Functor.final_of_exists_of_isFiltered - · exact fun c => ⟨(c, nonempty.some), ⟨𝟙 c⟩⟩ - · intro c ⟨c', d'⟩ f g - exact ⟨(coeq f g, d'), (coeqHom f g, 𝟙 d'), coeq_condition _ _⟩ +instance final_fst [IsFiltered D] : (Prod.fst C D).Final := by + let F : D ⥤ Discrete PUnit.{1} := (Functor.const _).obj (Discrete.mk .unit) + have hF : F.Final := Functor.final_of_isFiltered_of_pUnit _ + change (Functor.prod (𝟭 C) F ⋙ (prod.rightUnitorEquivalence.{0} C).functor).Final + infer_instance -instance final_snd [IsFiltered C] [IsFilteredOrEmpty D] : (Prod.snd C D).Final := +instance final_snd [IsFiltered C] : (Prod.snd C D).Final := inferInstanceAs ((Prod.braiding C D).functor ⋙ Prod.fst D C).Final -open IsCofiltered in -instance initial_fst [IsCofilteredOrEmpty C] [IsCofiltered D] : (Prod.fst C D).Initial := by - apply Functor.initial_of_exists_of_isCofiltered - · exact fun c => ⟨(c, nonempty.some), ⟨𝟙 c⟩⟩ - · intro c ⟨c', d'⟩ f g - exact ⟨(eq f g, d'), (eqHom f g, 𝟙 d'), eq_condition _ _⟩ +instance initial_fst [IsCofiltered D] : (Prod.fst C D).Initial := by + let F : D ⥤ Discrete PUnit.{1} := (Functor.const _).obj (Discrete.mk .unit) + have hF : F.Initial := Functor.initial_of_isCofiltered_pUnit _ + change (Functor.prod (𝟭 C) F ⋙ (prod.rightUnitorEquivalence.{0} C).functor).Initial + infer_instance -instance initial_snd [IsCofiltered C] [IsCofilteredOrEmpty D] : (Prod.snd C D).Initial := +instance initial_snd [IsCofiltered C] : (Prod.snd C D).Initial := inferInstanceAs ((Prod.braiding C D).functor ⋙ Prod.fst D C).Initial end Prod diff --git a/Mathlib/CategoryTheory/Limits/Final.lean b/Mathlib/CategoryTheory/Limits/Final.lean index ce26bbffd1d56b..77f3fe1f7c3fbd 100644 --- a/Mathlib/CategoryTheory/Limits/Final.lean +++ b/Mathlib/CategoryTheory/Limits/Final.lean @@ -1111,6 +1111,9 @@ variable (F : C ⥤ D) (G : C' ⥤ D') instance [F.Final] [G.Final] : (F.prod G).Final where out := fun ⟨d, d'⟩ => isConnected_of_equivalent (StructuredArrow.prodEquivalence d d' F G).symm +instance [F.Initial] [G.Initial] : (F.prod G).Initial where + out := fun ⟨d, d'⟩ => isConnected_of_equivalent (CostructuredArrow.prodEquivalence F G d d').symm + end Prod namespace ObjectProperty diff --git a/Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean b/Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean index e0035181a6de23..f442607c91c66f 100644 --- a/Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean +++ b/Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean @@ -199,4 +199,31 @@ instance isCardinalFiltered_under dsimp at this ⊢ simp only [reassoc_of% this, Category.comp_id] } }⟩ +instance isCardinalFiltered_prod (J₁ : Type u) (J₂ : Type u') + [Category.{v} J₁] [Category.{v'} J₂] (κ : Cardinal.{w}) [Fact κ.IsRegular] + [IsCardinalFiltered J₁ κ] [IsCardinalFiltered J₂ κ] : + IsCardinalFiltered (J₁ × J₂) κ where + nonempty_cocone F hC := ⟨by + let c₁ := cocone (F ⋙ Prod.fst _ _) hC + let c₂ := cocone (F ⋙ Prod.snd _ _) hC + exact + { pt := (c₁.pt, c₂.pt) + ι.app i := (c₁.ι.app i, c₂.ι.app i) + ι.naturality i j f := by + ext + · simpa using c₁.w f + · simpa using c₂.w f}⟩ + +instance isCardinalFiltered_pi {ι : Type u'} (J : ι → Type u) [∀ i, Category.{v} (J i)] + (κ : Cardinal.{w}) [Fact κ.IsRegular] [∀ i, IsCardinalFiltered (J i) κ] : + IsCardinalFiltered (∀ i, J i) κ where + nonempty_cocone {C _} F hC := ⟨by + let c (i : ι) := cocone (F ⋙ Pi.eval J i) hC + exact + { pt i := (c i).pt + ι.app X i := (c i).ι.app X + ι.naturality {X Y} f := by + ext i + simpa using (c i).ι.naturality f }⟩ + end CategoryTheory From f33c54b5342c00de1109f203f60e8fffcdb310da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 17 Oct 2025 16:14:54 +0200 Subject: [PATCH 150/309] stacks tags --- Mathlib/CategoryTheory/Presentable/Directed.lean | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Mathlib/CategoryTheory/Presentable/Directed.lean b/Mathlib/CategoryTheory/Presentable/Directed.lean index 018d5af9b959ec..6061353df5f7c3 100644 --- a/Mathlib/CategoryTheory/Presentable/Directed.lean +++ b/Mathlib/CategoryTheory/Presentable/Directed.lean @@ -664,6 +664,7 @@ The general case is obtained by applying the previous result to the cartesian product `J × κ.ord.toType`. -/ +@[stacks 0032] lemma exists_cardinal_directed (J : Type w) [SmallCategory J] (κ : Cardinal.{w}) [Fact κ.IsRegular] [IsCardinalFiltered J κ] : ∃ (α : Type w) (_ : PartialOrder α) (_ : IsCardinalFiltered α κ) @@ -684,6 +685,7 @@ lemma IsFiltered.isDirected (α : Type w) [PartialOrder α] [IsFiltered α] : directed i j := ⟨max i j, leOfHom (leftToMax i j), leOfHom (rightToMax i j)⟩ attribute [local instance] Cardinal.fact_isRegular_aleph0 in +@[stacks 0032] lemma IsFiltered.exists_directed (J : Type w) [SmallCategory J] [IsFiltered J] : ∃ (α : Type w) (_ : PartialOrder α) (_ : IsDirected α (· ≤ ·)) (_ : Nonempty α) From ba18e31558547ee58d14e0b09f0c020bb0802e60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 17 Oct 2025 17:12:11 +0200 Subject: [PATCH 151/309] fix --- .../CategoryTheory/Presentable/Directed.lean | 104 ++---------------- 1 file changed, 8 insertions(+), 96 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/Directed.lean b/Mathlib/CategoryTheory/Presentable/Directed.lean index 6061353df5f7c3..706d6607b8ac0a 100644 --- a/Mathlib/CategoryTheory/Presentable/Directed.lean +++ b/Mathlib/CategoryTheory/Presentable/Directed.lean @@ -45,95 +45,6 @@ lemma CategoryTheory.MorphismProperty.toSet_max {C : Type*} [Category C] (W₁ W₂ : MorphismProperty C) : (W₁ ⊔ W₂).toSet = W₁.toSet ∪ W₂.toSet := rfl -lemma hasCardinalLT_of_finite - (X : Type*) [Finite X] (κ : Cardinal) (hκ : Cardinal.aleph0 ≤ κ) : - HasCardinalLT X κ := - .of_le (by rwa [hasCardinalLT_aleph0_iff]) hκ - -@[simp] -lemma hasCardinalLT_lift_iff (X : Type v) (κ : Cardinal.{w}) : - HasCardinalLT X (Cardinal.lift.{u} κ) ↔ HasCardinalLT X κ := by - simp [HasCardinalLT, ← (Cardinal.lift_strictMono.{max v w, max u}).lt_iff_lt] - -@[simp] -lemma hasCardinalLT_ulift_iff (X : Type v) (κ : Cardinal.{w}) : - HasCardinalLT (ULift.{u} X) κ ↔ HasCardinalLT X κ := - hasCardinalLT_iff_of_equiv Equiv.ulift κ - -lemma Cardinal.IsRegular.lift {κ : Cardinal.{w}} (hκ : κ.IsRegular) : - (Cardinal.lift.{u} κ).IsRegular := by - obtain ⟨h₁, h₂⟩ := hκ - constructor - · simpa - · rwa [← Cardinal.lift_ord, ← Ordinal.lift_cof, lift_le] - -lemma hasCardinalLT_sigma' {ι : Type w} (α : ι → Type w) (κ : Cardinal.{w}) [Fact κ.IsRegular] - (hι : HasCardinalLT ι κ) (hα : ∀ i, HasCardinalLT (α i) κ) : - HasCardinalLT (Σ i, α i) κ := by - simp only [hasCardinalLT_iff_cardinal_mk_lt] at hι hα ⊢ - rw [Cardinal.mk_sigma] - exact Cardinal.sum_lt_lift_of_isRegular.{w, w} Fact.out (by simpa) hα - -lemma hasCardinalLT_sigma {ι : Type u} (α : ι → Type v) (κ : Cardinal.{w}) [Fact κ.IsRegular] - (hι : HasCardinalLT ι κ) (hα : ∀ i, HasCardinalLT (α i) κ) : - HasCardinalLT (Σ i, α i) κ := by - let ι' : Type max u v w := ULift.{max v w} ι - let α' (i : ι') : Type max u v w := ULift.{max u w} (α (ULift.down i)) - let κ' : Cardinal.{max u v w} := Cardinal.lift.{max u v} κ - have : Fact κ'.IsRegular := ⟨Cardinal.IsRegular.lift Fact.out⟩ - have := hasCardinalLT_sigma' α' κ' - (by rwa [hasCardinalLT_lift_iff, hasCardinalLT_ulift_iff]) (fun i ↦ by - rw [hasCardinalLT_lift_iff, hasCardinalLT_ulift_iff] - exact hα _) - rw [hasCardinalLT_lift_iff] at this - exact this.of_surjective (fun ⟨i, a⟩ ↦ ⟨ULift.down i, ULift.down a⟩) - (fun ⟨i, a⟩ ↦ ⟨⟨ULift.up i, ULift.up a⟩, rfl⟩) - -lemma hasCardinalLT_subtype_iSup - {ι : Type*} {X : Type*} (P : ι → X → Prop) {κ : Cardinal} [Fact κ.IsRegular] - (hι : HasCardinalLT ι κ) (hP : ∀ i, HasCardinalLT (Subtype (P i)) κ) : - HasCardinalLT (Subtype (⨆ i, P i)) κ := - (hasCardinalLT_sigma (fun i ↦ Subtype (P i)) κ hι hP).of_surjective - (fun ⟨i, x, hx⟩ ↦ ⟨x, by simp only [iSup_apply, iSup_Prop_eq]; exact ⟨i, hx⟩⟩) (by - rintro ⟨_, h⟩ - simp only [iSup_apply, iSup_Prop_eq] at h - obtain ⟨i, hi⟩ := h - exact ⟨⟨i, _, hi⟩, rfl⟩) - -lemma hasCardinalLT_iUnion - {ι : Type*} {X : Type*} (S : ι → Set X) {κ : Cardinal} [Fact κ.IsRegular] - (hι : HasCardinalLT ι κ) (hS : ∀ i, HasCardinalLT (S i) κ) : - HasCardinalLT (⋃ i, S i) κ := by - convert hasCardinalLT_subtype_iSup S hι hS using 2 - ext x - change _ ↔ ((⨆ i, S i) : X → Prop ) x - aesop - -lemma hasCardinalLT_subtype_max - {X : Type*} {P₁ P₂ : X → Prop} {κ : Cardinal} (hκ : Cardinal.aleph0 ≤ κ) - (h₁ : HasCardinalLT (Subtype P₁) κ) (h₂ : HasCardinalLT (Subtype P₂) κ) : - HasCardinalLT (Subtype (P₁ ⊔ P₂)) κ := by - have : HasCardinalLT (Subtype P₁ ⊕ Subtype P₂) κ := by - rw [hasCardinalLT_sum_iff _ _ _ hκ] - exact ⟨h₁, h₂⟩ - refine this.of_surjective (Sum.elim (fun x ↦ ⟨x.1, Or.inl x.2⟩) - (fun x ↦ ⟨x.1, Or.inr x.2⟩)) ?_ - rintro ⟨x, hx | hx⟩ - · exact ⟨Sum.inl ⟨x, hx⟩, rfl⟩ - · exact ⟨Sum.inr ⟨x, hx⟩, rfl⟩ - -lemma hasCardinalLT_union - {X : Type*} {S₁ S₂ : Set X} {κ : Cardinal} [Fact κ.IsRegular] - (h₁ : HasCardinalLT S₁ κ) (h₂ : HasCardinalLT S₂ κ) : - HasCardinalLT (S₁ ∪ S₂ : Set _) κ := - hasCardinalLT_subtype_max (Cardinal.IsRegular.aleph0_le Fact.out) h₁ h₂ - -lemma hasCardinalLT_prod {T₁ T₂ : Type*} {κ : Cardinal} [Fact κ.IsRegular] - (h₁ : HasCardinalLT T₁ κ) (h₂ : HasCardinalLT T₂ κ) : - HasCardinalLT (T₁ × T₂) κ := - (hasCardinalLT_sigma (fun (t : T₁) ↦ T₂) κ h₁ (fun _ ↦ h₂)).of_surjective - (fun ⟨t₁, t₂⟩ ↦ (t₁, t₂)) (by rintro ⟨t₁, t₂⟩; exact ⟨⟨t₁, t₂⟩, rfl⟩) - section open CategoryTheory Limits @@ -428,8 +339,8 @@ def Diagram.max (D₁ D₂ : Diagram J κ) : rintro _ _ _ (h | h) · exact Or.inl (D₁.tgt h) · exact Or.inr (D₂.tgt h) - hW := hasCardinalLT_union D₁.hW D₂.hW - hP := hasCardinalLT_union D₁.hP D₂.hP + hW := hasCardinalLT_union (Cardinal.IsRegular.aleph0_le Fact.out) D₁.hW D₂.hW + hP := hasCardinalLT_union (Cardinal.IsRegular.aleph0_le Fact.out) D₁.hP D₂.hP variable [IsCardinalFiltered J κ] (hJ : ∀ (e : J), ∃ (m : J) (_ : e ⟶ m), IsEmpty (m ⟶ e)) @@ -461,7 +372,8 @@ lemma isCardinalFiltered_aux (hasCardinalLT_of_finite _ _ (Cardinal.IsRegular.aleph0_le Fact.out)) let T := Σ (i : ι), Subtype (D i).P have hT : HasCardinalLT (ι × T) κ := - hasCardinalLT_prod hι (hasCardinalLT_sigma _ _ hι (fun i ↦ (D i).hP)) + hasCardinalLT_prod (Cardinal.IsRegular.aleph0_le Fact.out) + hι (hasCardinalLT_sigma _ _ hι (fun i ↦ (D i).hP)) refine hT.of_injective (fun ⟨⟨i₁, i₂, j⟩, h₁, h₂⟩ ↦ ⟨i₁, i₂, ⟨j, h₂⟩⟩) ?_ rintro ⟨⟨i₁, i₂, j⟩, _, _⟩ ⟨⟨i₁', i₂', j'⟩, _, _⟩ h rw [Prod.ext_iff, Sigma.ext_iff] at h @@ -505,7 +417,7 @@ lemma isCardinalFiltered : IsCardinalFiltered (DiagramWithTerminal J κ) κ := · exact Or.inr rfl hW := by rw [MorphismProperty.toSet_max] - exact hasCardinalLT_union D₁.hW + exact hasCardinalLT_union (Cardinal.IsRegular.aleph0_le Fact.out) D₁.hW (hasCardinalLT_toSet_morphismPropertyOfHoms _ (hasCardinalLT_sigma _ _ hι (fun i ↦ (D i).hP))) hP := hasCardinalLT_subtype_max (Cardinal.IsRegular.aleph0_le Fact.out) @@ -593,13 +505,13 @@ lemma final_functor : (functor J κ).Final := by · exact D₀.tgt hf · exact Or.inr ⟨⟨⟩⟩ hW := - hasCardinalLT_union - (hasCardinalLT_union D.hW + hasCardinalLT_union (Cardinal.IsRegular.aleph0_le Fact.out) + (hasCardinalLT_union (Cardinal.IsRegular.aleph0_le Fact.out) D.hW (hasCardinalLT_toSet_morphismPropertyOfHoms _ (hasCardinalLT_of_finite _ _ (Cardinal.IsRegular.aleph0_le Fact.out)))) (hasCardinalLT_toSet_morphismPropertyOfHoms _ D.hP) hP := - hasCardinalLT_union D.hP + hasCardinalLT_union (Cardinal.IsRegular.aleph0_le Fact.out) D.hP (hasCardinalLT_subtype_objectPropertyOfObj _ (hasCardinalLT_of_finite _ _ (Cardinal.IsRegular.aleph0_le Fact.out))) } have h₂ {j : J} (hj : D.P j) {f : j ⟶ m₁} (hf : D₁.W f) : From c37429b744e01578d95d408096e9b405f55715cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 17 Oct 2025 21:06:25 +0200 Subject: [PATCH 152/309] cleaning up --- .../Limits/Shapes/Multiequalizer.lean | 25 +++ .../CategoryTheory/Presentable/Directed.lean | 178 ++++++++---------- 2 files changed, 104 insertions(+), 99 deletions(-) diff --git a/Mathlib/CategoryTheory/Limits/Shapes/Multiequalizer.lean b/Mathlib/CategoryTheory/Limits/Shapes/Multiequalizer.lean index 9603cb981d8367..f46a16aa46cfe9 100644 --- a/Mathlib/CategoryTheory/Limits/Shapes/Multiequalizer.lean +++ b/Mathlib/CategoryTheory/Limits/Shapes/Multiequalizer.lean @@ -184,6 +184,31 @@ lemma Hom.id_eq_id (X : WalkingMultispan J) : Hom.id X = 𝟙 X := rfl lemma Hom.comp_eq_comp {X Y Z : WalkingMultispan J} (f : X ⟶ Y) (g : Y ⟶ Z) : Hom.comp f g = f ≫ g := rfl +variable (J) in +/-- The bijection `WalkingMultispan J ≃ J.L ⊕ J.R`. -/ +def equiv : WalkingMultispan J ≃ J.L ⊕ J.R where + toFun x := match x with + | left a => Sum.inl a + | right b => Sum.inr b + invFun := Sum.elim left right + left_inv := by rintro (_ | _) <;> rfl + right_inv := by rintro (_ | _) <;> rfl + +variable (J) in +/-- The bijection `Arrow (WalkingMultispan J) ≃ WalkingMultispan J ⊕ J.R ⊕ J.R`. -/ +def arrowEquiv : + Arrow (WalkingMultispan J) ≃ WalkingMultispan J ⊕ J.L ⊕ J.L where + toFun f := match f.hom with + | .id x => Sum.inl x + | .fst a => Sum.inr (Sum.inl a) + | .snd a => Sum.inr (Sum.inr a) + invFun := + Sum.elim (fun X ↦ Arrow.mk (𝟙 X)) + (Sum.elim (fun a ↦ Arrow.mk (Hom.fst a : left _ ⟶ right _)) + (fun a ↦ Arrow.mk (Hom.snd a : left _ ⟶ right _))) + left_inv := by rintro ⟨_, _, (_ | _ | _)⟩ <;> rfl + right_inv := by rintro (_ | _ | _) <;> rfl + end WalkingMultispan /-- This is a structure encapsulating the data necessary to define a `Multicospan`. -/ diff --git a/Mathlib/CategoryTheory/Presentable/Directed.lean b/Mathlib/CategoryTheory/Presentable/Directed.lean index 706d6607b8ac0a..d1580ab0b50fe2 100644 --- a/Mathlib/CategoryTheory/Presentable/Directed.lean +++ b/Mathlib/CategoryTheory/Presentable/Directed.lean @@ -22,7 +22,7 @@ The construction applies more generally to `κ`-filtered categories and Note: the argument by Deligne is reproduced (without reference) in the book by Adámek and Rosický (theorem 1.5), but with a mistake: the construction by Deligne involves considering diagrams -(see `CategoryTheory.IsCardinalFiltered.exists_cardinal_directed.DiagramWithTerminal`) +(see `CategoryTheory.IsCardinalFiltered.exists_cardinal_directed.DiagramWithUniqueTerminal`) which are not necessarily *subcategories* (the class of morphisms `W` does not have to be multiplicative.) @@ -50,8 +50,7 @@ section open CategoryTheory Limits lemma hasCardinalLT_toSet_morphismPropertyOfHoms {C : Type*} [Category C] - {ι : Type*} {X Y : ι → C} (f : ∀ i, X i ⟶ Y i) - {κ : Cardinal} + {ι : Type*} {X Y : ι → C} (f : ∀ i, X i ⟶ Y i) {κ : Cardinal} (h : HasCardinalLT ι κ) : HasCardinalLT (MorphismProperty.ofHoms f).toSet κ := h.of_surjective (fun i ↦ ⟨Arrow.mk (f i), ⟨i⟩⟩) (by rintro ⟨f, hf⟩ @@ -65,52 +64,12 @@ lemma hasCardinalLT_subtype_objectPropertyOfObj {C : Type*} [Category C] (h : HasCardinalLT ι κ) : HasCardinalLT (Subtype (ObjectProperty.ofObj X)) κ := h.of_surjective (fun i ↦ ⟨X i, by simp⟩) (by rintro ⟨_, ⟨i⟩⟩; exact ⟨i, rfl⟩) -lemma hasCardinalLT_arrow_walkingMultispan {h : MultispanShape} {κ : Cardinal} - [Fact κ.IsRegular] - (h₁ : HasCardinalLT h.L κ) (h₂ : HasCardinalLT h.R κ) : - HasCardinalLT (Arrow (WalkingMultispan h)) κ := by - let T := WalkingMultispan h ⊕ h.L ⊕ h.L - have hT₀ : HasCardinalLT (WalkingMultispan h) κ := by - have : HasCardinalLT (h.L ⊕ h.R) κ := by - rw [hasCardinalLT_sum_iff _ _ _ (Cardinal.IsRegular.aleph0_le Fact.out)] - exact ⟨h₁, h₂⟩ - refine this.of_surjective (Sum.elim WalkingMultispan.left WalkingMultispan.right) ?_ - rintro (x | y) - · exact ⟨Sum.inl x, rfl⟩ - · exact ⟨Sum.inr y, rfl⟩ - have hT : HasCardinalLT T κ := by - rw [hasCardinalLT_sum_iff _ _ _ (Cardinal.IsRegular.aleph0_le Fact.out), - hasCardinalLT_sum_iff _ _ _ (Cardinal.IsRegular.aleph0_le Fact.out)] - exact ⟨hT₀, h₁, h₁⟩ - refine hT.of_surjective (fun t ↦ match t with - | Sum.inl x => Arrow.mk (𝟙 x) - | Sum.inr (Sum.inl z) => Arrow.mk (WalkingMultispan.Hom.fst z) - | Sum.inr (Sum.inr z) => Arrow.mk (WalkingMultispan.Hom.snd z)) ?_ - intro f - obtain ⟨x, y, f, rfl⟩ := f.mk_surjective - obtain (_ | z | z) := f - · exact ⟨Sum.inl x, rfl⟩ - · exact ⟨Sum.inr (Sum.inl z), rfl⟩ - · exact ⟨Sum.inr (Sum.inr z), rfl⟩ - end namespace CategoryTheory open Limits -namespace Functor.Final - -variable {C D : Type*} [Category C] [Category D] - -instance [IsFiltered D] : (Prod.fst C D).Final := by - let F : D ⥤ Discrete PUnit.{1} := (Functor.const _).obj (Discrete.mk .unit) - have hF : F.Final := Functor.final_of_isFiltered_of_pUnit _ - change (Functor.prod (𝟭 C) F ⋙ (prod.rightUnitorEquivalence.{0} C).functor).Final - infer_instance - -end Functor.Final - namespace IsCardinalFiltered instance prod (J₁ J₂ : Type*) [Category J₁] [Category J₂] @@ -136,8 +95,8 @@ variable (J : Type w) [SmallCategory J] (κ : Cardinal.{w}) Let `J` is a `κ`-filtered category. In order to construct a cofinal functor `α ⥤ J` with a `κ`-directed poset `α`, we first consider the case where there is no object `m : J` such that for any object `j : J`, there exists a map `j ⟶ m`. -Under this assumption (`hJ`), the partially ordered type `DiagramWithTerminal J κ` -of `κ`-bounded diagrams with a terminal object in `J` shall be a possible +Under this assumption (`hJ`), the partially ordered type `DiagramWithUniqueTerminal J κ` +of `κ`-bounded diagrams with a unique terminal object in `J` shall be a possible choice for `α`. -/ @@ -212,8 +171,8 @@ end IsTerminal end Diagram /-- If `κ` is a cardinal, this structure contains the data of a `κ`-bounded diagram -with a terminal object in a category `J`. -/ -structure DiagramWithTerminal extends Diagram J κ where +with a unique terminal object in a category `J`. -/ +structure DiagramWithUniqueTerminal extends Diagram J κ where /-- the terminal object -/ top : J /-- `top` is terminal -/ @@ -221,7 +180,7 @@ structure DiagramWithTerminal extends Diagram J κ where uniq_terminal (j : J) (hj : toDiagram.IsTerminal j) : j = top @[ext] -lemma DiagramWithTerminal.ext {D₁ D₂ : DiagramWithTerminal J κ} +lemma DiagramWithUniqueTerminal.ext {D₁ D₂ : DiagramWithUniqueTerminal J κ} (hW : D₁.W = D₂.W) (hP : D₁.P = D₂.P) : D₁ = D₂ := by obtain ⟨D₁, top, h₁, h₁'⟩ := D₁ obtain ⟨D₂, top', h₂, h₂'⟩ := D₂ @@ -230,7 +189,7 @@ lemma DiagramWithTerminal.ext {D₁ D₂ : DiagramWithTerminal J κ} obtain rfl : h₁ = h₂ := by subsingleton rfl -instance : PartialOrder (DiagramWithTerminal J κ) where +instance : PartialOrder (DiagramWithUniqueTerminal J κ) where le D₁ D₂ := D₁.W ≤ D₂.W ∧ D₁.P ≤ D₂.P le_refl _ := ⟨by rfl, by rfl⟩ le_trans _ _ _ h₁ h₂ := ⟨h₁.1.trans h₂.1, h₁.2.trans h₂.2⟩ @@ -244,24 +203,24 @@ section variable {J κ} /-- Auxiliary definition for `functor`. -/ -def functorMap {D₁ D₂ : DiagramWithTerminal J κ} (h : D₁ ≤ D₂) : D₁.top ⟶ D₂.top := +def functorMap {D₁ D₂ : DiagramWithUniqueTerminal J κ} (h : D₁ ≤ D₂) : D₁.top ⟶ D₂.top := D₂.isTerminal.lift (h.2 _ D₁.isTerminal.prop) @[simp] -lemma functorMap_id (D : DiagramWithTerminal J κ) : functorMap (le_refl D) = 𝟙 D.top := by +lemma functorMap_id (D : DiagramWithUniqueTerminal J κ) : functorMap (le_refl D) = 𝟙 D.top := by simp [functorMap] @[reassoc (attr := simp)] -lemma functorMap_comp {D₁ D₂ D₃ : DiagramWithTerminal J κ} (h₁₂ : D₁ ≤ D₂) (h₂₃ : D₂ ≤ D₃) : +lemma functorMap_comp {D₁ D₂ D₃ : DiagramWithUniqueTerminal J κ} (h₁₂ : D₁ ≤ D₂) (h₂₃ : D₂ ≤ D₃) : functorMap h₁₂ ≫ functorMap h₂₃ = functorMap (h₁₂.trans h₂₃) := D₃.isTerminal.comm _ (h₂₃.1 _ (D₂.isTerminal.hlift _)) end -/-- The functor which sends a `κ`-bounded diagram with a terminal object to +/-- The functor which sends a `κ`-bounded diagram with a unique terminal object to its terminal object. -/ @[simps] -def functor : DiagramWithTerminal J κ ⥤ J where +def functor : DiagramWithUniqueTerminal J κ ⥤ J where obj D := D.top map h := functorMap (leOfHom h) @@ -292,16 +251,24 @@ instance (j : J) : Finite (Subtype (Diagram.single (κ := κ) j).P) := (by rintro ⟨_, ⟨⟩⟩; exact ⟨⟨⟩, rfl⟩) variable {J κ} in -/-- The diagram with a terminal object containing a single object (and its identity morphism). -/ -def DiagramWithTerminal.single (j : J) : DiagramWithTerminal J κ where +/-- The diagram with a unique terminal object containing a single object +(and its identity morphism). -/ +noncomputable def DiagramWithUniqueTerminal.single (j : J) : + DiagramWithUniqueTerminal J κ where toDiagram := .single j top := j - isTerminal := - { prop_id := ⟨⟨⟩⟩ - lift := by rintro j hj; simp at hj; subst hj; exact 𝟙 _ - hlift := by rintro j hj; simp at hj; subst hj; exact ⟨⟨⟩⟩ - uniq := by rintro j hj φ hφ; simp at hj; subst hj; obtain ⟨⟨⟩⟩ := hφ; simp - comm := by rintro _ _ f hf; obtain ⟨⟨⟩⟩ := hf; simp } + isTerminal := by + refine .ofExistsUnique ⟨⟨⟩⟩ (fun _ h ↦ ?_) (fun _ h₁ _ _ h₂ h₃ ↦ ? _) (fun _ _ _ h ↦ ?_) + · simp only [Diagram.single_P, ObjectProperty.singleton_iff] at h + subst h + exact ⟨𝟙 _, ⟨⟨⟩⟩⟩ + · simp only [Diagram.single_P, ObjectProperty.singleton_iff] at h₁ + subst h₁ + obtain ⟨⟨⟩⟩ := h₂ + obtain ⟨⟨⟩⟩ := h₃ + simp + · obtain ⟨⟨⟩⟩ := h + exact ⟨𝟙 _, 𝟙 _, ⟨⟨⟩⟩, ⟨⟨⟩⟩, by simp⟩ uniq_terminal := by rintro _ ⟨⟨⟩⟩; rfl variable {J κ} in @@ -312,11 +279,11 @@ def Diagram.iSup {ι : Type*} (D : ι → Diagram J κ) (hι : HasCardinalLT ι W := ⨆ (i : ι), (D i).W P := ⨆ (i : ι), (D i).P src hf := by - simp at hf ⊢ + simp only [MorphismProperty.iSup_iff, iSup_apply, iSup_Prop_eq] at hf ⊢ obtain ⟨i, hi⟩ := hf exact ⟨i, (D i).src hi⟩ tgt hf := by - simp at hf ⊢ + simp only [MorphismProperty.iSup_iff, iSup_apply, iSup_Prop_eq] at hf ⊢ obtain ⟨i, hi⟩ := hf exact ⟨i, (D i).tgt hi⟩ hW := by @@ -348,7 +315,7 @@ variable [IsCardinalFiltered J κ] include hJ lemma isCardinalFiltered_aux - {ι : Type w} (D : ι → DiagramWithTerminal J κ) (hι : HasCardinalLT ι κ) : + {ι : Type w} (D : ι → DiagramWithUniqueTerminal J κ) (hι : HasCardinalLT ι κ) : ∃ (m : J) (u : ∀ i, (D i).top ⟶ m), (∀ (i : ι), IsEmpty (m ⟶ (D i).top)) ∧ ∀ (i₁ i₂ : ι) (j : J) (hj₁ : (D i₁).P j) (hj₂ : (D i₂).P j), (D i₁).isTerminal.lift hj₁ ≫ u i₁ = (D i₂).isTerminal.lift hj₂ ≫ u i₂ := by @@ -367,14 +334,11 @@ lemma isCardinalFiltered_aux right _ := m₁ fst x := (D x.1.1).isTerminal.lift x.2.1 ≫ u x.1.1 snd x := (D x.1.2.1).isTerminal.lift x.2.2 ≫ u x.1.2.1 } - have hshape : HasCardinalLT (Arrow (WalkingMultispan shape)) κ := by - refine hasCardinalLT_arrow_walkingMultispan ?_ - (hasCardinalLT_of_finite _ _ (Cardinal.IsRegular.aleph0_le Fact.out)) - let T := Σ (i : ι), Subtype (D i).P - have hT : HasCardinalLT (ι × T) κ := - hasCardinalLT_prod (Cardinal.IsRegular.aleph0_le Fact.out) - hι (hasCardinalLT_sigma _ _ hι (fun i ↦ (D i).hP)) - refine hT.of_injective (fun ⟨⟨i₁, i₂, j⟩, h₁, h₂⟩ ↦ ⟨i₁, i₂, ⟨j, h₂⟩⟩) ?_ + have hκ : Cardinal.aleph0 ≤ κ := Cardinal.IsRegular.aleph0_le Fact.out + have hL : HasCardinalLT shape.L κ := by + have : HasCardinalLT (ι × (Σ (i : ι), Subtype (D i).P)) κ := + hasCardinalLT_prod hκ hι (hasCardinalLT_sigma _ _ hι (fun i ↦ (D i).hP)) + refine this.of_injective (fun ⟨⟨i₁, i₂, j⟩, h₁, h₂⟩ ↦ ⟨i₁, i₂, ⟨j, h₂⟩⟩) ?_ rintro ⟨⟨i₁, i₂, j⟩, _, _⟩ ⟨⟨i₁', i₂', j'⟩, _, _⟩ h rw [Prod.ext_iff, Sigma.ext_iff] at h dsimp at h @@ -382,13 +346,21 @@ lemma isCardinalFiltered_aux obtain rfl : i₂ = i₂' := h.2.1 obtain rfl : j = j' := by simpa using h rfl + have hR : HasCardinalLT shape.R κ := hasCardinalLT_of_finite _ _ hκ + have hshape : HasCardinalLT (Arrow (WalkingMultispan shape)) κ := by + rw [hasCardinalLT_iff_of_equiv (WalkingMultispan.arrowEquiv shape), + hasCardinalLT_sum_iff _ _ _ hκ, hasCardinalLT_sum_iff _ _ _ hκ, + hasCardinalLT_iff_of_equiv (WalkingMultispan.equiv shape), + hasCardinalLT_sum_iff _ _ _ hκ] + refine ⟨⟨?_, ?_⟩, ?_, ?_⟩ <;> assumption let c : Multicofork _ := IsCardinalFiltered.cocone index.multispan hshape exact ⟨c.pt, fun i ↦ u i ≫ c.π ⟨⟩, fun i ↦ ⟨fun hi ↦ (hm₀ i).false (t₁ i ≫ c.π ⟨⟩ ≫ hi)⟩, fun i₁ i₂ j h₁ h₂ ↦ by simpa [index, shape] using c.condition ⟨⟨i₁, i₂, j⟩, h₁, h₂⟩⟩ -lemma isCardinalFiltered : IsCardinalFiltered (DiagramWithTerminal J κ) κ := +lemma isCardinalFiltered : IsCardinalFiltered (DiagramWithUniqueTerminal J κ) κ := isCardinalFiltered_preorder _ _ (fun ι D hι ↦ by + have hκ : Cardinal.aleph0 ≤ κ := Cardinal.IsRegular.aleph0_le Fact.out simp only [← hasCardinalLT_iff_cardinal_mk_lt] at hι obtain ⟨m, u, hm₀, hm⟩ := isCardinalFiltered_aux J κ hJ D hι let φ (x : (Σ (i : ι), (Subtype (D i).P))) : x.2.1 ⟶ m := @@ -400,34 +372,37 @@ lemma isCardinalFiltered : IsCardinalFiltered (DiagramWithTerminal J κ) κ := { W := D₁.W ⊔ .ofHoms φ P := D₁.P src := by - simp [D₁, D₀] + simp only [Diagram.max_W, Diagram.iSup_W, Diagram.single_W, Diagram.max_P, Pi.sup_apply, + Diagram.iSup_P, iSup_apply, iSup_Prop_eq, Diagram.single_P, + ObjectProperty.singleton_iff, sup_Prop_eq, D₁, D₀] rintro _ _ _ ((hf | ⟨⟨⟩⟩) | ⟨i, j, hj⟩) - · simp at hf + · simp only [MorphismProperty.iSup_iff] at hf obtain ⟨i, hf⟩ := hf exact Or.inl ⟨i, (D i).src hf⟩ · exact Or.inr rfl · exact Or.inl ⟨i, hj⟩ tgt := by - simp [D₁, D₀] + simp only [Diagram.max_W, Diagram.iSup_W, Diagram.single_W, Diagram.max_P, Pi.sup_apply, + Diagram.iSup_P, iSup_apply, iSup_Prop_eq, Diagram.single_P, + ObjectProperty.singleton_iff, sup_Prop_eq, D₁, D₀] rintro _ _ _ ((hf | ⟨⟨⟩⟩) | ⟨i, j, hj⟩) - · simp at hf + · simp only [MorphismProperty.iSup_iff] at hf obtain ⟨i, hf⟩ := hf exact Or.inl ⟨i, (D i).tgt hf⟩ · exact Or.inr rfl · exact Or.inr rfl hW := by rw [MorphismProperty.toSet_max] - exact hasCardinalLT_union (Cardinal.IsRegular.aleph0_le Fact.out) D₁.hW + exact hasCardinalLT_union hκ D₁.hW (hasCardinalLT_toSet_morphismPropertyOfHoms _ (hasCardinalLT_sigma _ _ hι (fun i ↦ (D i).hP))) - hP := hasCardinalLT_subtype_max (Cardinal.IsRegular.aleph0_le Fact.out) + hP := hasCardinalLT_subtype_max hκ (hasCardinalLT_subtype_iSup _ hι (fun i ↦ (D i).hP)) - (hasCardinalLT_of_finite _ _ (Cardinal.IsRegular.aleph0_le Fact.out)) - } + (hasCardinalLT_of_finite _ _ hκ) } have hD₂ {f : m ⟶ m} (hf : D₂.W f) : f = 𝟙 _ := by - simp [D₂, D₁, D₀] at hf + simp only [Diagram.max_W, Diagram.iSup_W, Diagram.single_W, D₁, D₀, D₂] at hf obtain ((hf | ⟨⟨⟩⟩) | hf) := hf - · simp at hf + · simp only [MorphismProperty.iSup_iff] at hf obtain ⟨i, hi⟩ := hf exact (hD ((D i).src hi)).elim · rfl @@ -438,40 +413,44 @@ lemma isCardinalFiltered : IsCardinalFiltered (DiagramWithTerminal J κ) κ := let he : D₂.IsTerminal m := by have H {i : ι} {j : J} (hj : (D i).P j) {f : j ⟶ m} (hf : D₂.W f) : f = φ ⟨i, ⟨_, hj⟩⟩ := by - simp [D₂, D₁, D₀] at hf + simp only [Diagram.max_W, Diagram.iSup_W, Diagram.single_W, D₁, D₀, D₂] at hf obtain ((hf | ⟨⟨⟩⟩) | ⟨⟨i', j, hj'⟩⟩) := hf - · simp at hf + · simp only [MorphismProperty.iSup_iff] at hf obtain ⟨i, hf⟩ := hf exact (hD ((D i).tgt hf)).elim · exact (hD hj).elim · apply hm refine .ofExistsUnique ?_ ?_ ?_ ?_ · exact Or.inl (Or.inr ⟨⟨⟩⟩) - · simp [D₂, D₁, D₀] + · simp only [Diagram.max_P, Pi.sup_apply, Diagram.iSup_P, iSup_apply, iSup_Prop_eq, + Diagram.single_P, ObjectProperty.singleton_iff, sup_Prop_eq, Diagram.max_W, + Diagram.iSup_W, Diagram.single_W, D₁, D₀, D₂] rintro j (⟨i, hi⟩ | rfl) · exact ⟨φ ⟨i, _, hi⟩, Or.inr (.mk _)⟩ · exact ⟨𝟙 _, Or.inl (Or.inr ⟨⟨⟩⟩)⟩ · intro j hj l₁ l₂ hl₁ hl₂ - simp [D₂, D₁, D₀] at hj + simp only [Diagram.max_P, Pi.sup_apply, Diagram.iSup_P, iSup_apply, iSup_Prop_eq, + Diagram.single_P, ObjectProperty.singleton_iff, sup_Prop_eq, D₁, D₀, D₂] at hj obtain (⟨i, hj⟩ | rfl) := hj · obtain rfl := H hj hl₁ obtain rfl := H hj hl₂ rfl · rw [hD₂ hl₁, hD₂ hl₂] · rintro j k f ((hf | ⟨⟨⟩⟩) | ⟨⟨i, j, hj⟩⟩) - · simp [D₀] at hf + · simp only [Diagram.iSup_W, MorphismProperty.iSup_iff, D₀] at hf obtain ⟨i, hf⟩ := hf exact ⟨φ ⟨i, j, (D i).src hf⟩, φ ⟨i, k, (D i).tgt hf⟩, Or.inr ⟨_⟩, Or.inr ⟨_⟩, by simp [φ, (D i).isTerminal.comm_assoc _ hf]⟩ · exact ⟨𝟙 _, 𝟙 _, Or.inl (Or.inr ⟨⟨⟩⟩), Or.inl (Or.inr ⟨⟨⟩⟩), by simp⟩ · exact ⟨φ ⟨i, j, hj⟩, 𝟙 _, Or.inr ⟨_⟩, Or.inl (Or.inr ⟨⟨⟩⟩), by simp⟩ - let D₂' : DiagramWithTerminal J κ := + let D₂' : DiagramWithUniqueTerminal J κ := { toDiagram := D₂ top := _ isTerminal := he uniq_terminal j hj := by have := hj.prop - simp [D₂, D₁, D₀] at this + simp only [Diagram.max_P, Pi.sup_apply, Diagram.iSup_P, iSup_apply, iSup_Prop_eq, + Diagram.single_P, ObjectProperty.singleton_iff, sup_Prop_eq, D₁, D₀, D₂] at this obtain (⟨i, hi⟩ | rfl) := this · exfalso exact (hm₀ i).false (hj.lift (by simp [D₂, D₁]) ≫ (D i).isTerminal.lift hi) @@ -481,9 +460,10 @@ lemma isCardinalFiltered : IsCardinalFiltered (DiagramWithTerminal J κ) κ := · exact le_trans (le_trans (by rfl) (le_iSup _ i)) le_sup_left) lemma final_functor : (functor J κ).Final := by + have hκ : Cardinal.aleph0 ≤ κ := Cardinal.IsRegular.aleph0_le Fact.out have := isCardinalFiltered J κ hJ have := isFiltered_of_isCardinalFiltered J κ - have := isFiltered_of_isCardinalFiltered (DiagramWithTerminal J κ) κ + have := isFiltered_of_isCardinalFiltered (DiagramWithUniqueTerminal J κ) κ rw [Functor.final_iff_of_isFiltered] refine ⟨fun j ↦ ⟨.single j, ⟨𝟙 _⟩⟩, fun {j D} (f₁ f₂ : j ⟶ D.top) ↦ ?_⟩ obtain ⟨m₀, t, hm₀⟩ := hJ D.top @@ -505,15 +485,15 @@ lemma final_functor : (functor J κ).Final := by · exact D₀.tgt hf · exact Or.inr ⟨⟨⟩⟩ hW := - hasCardinalLT_union (Cardinal.IsRegular.aleph0_le Fact.out) - (hasCardinalLT_union (Cardinal.IsRegular.aleph0_le Fact.out) D.hW + hasCardinalLT_union hκ + (hasCardinalLT_union hκ D.hW (hasCardinalLT_toSet_morphismPropertyOfHoms _ - (hasCardinalLT_of_finite _ _ (Cardinal.IsRegular.aleph0_le Fact.out)))) + (hasCardinalLT_of_finite _ _ hκ))) (hasCardinalLT_toSet_morphismPropertyOfHoms _ D.hP) hP := - hasCardinalLT_union (Cardinal.IsRegular.aleph0_le Fact.out) D.hP + hasCardinalLT_union hκ D.hP (hasCardinalLT_subtype_objectPropertyOfObj _ - (hasCardinalLT_of_finite _ _ (Cardinal.IsRegular.aleph0_le Fact.out))) } + (hasCardinalLT_of_finite _ _ hκ)) } have h₂ {j : J} (hj : D.P j) {f : j ⟶ m₁} (hf : D₁.W f) : f = φ ⟨_, hj⟩ := by obtain ((hf | ⟨⟨⟩⟩) | ⟨⟨⟩⟩) := hf @@ -545,7 +525,7 @@ lemma final_functor : (functor J κ).Final := by · exact ⟨φ ⟨_, hj⟩, 𝟙 _, Or.inr ⟨_⟩, Or.inl (Or.inr ⟨⟨⟩⟩), by simp⟩) have lift_eq (j : J) (hj : D.P j) : hm₁.lift (Or.inl hj) = φ ⟨_, hj⟩ := hm₁.uniq _ (Or.inr ⟨_⟩) - let D₁' : DiagramWithTerminal J κ := + let D₁' : DiagramWithUniqueTerminal J κ := { toDiagram := D₁ top := m₁ isTerminal := hm₁ @@ -559,7 +539,7 @@ lemma final_functor : (functor J κ).Final := by lemma aux : ∃ (α : Type w) (_ : PartialOrder α) (_ : IsCardinalFiltered α κ) (F : α ⥤ J), F.Final := - ⟨DiagramWithTerminal J κ, _, isCardinalFiltered J κ hJ, + ⟨DiagramWithUniqueTerminal J κ, _, isCardinalFiltered J κ hJ, functor J κ, final_functor J κ hJ⟩ end exists_cardinal_directed From 7843365a35ee8e91ec743955a8d95b825387b328 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 17 Oct 2025 21:26:10 +0200 Subject: [PATCH 153/309] better syntax --- Mathlib/SetTheory/Cardinal/HasCardinalLT.lean | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Mathlib/SetTheory/Cardinal/HasCardinalLT.lean b/Mathlib/SetTheory/Cardinal/HasCardinalLT.lean index 85a1a133ec2182..2477ab3fbcc6bf 100644 --- a/Mathlib/SetTheory/Cardinal/HasCardinalLT.lean +++ b/Mathlib/SetTheory/Cardinal/HasCardinalLT.lean @@ -168,9 +168,7 @@ lemma hasCardinalLT_iUnion {ι : Type*} {X : Type*} (S : ι → Set X) {κ : Cardinal} [Fact κ.IsRegular] (hι : HasCardinalLT ι κ) (hS : ∀ i, HasCardinalLT (S i) κ) : HasCardinalLT (⋃ i, S i) κ := by - convert hasCardinalLT_subtype_iSup S hι hS using 2 - ext x - change _ ↔ ((⨆ i, S i) : X → Prop) x + convert show HasCardinalLT (setOf ((⨆ i, S i))) κ from hasCardinalLT_subtype_iSup S hι hS aesop /-- The particular case of `hasCardinatLT_prod` when all the inputs are in the From 432e1b9d764f853b82b280a388fa0177c3f75901 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sun, 19 Oct 2025 20:34:21 +0200 Subject: [PATCH 154/309] feat(Order/Category): partial orders with order embeddings as morphisms --- Mathlib.lean | 1 + Mathlib/Order/Category/PartOrdEmb.lean | 168 +++++++++++++++++++++++++ 2 files changed, 169 insertions(+) create mode 100644 Mathlib/Order/Category/PartOrdEmb.lean diff --git a/Mathlib.lean b/Mathlib.lean index 67fd32073cded9..6e21f4e7ade0a9 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -5087,6 +5087,7 @@ import Mathlib.Order.Category.LinOrd import Mathlib.Order.Category.NonemptyFinLinOrd import Mathlib.Order.Category.OmegaCompletePartialOrder import Mathlib.Order.Category.PartOrd +import Mathlib.Order.Category.PartOrdEmb import Mathlib.Order.Category.Preord import Mathlib.Order.Category.Semilat import Mathlib.Order.Chain diff --git a/Mathlib/Order/Category/PartOrdEmb.lean b/Mathlib/Order/Category/PartOrdEmb.lean new file mode 100644 index 00000000000000..f0b37c5520e19c --- /dev/null +++ b/Mathlib/Order/Category/PartOrdEmb.lean @@ -0,0 +1,168 @@ +/- +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, Johan Commelin +-/ +import Mathlib.Order.Category.PartOrd + +/-! +# Category of partial orders, with order embeddings as morphisms + +This defines `PartOrd`, the category of partial orders with order embeddings +as morphisms. + +-/ + +open CategoryTheory + +universe u + +/-- The category of partial orders. -/ +structure PartOrdEmb where + /-- The underlying partially ordered type. -/ + (carrier : Type*) + [str : PartialOrder carrier] + +attribute [instance] PartOrdEmb.str + +initialize_simps_projections PartOrdEmb (carrier → coe, -str) + +namespace PartOrdEmb + +instance : CoeSort PartOrdEmb (Type _) := + ⟨PartOrdEmb.carrier⟩ + +attribute [coe] PartOrdEmb.carrier + +/-- Construct a bundled `PartOrdEmb` from the underlying type and typeclass. -/ +abbrev of (X : Type*) [PartialOrder X] : PartOrdEmb := ⟨X⟩ + +/-- The type of morphisms in `PartOrdEmb R`. -/ +@[ext] +structure Hom (X Y : PartOrdEmb.{u}) where + private mk :: + /-- The underlying `OrderEmbedding`. -/ + hom' : X ↪o Y + +instance : Category PartOrdEmb.{u} where + Hom X Y := Hom X Y + id _ := ⟨RelEmbedding.refl _⟩ + comp f g := ⟨f.hom'.trans g.hom'⟩ + +instance : ConcreteCategory PartOrdEmb (· ↪o ·) where + hom := Hom.hom' + ofHom := Hom.mk + +/-- Turn a morphism in `PartOrdEmb` back into a `OrderEmbedding`. -/ +abbrev Hom.hom {X Y : PartOrdEmb.{u}} (f : Hom X Y) := + ConcreteCategory.hom (C := PartOrdEmb) f + +/-- Typecheck a `OrderEmbedding` as a morphism in `PartOrdEmb`. -/ +abbrev ofHom {X Y : Type u} [PartialOrder X] [PartialOrder Y] (f : X ↪o Y) : of X ⟶ of Y := + ConcreteCategory.ofHom (C := PartOrdEmb) f + +variable {R} in +/-- Use the `ConcreteCategory.hom` projection for `@[simps]` lemmas. -/ +def Hom.Simps.hom (X Y : PartOrdEmb.{u}) (f : Hom X Y) := + f.hom + +initialize_simps_projections Hom (hom' → hom) + +/-! +The results below duplicate the `ConcreteCategory` simp lemmas, but we can keep them for `dsimp`. +-/ + +@[simp] +lemma coe_id {X : PartOrdEmb} : (𝟙 X : X → X) = id := rfl + +@[simp] +lemma coe_comp {X Y Z : PartOrdEmb} {f : X ⟶ Y} {g : Y ⟶ Z} : (f ≫ g : X → Z) = g ∘ f := rfl + +@[simp] +lemma forget_map {X Y : PartOrdEmb} (f : X ⟶ Y) : + (forget PartOrdEmb).map f = f := rfl + +@[ext] +lemma ext {X Y : PartOrdEmb} {f g : X ⟶ Y} (w : ∀ x : X, f x = g x) : f = g := + ConcreteCategory.hom_ext _ _ w + +-- This is not `simp` to avoid rewriting in types of terms. +theorem coe_of (X : Type u) [PartialOrder X] : (PartOrdEmb.of X : Type u) = X := rfl + +lemma hom_id {X : PartOrdEmb} : (𝟙 X : X ⟶ X).hom = RelEmbedding.refl _ := rfl + +/- Provided for rewriting. -/ +lemma id_apply (X : PartOrdEmb) (x : X) : + (𝟙 X : X ⟶ X) x = x := by simp + +@[simp] +lemma hom_comp {X Y Z : PartOrdEmb} (f : X ⟶ Y) (g : Y ⟶ Z) : + (f ≫ g).hom = f.hom.trans g.hom := rfl + +/- Provided for rewriting. -/ +lemma comp_apply {X Y Z : PartOrdEmb} (f : X ⟶ Y) (g : Y ⟶ Z) (x : X) : + (f ≫ g) x = g (f x) := by simp + +lemma Hom.injective {X Y : PartOrdEmb.{u}} (f : X ⟶ Y) : Function.Injective f := + f.hom'.injective + +@[ext] +lemma hom_ext {X Y : PartOrdEmb} {f g : X ⟶ Y} (hf : f.hom = g.hom) : f = g := + Hom.ext hf + +@[simp] +lemma hom_ofHom {X Y : Type u} [PartialOrder X] [PartialOrder Y] (f : X ↪o Y) : + (ofHom f).hom = f := + rfl + +@[simp] +lemma ofHom_hom {X Y : PartOrdEmb} (f : X ⟶ Y) : ofHom (Hom.hom f) = f := rfl + +@[simp] +lemma ofHom_id {X : Type u} [PartialOrder X] : ofHom (RelEmbedding.refl _) = 𝟙 (of X) := rfl + +@[simp] +lemma ofHom_comp {X Y Z : Type u} [PartialOrder X] [PartialOrder Y] [PartialOrder Z] + (f : X ↪o Y) (g : Y ↪o Z) : + ofHom (f.trans g) = ofHom f ≫ ofHom g := + rfl + +lemma ofHom_apply {X Y : Type u} [PartialOrder X] [PartialOrder Y] (f : X ↪o Y) (x : X) : + (ofHom f) x = f x := rfl + +lemma inv_hom_apply {X Y : PartOrdEmb} (e : X ≅ Y) (x : X) : e.inv (e.hom x) = x := by + simp + +lemma hom_inv_apply {X Y : PartOrdEmb} (e : X ≅ Y) (s : Y) : e.hom (e.inv s) = s := by + simp + +instance hasForgetToPartOrd : HasForget₂ PartOrdEmb PartOrd where + forget₂.obj X := .of X + forget₂.map f := PartOrd.ofHom f.hom + +/-- Constructs an equivalence between partial orders from an order isomorphism between them. -/ +@[simps] +def Iso.mk {α β : PartOrdEmb.{u}} (e : α ≃o β) : α ≅ β where + hom := ofHom e + inv := ofHom e.symm + +/-- `OrderDual` as a functor. -/ +@[simps map] +def dual : PartOrdEmb ⥤ PartOrdEmb where + obj X := of Xᵒᵈ + map f := ofHom f.hom.dual + +/-- The equivalence between `PartOrdEmb` and itself induced by `OrderDual` both ways. -/ +@[simps functor inverse] +def dualEquiv : PartOrdEmb ≌ PartOrdEmb where + functor := dual + inverse := dual + unitIso := NatIso.ofComponents fun X => Iso.mk <| OrderIso.dualDual X + counitIso := NatIso.ofComponents fun X => Iso.mk <| OrderIso.dualDual X + +end PartOrdEmb + +theorem partOrdEmb_dual_comp_forget_to_pardOrd : + PartOrdEmb.dual ⋙ forget₂ PartOrdEmb PartOrd = + forget₂ PartOrdEmb PartOrd ⋙ PartOrd.dual := + rfl From 2facfab6ddb486516d29de80e5384b21a8bd1f69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sun, 19 Oct 2025 22:01:10 +0200 Subject: [PATCH 155/309] feat(Order/Category): PartOrdEmb has filtering colimits --- Mathlib/Order/Category/PartOrdEmb.lean | 107 ++++++++++++++++++++++++- 1 file changed, 105 insertions(+), 2 deletions(-) diff --git a/Mathlib/Order/Category/PartOrdEmb.lean b/Mathlib/Order/Category/PartOrdEmb.lean index f0b37c5520e19c..27827f0dd0d669 100644 --- a/Mathlib/Order/Category/PartOrdEmb.lean +++ b/Mathlib/Order/Category/PartOrdEmb.lean @@ -4,16 +4,17 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou, Johan Commelin -/ import Mathlib.Order.Category.PartOrd +import Mathlib.CategoryTheory.Limits.Types.Filtered /-! # Category of partial orders, with order embeddings as morphisms -This defines `PartOrd`, the category of partial orders with order embeddings +This defines `PartOrdEmb`, the category of partial orders with order embeddings as morphisms. -/ -open CategoryTheory +open CategoryTheory Limits universe u @@ -106,6 +107,10 @@ lemma comp_apply {X Y Z : PartOrdEmb} (f : X ⟶ Y) (g : Y ⟶ Z) (x : X) : lemma Hom.injective {X Y : PartOrdEmb.{u}} (f : X ⟶ Y) : Function.Injective f := f.hom'.injective +lemma Hom.le_iff {X Y : PartOrdEmb.{u}} (f : X ⟶ Y) (x₁ x₂ : X) : + f x₁ ≤ f x₂ ↔ x₁ ≤ x₂ := + f.hom'.map_rel_iff + @[ext] lemma hom_ext {X Y : PartOrdEmb} {f g : X ⟶ Y} (hf : f.hom = g.hom) : f = g := Hom.ext hf @@ -166,3 +171,101 @@ theorem partOrdEmb_dual_comp_forget_to_pardOrd : PartOrdEmb.dual ⋙ forget₂ PartOrdEmb PartOrd = forget₂ PartOrdEmb PartOrd ⋙ PartOrd.dual := rfl + +namespace PartOrdEmb + +variable {J : Type u} [SmallCategory J] [IsFiltered J] {F : J ⥤ PartOrdEmb.{u}} + +namespace Limits + +variable {c : Cocone (F ⋙ forget _)} (hc : IsColimit c) + +@[nolint unusedArguments] +def CoconePt (_ : IsColimit c) : Type u := c.pt + +open IsFiltered + +instance : PartialOrder (CoconePt hc) where + le x y := ∃ (j : J) (x' y' : F.obj j) (hx : c.ι.app j x' = x) + (hy : c.ι.app j y' = y), x' ≤ y' + le_refl x := by + obtain ⟨j, x', hx⟩ := Types.jointly_surjective_of_isColimit hc x + exact ⟨j, x', x', hx, hx, le_rfl⟩ + le_trans := by + rintro x y z ⟨j, x₁, y₁, hx₁, hy₁, hxy⟩ ⟨k, y₂, z₁, hy₂, hz₁, hyz⟩ + obtain ⟨l, a, b, h⟩ := + (Types.FilteredColimit.isColimit_eq_iff _ hc (xi := y₁) (xj := y₂)).1 + (hy₁.trans hy₂.symm) + exact ⟨l, F.map a x₁, F.map b z₁, + (ConcreteCategory.congr_hom (c.w a) x₁).trans hx₁, + (ConcreteCategory.congr_hom (c.w b) z₁).trans hz₁, + ((F.map a).hom.monotone hxy).trans + (le_of_eq_of_le h ((F.map b).hom.monotone hyz))⟩ + le_antisymm := by + rintro x y ⟨j, x₁, y₁, hx₁, hy₁, h₁⟩ ⟨k, y₂, x₂, hy₂, hx₂, h₂⟩ + obtain ⟨l, a, b, x₃, y₃, h₃, h₄, h₅, h₆⟩ : + ∃ (l : J) (a : j ⟶ l) (b : k ⟶ l) (x₃ y₃ : _), + x₃ = F.map a x₁ ∧ x₃ = F.map b x₂ ∧ y₃ = F.map a y₁ ∧ y₃ = F.map b y₂ := by + obtain ⟨l₁, a, b, h₃⟩ := + (Types.FilteredColimit.isColimit_eq_iff _ hc (xi := x₁) (xj := x₂)).1 + (hx₁.trans hx₂.symm) + obtain ⟨l₂, a', b', h₄⟩ := + (Types.FilteredColimit.isColimit_eq_iff _ hc (xi := y₁) (xj := y₂)).1 + (hy₁.trans hy₂.symm) + obtain ⟨l, c, c', h₅, h₆⟩ := IsFiltered.bowtie a a' b b' + exact ⟨l, a ≫ c, b ≫ c, F.map (a ≫ c) x₁, F.map (a' ≫ c') y₁, rfl, + by simpa, by rw [h₅], by simpa [h₆]⟩ + have h₇ : x₃ = y₃ := + le_antisymm + (by simpa only [h₃, h₅] using (F.map a).hom.monotone h₁) + (by simpa only [h₄, h₆] using (F.map b).hom.monotone h₂) + exact hx₁.symm.trans ((ConcreteCategory.congr_hom (c.w a) x₁).symm.trans + ((congr_arg (c.ι.app l) (h₃.symm.trans (h₇.trans h₅))).trans + ((ConcreteCategory.congr_hom (c.w a) y₁).trans hy₁))) + +@[simps] +def cocone : Cocone F where + pt := .of (CoconePt hc) + ι.app j := ofHom + { toFun := c.ι.app j + inj' x y h := by + obtain ⟨k, a, ha⟩ := (Types.FilteredColimit.isColimit_eq_iff' hc x y).1 h + exact (F.map a).injective ha + map_rel_iff' {x y} := by + refine ⟨?_, fun h ↦ ⟨j, x, y, rfl, rfl, h⟩⟩ + rintro ⟨k, x', y', hx', hy', h⟩ + sorry } + ι.naturality _ _ f := by ext x; exact ConcreteCategory.congr_hom (c.w f) x + +def CoconePt.desc (s : Cocone F) : CoconePt hc ↪o s.pt where + toFun := hc.desc ((forget _).mapCocone s) + inj' x y h := by + obtain ⟨j, x', y', rfl, rfl⟩ : + ∃ (j : J) (x' y' : F.obj j), c.ι.app j x' = x ∧ c.ι.app j y' = y := by + sorry + have := ((congr_fun (hc.fac ((forget _).mapCocone s) j) x').symm.trans h).trans + (congr_fun (hc.fac ((forget _).mapCocone s) j) y') + obtain rfl := (s.ι.app j).injective this + rfl + map_rel_iff' := sorry + +@[simp] +lemma CoconePt.fac_apply (s : Cocone F) (j : J) (x : F.obj j) : + CoconePt.desc hc s (c.ι.app j x) = s.ι.app j x := + congr_fun (hc.fac ((forget _).mapCocone s) j) x + +def isColimitCocone : IsColimit (cocone hc) where + desc s := ofHom (CoconePt.desc hc s) + uniq s m hm := by + ext x + obtain ⟨j, x, rfl⟩ := Types.jointly_surjective_of_isColimit hc x + exact ((ConcreteCategory.congr_hom (hm j)) x).trans (CoconePt.fac_apply hc s j x).symm + +instance : HasColimit F where + exists_colimit := ⟨_, isColimitCocone (colimit.isColimit (F ⋙ forget _))⟩ + +instance : HasColimitsOfShape J PartOrdEmb.{u} where + +end Limits + +end PartOrdEmb From ff653e1b8103cfaf5ef8877b9a00d35c0ef72356 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Mon, 20 Oct 2025 06:57:04 +0200 Subject: [PATCH 156/309] sorry free --- .../CategoryTheory/Limits/Types/Filtered.lean | 10 +++ Mathlib/Order/Category/PartOrdEmb.lean | 76 +++++++++++++++---- 2 files changed, 71 insertions(+), 15 deletions(-) diff --git a/Mathlib/CategoryTheory/Limits/Types/Filtered.lean b/Mathlib/CategoryTheory/Limits/Types/Filtered.lean index aeabaeef779d3b..0b9b47cf1cafdc 100644 --- a/Mathlib/CategoryTheory/Limits/Types/Filtered.lean +++ b/Mathlib/CategoryTheory/Limits/Types/Filtered.lean @@ -152,4 +152,14 @@ theorem colimit_eq_iff [HasColimit F] {i j : J} {xi : F.obj i} {xj : F.obj j} : ∃ (k : _) (f : i ⟶ k) (g : j ⟶ k), F.map f xi = F.map g xj := isColimit_eq_iff _ (colimit.isColimit F) +open IsFiltered in +variable {F} in +lemma jointly_surjective_of_isColimit₂ + {t : Cocone F} (ht : IsColimit t) (x₁ x₂ : t.pt) : + ∃ (j : J) (x₁' x₂' : F.obj j), t.ι.app j x₁' = x₁ ∧ t.ι.app j x₂' = x₂ := by + obtain ⟨j₁, x₁, rfl⟩ := Types.jointly_surjective_of_isColimit ht x₁ + obtain ⟨j₂, x₂, rfl⟩ := Types.jointly_surjective_of_isColimit ht x₂ + exact ⟨max j₁ j₂, F.map (leftToMax _ _) x₁, F.map (rightToMax _ _) x₂, + congr_fun (t.w (leftToMax j₁ j₂)) x₁, congr_fun (t.w (rightToMax j₁ j₂)) x₂⟩ + end CategoryTheory.Limits.Types.FilteredColimit diff --git a/Mathlib/Order/Category/PartOrdEmb.lean b/Mathlib/Order/Category/PartOrdEmb.lean index 27827f0dd0d669..a757570069a1ce 100644 --- a/Mathlib/Order/Category/PartOrdEmb.lean +++ b/Mathlib/Order/Category/PartOrdEmb.lean @@ -5,12 +5,14 @@ Authors: Joël Riou, Johan Commelin -/ import Mathlib.Order.Category.PartOrd import Mathlib.CategoryTheory.Limits.Types.Filtered +import Mathlib.CategoryTheory.Limits.Preserves.Filtered +import Mathlib.CategoryTheory.Limits.Filtered /-! # Category of partial orders, with order embeddings as morphisms This defines `PartOrdEmb`, the category of partial orders with order embeddings -as morphisms. +as morphisms. We also show that `PartOrdEmb` has filtered colimits. -/ @@ -107,9 +109,9 @@ lemma comp_apply {X Y Z : PartOrdEmb} (f : X ⟶ Y) (g : Y ⟶ Z) (x : X) : lemma Hom.injective {X Y : PartOrdEmb.{u}} (f : X ⟶ Y) : Function.Injective f := f.hom'.injective -lemma Hom.le_iff {X Y : PartOrdEmb.{u}} (f : X ⟶ Y) (x₁ x₂ : X) : +lemma Hom.le_iff_le {X Y : PartOrdEmb.{u}} (f : X ⟶ Y) (x₁ x₂ : X) : f x₁ ≤ f x₂ ↔ x₁ ≤ x₂ := - f.hom'.map_rel_iff + f.hom'.le_iff_le @[ext] lemma hom_ext {X Y : PartOrdEmb} {f g : X ⟶ Y} (hf : f.hom = g.hom) : f = g := @@ -180,6 +182,9 @@ namespace Limits variable {c : Cocone (F ⋙ forget _)} (hc : IsColimit c) +/-- Given a functor `F : J ⥤ PartOrdEmb` and a colimit cocone `c` for +`F ⋙ forget _`, this is the type `c.pt` on which we define a partial order +which makes it the colimit of `F`. -/ @[nolint unusedArguments] def CoconePt (_ : IsColimit c) : Type u := c.pt @@ -212,8 +217,8 @@ instance : PartialOrder (CoconePt hc) where obtain ⟨l₂, a', b', h₄⟩ := (Types.FilteredColimit.isColimit_eq_iff _ hc (xi := y₁) (xj := y₂)).1 (hy₁.trans hy₂.symm) - obtain ⟨l, c, c', h₅, h₆⟩ := IsFiltered.bowtie a a' b b' - exact ⟨l, a ≫ c, b ≫ c, F.map (a ≫ c) x₁, F.map (a' ≫ c') y₁, rfl, + obtain ⟨l, d, d', h₅, h₆⟩ := IsFiltered.bowtie a a' b b' + exact ⟨l, a ≫ d, b ≫ d, F.map (a ≫ d) x₁, F.map (a' ≫ d') y₁, rfl, by simpa, by rw [h₅], by simpa [h₆]⟩ have h₇ : x₃ = y₃ := le_antisymm @@ -223,6 +228,8 @@ instance : PartialOrder (CoconePt hc) where ((congr_arg (c.ι.app l) (h₃.symm.trans (h₇.trans h₅))).trans ((ConcreteCategory.congr_hom (c.w a) y₁).trans hy₁))) +/-- The colimit cocone for a functor `F : J ⥤ PartOrdEmb` from a filtered +category that is constructed from a colimit cocone for `F ⋙ forget _`. -/ @[simps] def cocone : Cocone F where pt := .of (CoconePt hc) @@ -230,30 +237,56 @@ def cocone : Cocone F where { toFun := c.ι.app j inj' x y h := by obtain ⟨k, a, ha⟩ := (Types.FilteredColimit.isColimit_eq_iff' hc x y).1 h - exact (F.map a).injective ha + exact (F.map a).injective ha map_rel_iff' {x y} := by refine ⟨?_, fun h ↦ ⟨j, x, y, rfl, rfl, h⟩⟩ - rintro ⟨k, x', y', hx', hy', h⟩ - sorry } + rintro ⟨k, x', y', hx, hy, h⟩ + obtain ⟨l₁, a₁, b₁, hl₁⟩ := (Types.FilteredColimit.isColimit_eq_iff _ hc).1 hx + obtain ⟨l₂, a₂, b₂, hl₂⟩ := (Types.FilteredColimit.isColimit_eq_iff _ hc).1 hy + dsimp at hx hy hl₁ hl₂ + obtain ⟨m, d, d', h₁, h₂⟩ := bowtie a₁ a₂ b₁ b₂ + rw [← (F.map (a₁ ≫ d)).le_iff_le] at h + rw [← (F.map (b₁ ≫ d)).le_iff_le] + conv_rhs => rw [h₂] + conv_rhs at h => rw [h₁] + simp only [Functor.map_comp, hom_comp, RelEmbedding.coe_trans, Function.comp_apply, + ← hl₁, ← hl₂] + simpa using h } ι.naturality _ _ f := by ext x; exact ConcreteCategory.congr_hom (c.w f) x +/-- Auxiliary definition for `isColimitCocone`. -/ def CoconePt.desc (s : Cocone F) : CoconePt hc ↪o s.pt where toFun := hc.desc ((forget _).mapCocone s) inj' x y h := by - obtain ⟨j, x', y', rfl, rfl⟩ : - ∃ (j : J) (x' y' : F.obj j), c.ι.app j x' = x ∧ c.ι.app j y' = y := by - sorry - have := ((congr_fun (hc.fac ((forget _).mapCocone s) j) x').symm.trans h).trans - (congr_fun (hc.fac ((forget _).mapCocone s) j) y') - obtain rfl := (s.ι.app j).injective this + obtain ⟨j, x', y', rfl, rfl⟩ := + Types.FilteredColimit.jointly_surjective_of_isColimit₂ hc x y + obtain rfl := (s.ι.app j).injective + (((congr_fun (hc.fac ((forget _).mapCocone s) j) x').symm.trans h).trans + (congr_fun (hc.fac ((forget _).mapCocone s) j) y')) rfl - map_rel_iff' := sorry + map_rel_iff' {x y} := by + obtain ⟨j, x', y', rfl, rfl⟩ := + Types.FilteredColimit.jointly_surjective_of_isColimit₂ hc x y + have hx := (congr_fun (hc.fac ((forget _).mapCocone s) j) x') + have hy := (congr_fun (hc.fac ((forget _).mapCocone s) j) y') + dsimp at hx hy ⊢ + rw [hx, hy, OrderEmbedding.le_iff_le] + refine ⟨fun h ↦ ⟨j, _, _, rfl, rfl, h⟩, fun ⟨k, x, y, hx', hy', h⟩ ↦ ?_⟩ + obtain ⟨l, f, g, hl⟩ := (Types.FilteredColimit.isColimit_eq_iff _ hc).1 hx' + obtain ⟨l', f', g', hl'⟩ := (Types.FilteredColimit.isColimit_eq_iff _ hc).1 hy' + obtain ⟨m, a, b, h₁, h₂⟩ := bowtie f f' g g' + dsimp at hl hl' + rw [← (F.map (f ≫ a)).le_iff_le] at h + rw [← (F.map (g ≫ a)).le_iff_le] + exact le_of_eq_of_le (by simp [hl]) (le_of_le_of_eq h (by simp [h₁, h₂, hl'])) @[simp] lemma CoconePt.fac_apply (s : Cocone F) (j : J) (x : F.obj j) : CoconePt.desc hc s (c.ι.app j x) = s.ι.app j x := congr_fun (hc.fac ((forget _).mapCocone s) j) x +/-- A colimit cocone for `F : J ⥤ PartOrdEmb` (with `J` filtered) can be +obtained from a colimit cocone for `F ⋙ forget _`. -/ def isColimitCocone : IsColimit (cocone hc) where desc s := ofHom (CoconePt.desc hc s) uniq s m hm := by @@ -264,8 +297,21 @@ def isColimitCocone : IsColimit (cocone hc) where instance : HasColimit F where exists_colimit := ⟨_, isColimitCocone (colimit.isColimit (F ⋙ forget _))⟩ +instance : PreservesColimit F (forget _) := + preservesColimit_of_preserves_colimit_cocone + (isColimitCocone (colimit.isColimit (F ⋙ forget _))) + (colimit.isColimit (F ⋙ forget _)) + instance : HasColimitsOfShape J PartOrdEmb.{u} where +instance : PreservesColimitsOfShape J (forget PartOrdEmb.{u}) where + +instance : HasFilteredColimitsOfSize.{u, u} PartOrdEmb.{u} where + HasColimitsOfShape _ := inferInstance + +instance : PreservesFilteredColimitsOfSize.{u, u} (forget PartOrdEmb.{u}) where + preserves_filtered_colimits _ := inferInstance + end Limits end PartOrdEmb From 87b99e1d4eaa40163a909e7812b32ba4b6810be9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Mon, 20 Oct 2025 13:28:07 +0200 Subject: [PATCH 157/309] wip --- Mathlib.lean | 1 + .../CategoryTheory/Limits/Types/Filtered.lean | 11 ++ Mathlib/CategoryTheory/Presentable/Type.lean | 106 ++++++++++++++++++ 3 files changed, 118 insertions(+) create mode 100644 Mathlib/CategoryTheory/Presentable/Type.lean diff --git a/Mathlib.lean b/Mathlib.lean index 81a3116d53922f..0e7d74f451915e 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -2750,6 +2750,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.Type import Mathlib.CategoryTheory.Products.Associator import Mathlib.CategoryTheory.Products.Basic import Mathlib.CategoryTheory.Products.Bifunctor diff --git a/Mathlib/CategoryTheory/Limits/Types/Filtered.lean b/Mathlib/CategoryTheory/Limits/Types/Filtered.lean index aeabaeef779d3b..4c95b387da1fa3 100644 --- a/Mathlib/CategoryTheory/Limits/Types/Filtered.lean +++ b/Mathlib/CategoryTheory/Limits/Types/Filtered.lean @@ -152,4 +152,15 @@ theorem colimit_eq_iff [HasColimit F] {i j : J} {xi : F.obj i} {xj : F.obj j} : ∃ (k : _) (f : i ⟶ k) (g : j ⟶ k), F.map f xi = F.map g xj := isColimit_eq_iff _ (colimit.isColimit F) +open IsFiltered in +variable {F} in +lemma jointly_surjective_of_isColimit₂ {t : Cocone F} (ht : IsColimit t) + (x₁ x₂ : t.pt) : + ∃ (j : J) (y₁ y₂ : F.obj j), t.ι.app j y₁ = x₁ ∧ t.ι.app j y₂ = x₂ := by + obtain ⟨j₁, y₁, rfl⟩ := jointly_surjective_of_isColimit ht x₁ + obtain ⟨j₂, y₂, rfl⟩ := jointly_surjective_of_isColimit ht x₂ + exact ⟨max j₁ j₂, F.map (leftToMax _ _) y₁, F.map (rightToMax _ _) y₂, + congr_fun (t.w (leftToMax j₁ j₂)) y₁, + congr_fun (t.w (rightToMax j₁ j₂)) y₂⟩ + end CategoryTheory.Limits.Types.FilteredColimit diff --git a/Mathlib/CategoryTheory/Presentable/Type.lean b/Mathlib/CategoryTheory/Presentable/Type.lean new file mode 100644 index 00000000000000..1bbf76dddab1b6 --- /dev/null +++ b/Mathlib/CategoryTheory/Presentable/Type.lean @@ -0,0 +1,106 @@ +/- +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.Limits.Types.Filtered +import Mathlib.CategoryTheory.Types.Set + +/-! +# Presentable objects in Type + +In this file, we show that if `κ : Cardinal.{u}` is a regular cardinal, +then `X : Type u` is `κ`-presentable in the category of types iff +`HasCardinalLT X κ` holds. + +-/ + +universe u + +open CategoryTheory Limits Opposite + +namespace HasCardinalLT + +variable {X : Type u} (κ : Cardinal.{u}) [Fact κ.IsRegular] + +lemma isCardinalPresentable (hX : HasCardinalLT X κ) : + IsCardinalPresentable X κ where + preservesColimitOfShape J _ _ := + ⟨fun {F} ↦ ⟨fun {c} hc ↦ ⟨by + have := isFiltered_of_isCardinalFiltered J κ + refine Types.FilteredColimit.isColimitOf' _ _ (fun f ↦ ?_) (fun j f g h ↦ ?_) + · choose j g hg using fun x ↦ Types.jointly_surjective_of_isColimit hc (f x) + refine ⟨IsCardinalFiltered.max j hX, + fun x ↦ F.map (IsCardinalFiltered.toMax j hX x) (g x), ?_⟩ + dsimp + ext x + dsimp at j g hg x ⊢ + rw [← hg] + exact congr_fun (c.w (IsCardinalFiltered.toMax j hX x)).symm (g x) + · choose k a hk using fun x ↦ + (Types.FilteredColimit.isColimit_eq_iff' hc _ _).1 (congr_fun h x) + dsimp at f g h k a hk ⊢ + obtain ⟨l, b, c, hl⟩ : ∃ (l : J) (c : j ⟶ l) (b : ∀ x, k x ⟶ l), + ∀ x, a x ≫ b x = c := by + let φ (x : X) : j ⟶ IsCardinalFiltered.max k hX := + a x ≫ IsCardinalFiltered.toMax k hX x + exact ⟨IsCardinalFiltered.coeq φ hX, + IsCardinalFiltered.toCoeq φ hX, + fun x ↦ IsCardinalFiltered.toMax k hX x ≫ IsCardinalFiltered.coeqHom φ hX, + fun x ↦ by simpa [φ] using IsCardinalFiltered.coeq_condition φ hX x⟩ + exact ⟨l, b, by ext x; simp [← hl x, hk]⟩⟩⟩⟩ + +variable (X) + +protected abbrev Set := { A : Set X // HasCardinalLT A κ } + +instance : IsCardinalFiltered (HasCardinalLT.Set X κ) κ := + isCardinalFiltered_preorder _ _ (by + sorry) + +@[simps!] +def Set.functor : HasCardinalLT.Set X κ ⥤ Type u := + Monotone.functor (f := Subtype.val) (by tauto) ⋙ Set.functorToTypes (X := X) + +@[simps] +def Set.cocone : Cocone (Set.functor X κ) where + pt := X + ι.app _ := Subtype.val + +def Set.isColimitCocone : IsColimit (cocone X κ) := sorry + +end HasCardinalLT + +namespace CategoryTheory + +namespace Types + +variable {X : Type u} (κ : Cardinal.{u}) [Fact κ.IsRegular] + + +lemma isCardinalPresentable_iff : + IsCardinalPresentable X κ ↔ HasCardinalLT X κ := by + refine ⟨fun _ ↦ ?_, fun hX ↦ hX.isCardinalPresentable⟩ + have := preservesColimitsOfShape_of_isCardinalPresentable X κ + obtain ⟨⟨A, hA⟩, f, hf⟩ := Types.jointly_surjective_of_isColimit + (isColimitOfPreserves (coyoneda.obj (op X)) + (HasCardinalLT.Set.isColimitCocone X κ)) (𝟙 X) + obtain rfl : A = .univ := by + ext x + have := congr_fun hf x + dsimp at f hf this + simp only [Set.mem_univ, iff_true] + rw [← this] + exact (f x).2 + exact (hasCardinalLT_iff_of_equiv (Equiv.Set.univ X) _).1 hA + +instance (X : Type u) : IsPresentable.{u} X := by + obtain ⟨κ, hκ, hX⟩ := HasCardinalLT.exists_regular_cardinal.{u} X + have : Fact κ.IsRegular := ⟨hκ⟩ + have := hX.isCardinalPresentable + exact isPresentable_of_isCardinalPresentable X κ + +end Types + +end CategoryTheory From 1bb38d5658199fa31fc56924c99d859e62590fce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Mon, 20 Oct 2025 18:06:50 +0200 Subject: [PATCH 158/309] sorry free --- Mathlib/CategoryTheory/Presentable/Type.lean | 60 +++++++++++++++----- 1 file changed, 47 insertions(+), 13 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/Type.lean b/Mathlib/CategoryTheory/Presentable/Type.lean index 1bbf76dddab1b6..5eb37b5108b72f 100644 --- a/Mathlib/CategoryTheory/Presentable/Type.lean +++ b/Mathlib/CategoryTheory/Presentable/Type.lean @@ -22,9 +22,10 @@ open CategoryTheory Limits Opposite namespace HasCardinalLT -variable {X : Type u} (κ : Cardinal.{u}) [Fact κ.IsRegular] +variable (X : Type u) (κ : Cardinal.{u}) -lemma isCardinalPresentable (hX : HasCardinalLT X κ) : +variable {X κ} in +lemma isCardinalPresentable (hX : HasCardinalLT X κ) [Fact κ.IsRegular] : IsCardinalPresentable X κ where preservesColimitOfShape J _ _ := ⟨fun {F} ↦ ⟨fun {c} hc ↦ ⟨by @@ -51,24 +52,57 @@ lemma isCardinalPresentable (hX : HasCardinalLT X κ) : fun x ↦ by simpa [φ] using IsCardinalFiltered.coeq_condition φ hX x⟩ exact ⟨l, b, by ext x; simp [← hl x, hk]⟩⟩⟩⟩ -variable (X) - +/-- Given `X : Type u` and `κ : Cardinal.{u} X`, this is the preordered type +of subsets of `X` of cardinality `< κ`. -/ protected abbrev Set := { A : Set X // HasCardinalLT A κ } -instance : IsCardinalFiltered (HasCardinalLT.Set X κ) κ := - isCardinalFiltered_preorder _ _ (by - sorry) - +namespace Set + +instance [Fact κ.IsRegular] : + IsCardinalFiltered (HasCardinalLT.Set X κ) κ := + isCardinalFiltered_preorder _ _ + (fun ι A hι ↦ ⟨⟨⋃ (i : ι), (A i).val, + hasCardinalLT_iUnion _ + (by rwa [hasCardinalLT_iff_cardinal_mk_lt]) (fun i ↦ (A i).prop)⟩, + le_iSup (fun i ↦ (A i).1)⟩) + +instance [Fact κ.IsRegular] : + IsFiltered (HasCardinalLT.Set X κ) := + isFiltered_of_isCardinalFiltered _ κ + +lemma isFiltered_of_aleph0_le (hκ : Cardinal.aleph0 ≤ κ) : + IsFiltered (HasCardinalLT.Set X κ) where + nonempty := ⟨⟨∅, hasCardinalLT_of_finite _ _ hκ⟩⟩ + toIsFilteredOrEmpty := by + have : IsDirected (HasCardinalLT.Set X κ) (· ≤ ·) := + ⟨fun A B ↦ ⟨⟨A.val ∪ B.val, hasCardinalLT_union hκ A.prop B.prop⟩, + Set.subset_union_left, Set.subset_union_right⟩⟩ + exact isFilteredOrEmpty_of_directed_le _ + +/-- The functor `HasCardinalLT.Set X κ ⥤ Type u` which sends a subset of `X` +of cardinality `κ` to the corresponding subtype. -/ @[simps!] -def Set.functor : HasCardinalLT.Set X κ ⥤ Type u := +def functor : HasCardinalLT.Set X κ ⥤ Type u := Monotone.functor (f := Subtype.val) (by tauto) ⋙ Set.functorToTypes (X := X) +/-- The cocone for `Set.functor X κ : HasCardinalLT.Set X κ ⥤ Type u` with point `X`. -/ @[simps] -def Set.cocone : Cocone (Set.functor X κ) where +def cocone : Cocone (Set.functor X κ) where pt := X ι.app _ := Subtype.val -def Set.isColimitCocone : IsColimit (cocone X κ) := sorry +/-- Any type `X` is the (filtered) colimit of its subsets of cardinality `< κ` +when `κ` is an infinite cardinal. (This colimit is `κ`-filtered when `κ` is +a regular cardinal.) -/ +noncomputable def isColimitCocone + (hκ : Cardinal.aleph0 ≤ κ) : IsColimit (cocone X κ) := by + have := isFiltered_of_aleph0_le X κ hκ + refine Types.FilteredColimit.isColimitOf' _ _ (fun x ↦ ?_) ?_ + · exact ⟨⟨{x}, hasCardinalLT_of_finite _ _ hκ⟩, ⟨x, by simp⟩, rfl⟩ + · rintro A ⟨x, hx⟩ ⟨y, hy⟩ rfl + exact ⟨A, 𝟙 _, rfl⟩ + +end Set end HasCardinalLT @@ -78,14 +112,14 @@ namespace Types variable {X : Type u} (κ : Cardinal.{u}) [Fact κ.IsRegular] - lemma isCardinalPresentable_iff : IsCardinalPresentable X κ ↔ HasCardinalLT X κ := by refine ⟨fun _ ↦ ?_, fun hX ↦ hX.isCardinalPresentable⟩ have := preservesColimitsOfShape_of_isCardinalPresentable X κ obtain ⟨⟨A, hA⟩, f, hf⟩ := Types.jointly_surjective_of_isColimit (isColimitOfPreserves (coyoneda.obj (op X)) - (HasCardinalLT.Set.isColimitCocone X κ)) (𝟙 X) + (HasCardinalLT.Set.isColimitCocone X κ + (Cardinal.IsRegular.aleph0_le Fact.out))) (𝟙 X) obtain rfl : A = .univ := by ext x have := congr_fun hf x 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 159/309] 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 160/309] 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 161/309] 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 fc280ddf7daf76225e98c1374b6fb621749f3915 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Mon, 27 Oct 2025 20:54:06 +0100 Subject: [PATCH 162/309] removed braces --- Mathlib/CategoryTheory/Generator/StrongGenerator.lean | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Mathlib/CategoryTheory/Generator/StrongGenerator.lean b/Mathlib/CategoryTheory/Generator/StrongGenerator.lean index 580967023d5809..a451a38e4b46b1 100644 --- a/Mathlib/CategoryTheory/Generator/StrongGenerator.lean +++ b/Mathlib/CategoryTheory/Generator/StrongGenerator.lean @@ -124,11 +124,11 @@ lemma isStrongGenerator_iff_exists_extremalEpi refine ⟨fun hP X ↦ ?_, fun hP ↦ .mk_of_exists_extremalEpi hP⟩ have := hasCoproductsOfShape_of_small.{w} C (CostructuredArrow P.ι X) have := (coproductIsCoproduct (P.coproductFromFamily X)).whiskerEquivalence - ((Discrete.equivalence (equivShrink.{w} _))).symm + (Discrete.equivalence (equivShrink.{w} _)).symm refine ⟨_, fun j ↦ ((equivShrink.{w} (CostructuredArrow P.ι X)).symm j).left.1, fun j ↦ ((equivShrink.{w} _).symm j).1.2, _, (coproductIsCoproduct (P.coproductFromFamily X)).whiskerEquivalence - ((Discrete.equivalence (equivShrink.{w} _))).symm, _, hP.extremalEpi_coproductFrom X⟩ + (Discrete.equivalence (equivShrink.{w} _)).symm, _, hP.extremalEpi_coproductFrom X⟩ end ObjectProperty From ad4c29d36c0ac3d3fd74e7e5f1960744ad1ca0be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 28 Oct 2025 16:21:22 +0100 Subject: [PATCH 163/309] wip --- Mathlib.lean | 1 + Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean | 0 2 files changed, 1 insertion(+) create mode 100644 Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean diff --git a/Mathlib.lean b/Mathlib.lean index f29b35e1350e3e..1676e126e73366 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -2744,6 +2744,7 @@ import Mathlib.CategoryTheory.Preadditive.Yoneda.Injective import Mathlib.CategoryTheory.Preadditive.Yoneda.Limits import Mathlib.CategoryTheory.Preadditive.Yoneda.Projective import Mathlib.CategoryTheory.Presentable.Basic +import Mathlib.CategoryTheory.Presentable.CardinalDirectedPoset import Mathlib.CategoryTheory.Presentable.CardinalFilteredPresentation import Mathlib.CategoryTheory.Presentable.ColimitPresentation import Mathlib.CategoryTheory.Presentable.Directed diff --git a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean new file mode 100644 index 00000000000000..e69de29bb2d1d6 From cb64b8c8dcea2d30b31409083240315b51629eb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 28 Oct 2025 17:40:11 +0100 Subject: [PATCH 164/309] wip --- .../Presentable/CardinalDirectedPoset.lean | 104 ++++++++++++++++++ .../CategoryTheory/Presentable/Directed.lean | 11 +- Mathlib/Order/Category/PartOrdEmb.lean | 4 + 3 files changed, 118 insertions(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean index e69de29bb2d1d6..232db26dab9900 100644 --- a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean +++ b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean @@ -0,0 +1,104 @@ +/- +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.Limits.FullSubcategory +import Mathlib.Order.Category.PartOrdEmb +import Mathlib.CategoryTheory.Presentable.Directed +import Mathlib.CategoryTheory.Presentable.LocallyPresentable + +/-! +# The κ-accessible category of κ-directed posets + +Given a regular cardinal `κ : Cardinal.{u}`, we define the +category `CardinalFilteredPoset κ` of `κ`-directed partially ordered +types (with order embeddings as morphisms), and we show that it is +a `κ`-accessible category. + +-/ + +universe u + +open CategoryTheory Limits + +namespace PartOrdEmb + +variable (κ : Cardinal.{u}) [Fact κ.IsRegular] + +/-- The property of objects in `PartOrdEmb` that are +satisfied by partially ordered types of cardinality `< κ`. -/ +abbrev isCardinalFiltered : ObjectProperty PartOrdEmb.{u} := + fun X ↦ IsCardinalFiltered X κ + +@[simp] +lemma isCardinalFiltered_iff (X : PartOrdEmb.{u}) : + isCardinalFiltered κ X ↔ IsCardinalFiltered X κ := Iff.rfl + +instance : (isCardinalFiltered κ).IsClosedUnderIsomorphisms where + of_iso e _ := .of_equivalence κ (orderIsoOfIso e).equivalence + +namespace Limits.CoconePt + +variable {κ} {J : Type u} [SmallCategory J] [IsCardinalFiltered J κ] + {F : J ⥤ PartOrdEmb.{u}} {c : Cocone (F ⋙ forget _)} (hc : IsColimit c) + +lemma isCardinalFiltered_pt (hF : ∀ j, IsCardinalFiltered (F.obj j) κ) : + letI := isFiltered_of_isCardinalFiltered J κ + IsCardinalFiltered (CoconePt hc) κ := by + letI := isFiltered_of_isCardinalFiltered J κ + refine isCardinalFiltered_preorder _ _ (fun K f hK ↦ ?_) + rw [← hasCardinalLT_iff_cardinal_mk_lt] at hK + choose j₀ x₀ hx₀ using fun k ↦ Types.jointly_surjective_of_isColimit hc (f k) + let j := IsCardinalFiltered.max j₀ hK + let x₁ (k : K) : F.obj j := F.map (IsCardinalFiltered.toMax j₀ hK k) (x₀ k) + have hx₁ (k : K) : c.ι.app j (x₁ k) = c.ι.app (j₀ k) (x₀ k) := + congr_fun (c.w (IsCardinalFiltered.toMax j₀ hK k)) _ + refine ⟨(cocone hc).ι.app j (IsCardinalFiltered.max x₁ hK), + fun k ↦ ?_⟩ + rw [← hx₀, ← hx₁] + exact ((cocone hc).ι.app j).hom.monotone + (leOfHom (IsCardinalFiltered.toMax x₁ hK k)) + +end Limits.CoconePt + +instance (J : Type u) [SmallCategory J] [IsCardinalFiltered J κ] : + (isCardinalFiltered κ).IsClosedUnderColimitsOfShape J where + colimitsOfShape_le := by + have := isFiltered_of_isCardinalFiltered J κ + rintro X ⟨p⟩ + have hc := colimit.isColimit (p.diag ⋙ forget PartOrdEmb) + simp only [(isCardinalFiltered κ).prop_iff_of_iso + (p.isColimit.coconePointUniqueUpToIso + (Limits.isColimitCocone (colimit.isColimit (p.diag ⋙ forget PartOrdEmb)))), + isCardinalFiltered_iff, Limits.cocone_pt_coe] + exact Limits.CoconePt.isCardinalFiltered_pt _ p.prop_diag_obj + +end PartOrdEmb + +namespace CategoryTheory + +variable (κ : Cardinal.{u}) [Fact κ.IsRegular] + +/-- The category of `κ`-filtered partially ordered types, +with morphisms given by order embeddings. -/ +abbrev CardinalFilteredPoset := + (PartOrdEmb.isCardinalFiltered κ).FullSubcategory + +variable {κ} in +/-- The embedding of the category of `κ`-filtered +partially ordered types in the category of partially +ordered types. -/ +abbrev CardinalFilteredPoset.ι : + CardinalFilteredPoset κ ⥤ PartOrdEmb := + ObjectProperty.ι _ + +instance : HasCardinalFilteredColimits (CardinalFilteredPoset κ) κ where + hasColimitsOfShape J _ _ := by + have := isFiltered_of_isCardinalFiltered J κ + infer_instance + +instance : IsCardinalAccessibleCategory (CardinalFilteredPoset κ) κ where + exists_generator := sorry + +end CategoryTheory diff --git a/Mathlib/CategoryTheory/Presentable/Directed.lean b/Mathlib/CategoryTheory/Presentable/Directed.lean index d1580ab0b50fe2..4d330b69f83ab7 100644 --- a/Mathlib/CategoryTheory/Presentable/Directed.lean +++ b/Mathlib/CategoryTheory/Presentable/Directed.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.IsCardinalFiltered +import Mathlib.CategoryTheory.Presentable.Basic import Mathlib.CategoryTheory.Limits.Final import Mathlib.CategoryTheory.MorphismProperty.Basic import Mathlib.CategoryTheory.Filtered.Final @@ -587,4 +587,13 @@ lemma IsFiltered.exists_directed have : IsFiltered α := by rwa [← isCardinalFiltered_aleph0_iff.{w}] exact ⟨α, _, IsFiltered.isDirected _, nonempty, F, inferInstance⟩ +lemma HasCardinalFilteredColimits.mk' {C : Type u} [Category.{v} C] + {κ : Cardinal.{w}} [Fact κ.IsRegular] + (hC : ∀ (α : Type w) [PartialOrder α] [IsCardinalFiltered α κ], + HasColimitsOfShape α C) : + HasCardinalFilteredColimits C κ where + hasColimitsOfShape J _ _ := by + obtain ⟨α, _, _, F, _⟩ := IsCardinalFiltered.exists_cardinal_directed J κ + exact Functor.Final.hasColimitsOfShape_of_final F + end CategoryTheory diff --git a/Mathlib/Order/Category/PartOrdEmb.lean b/Mathlib/Order/Category/PartOrdEmb.lean index a757570069a1ce..1180cd99b4427b 100644 --- a/Mathlib/Order/Category/PartOrdEmb.lean +++ b/Mathlib/Order/Category/PartOrdEmb.lean @@ -153,6 +153,10 @@ def Iso.mk {α β : PartOrdEmb.{u}} (e : α ≃o β) : α ≅ β where hom := ofHom e inv := ofHom e.symm +/-- The order isomorphism induced by an isomorphism in `PartOrdEmb`. -/ +def orderIsoOfIso {α β : PartOrdEmb.{u}} (e : α ≅ β) : + α ≃o β := sorry + /-- `OrderDual` as a functor. -/ @[simps map] def dual : PartOrdEmb ⥤ PartOrdEmb where From 15387f38c86ef24c3e01c92295cc25b991e8f503 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sat, 8 Nov 2025 22:51:04 +0100 Subject: [PATCH 165/309] removed unnecessary lemma --- Mathlib/CategoryTheory/Limits/Types/Filtered.lean | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/Mathlib/CategoryTheory/Limits/Types/Filtered.lean b/Mathlib/CategoryTheory/Limits/Types/Filtered.lean index 4c95b387da1fa3..aeabaeef779d3b 100644 --- a/Mathlib/CategoryTheory/Limits/Types/Filtered.lean +++ b/Mathlib/CategoryTheory/Limits/Types/Filtered.lean @@ -152,15 +152,4 @@ theorem colimit_eq_iff [HasColimit F] {i j : J} {xi : F.obj i} {xj : F.obj j} : ∃ (k : _) (f : i ⟶ k) (g : j ⟶ k), F.map f xi = F.map g xj := isColimit_eq_iff _ (colimit.isColimit F) -open IsFiltered in -variable {F} in -lemma jointly_surjective_of_isColimit₂ {t : Cocone F} (ht : IsColimit t) - (x₁ x₂ : t.pt) : - ∃ (j : J) (y₁ y₂ : F.obj j), t.ι.app j y₁ = x₁ ∧ t.ι.app j y₂ = x₂ := by - obtain ⟨j₁, y₁, rfl⟩ := jointly_surjective_of_isColimit ht x₁ - obtain ⟨j₂, y₂, rfl⟩ := jointly_surjective_of_isColimit ht x₂ - exact ⟨max j₁ j₂, F.map (leftToMax _ _) y₁, F.map (rightToMax _ _) y₂, - congr_fun (t.w (leftToMax j₁ j₂)) y₁, - congr_fun (t.w (rightToMax j₁ j₂)) y₂⟩ - end CategoryTheory.Limits.Types.FilteredColimit From 181866c4e72d1a2f89a381e63961270e2b544064 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sun, 9 Nov 2025 11:33:45 +0100 Subject: [PATCH 166/309] unused import --- Mathlib/CategoryTheory/Presentable/Directed.lean | 1 - 1 file changed, 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Presentable/Directed.lean b/Mathlib/CategoryTheory/Presentable/Directed.lean index d1580ab0b50fe2..a79656529eda46 100644 --- a/Mathlib/CategoryTheory/Presentable/Directed.lean +++ b/Mathlib/CategoryTheory/Presentable/Directed.lean @@ -8,7 +8,6 @@ import Mathlib.CategoryTheory.Limits.Final import Mathlib.CategoryTheory.MorphismProperty.Basic import Mathlib.CategoryTheory.Filtered.Final import Mathlib.CategoryTheory.Products.Unitor -import Mathlib.Data.Finite.Sigma /-! # `κ`-filtered categories and `κ`-directed poset From 1162f38e9bcab4c31e6df4bcbc0cc7f235dbe9c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sun, 9 Nov 2025 12:07:29 +0100 Subject: [PATCH 167/309] cleaning up --- Mathlib.lean | 2 + .../MorphismProperty/Basic.lean | 8 ++ .../MorphismProperty/HasCardinalLT.lean | 60 +++++++++++++ .../ObjectProperty/HasCardinalLT.lean | 51 +++++++++++ .../CategoryTheory/Presentable/Directed.lean | 90 ++++--------------- 5 files changed, 136 insertions(+), 75 deletions(-) create mode 100644 Mathlib/CategoryTheory/MorphismProperty/HasCardinalLT.lean create mode 100644 Mathlib/CategoryTheory/ObjectProperty/HasCardinalLT.lean diff --git a/Mathlib.lean b/Mathlib.lean index dc06010b40553f..f8d32df40586e9 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -2733,6 +2733,7 @@ import Mathlib.CategoryTheory.MorphismProperty.Concrete import Mathlib.CategoryTheory.MorphismProperty.Descent import Mathlib.CategoryTheory.MorphismProperty.Factorization import Mathlib.CategoryTheory.MorphismProperty.FunctorCategory +import Mathlib.CategoryTheory.MorphismProperty.HasCardinalLT import Mathlib.CategoryTheory.MorphismProperty.Ind import Mathlib.CategoryTheory.MorphismProperty.IsInvertedBy import Mathlib.CategoryTheory.MorphismProperty.IsSmall @@ -2757,6 +2758,7 @@ import Mathlib.CategoryTheory.ObjectProperty.ContainsZero import Mathlib.CategoryTheory.ObjectProperty.EpiMono import Mathlib.CategoryTheory.ObjectProperty.Extensions import Mathlib.CategoryTheory.ObjectProperty.FullSubcategory +import Mathlib.CategoryTheory.ObjectProperty.HasCardinalLT import Mathlib.CategoryTheory.ObjectProperty.Ind import Mathlib.CategoryTheory.ObjectProperty.LimitsClosure import Mathlib.CategoryTheory.ObjectProperty.LimitsOfShape diff --git a/Mathlib/CategoryTheory/MorphismProperty/Basic.lean b/Mathlib/CategoryTheory/MorphismProperty/Basic.lean index fc3aff663c7eae..5caa3ac36b3f7f 100644 --- a/Mathlib/CategoryTheory/MorphismProperty/Basic.lean +++ b/Mathlib/CategoryTheory/MorphismProperty/Basic.lean @@ -127,6 +127,14 @@ def toSet : Set (Arrow C) := setOf (fun f ↦ P f.hom) lemma mem_toSet_iff (f : Arrow C) : f ∈ P.toSet ↔ P f.hom := Iff.rfl +lemma toSet_iSup {ι : Type*} (W : ι → MorphismProperty C) : + (⨆ i , W i).toSet = ⋃ i, (W i).toSet := by + ext + simp [mem_toSet_iff] + +lemma toSet_max (W₁ W₂ : MorphismProperty C) : + (W₁ ⊔ W₂).toSet = W₁.toSet ∪ W₂.toSet := rfl + /-- The family of morphisms indexed by `P.toSet` which corresponds to `P : MorphismProperty C`, see `MorphismProperty.ofHoms_homFamily`. -/ def homFamily (f : P.toSet) : f.1.left ⟶ f.1.right := f.1.hom diff --git a/Mathlib/CategoryTheory/MorphismProperty/HasCardinalLT.lean b/Mathlib/CategoryTheory/MorphismProperty/HasCardinalLT.lean new file mode 100644 index 00000000000000..88a3ff07787bb7 --- /dev/null +++ b/Mathlib/CategoryTheory/MorphismProperty/HasCardinalLT.lean @@ -0,0 +1,60 @@ +/- +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.SetTheory.Cardinal.HasCardinalLT +import Mathlib.CategoryTheory.MorphismProperty.Basic + +/-! +# Properties of morphisms that are bounded by a cardinal + +Given `P : MorphismProperty C` and `κ : Cardinal`, we introduce a predicate +`P.HasCardinalLT κ` saying that the cardinality of `P.toSet` is `< κ`. + +-/ + + +universe w v u + +namespace CategoryTheory + +variable {C : Type u} [Category.{v} C] + +namespace MorphismProperty + +/-- The property that the subtype of arrows satisfying a property `P : MorphismProperty C` +is of cardinality `< κ`. -/ +protected abbrev HasCardinalLT (P : MorphismProperty C) (κ : Cardinal.{w}) := + _root_.HasCardinalLT P.toSet κ + +lemma hasCardinalLT_ofHoms {C : Type*} [Category C] + {ι : Type*} {X Y : ι → C} (f : ∀ i, X i ⟶ Y i) {κ : Cardinal} + (h : HasCardinalLT ι κ) : (MorphismProperty.ofHoms f).HasCardinalLT κ := + h.of_surjective (fun i ↦ ⟨Arrow.mk (f i), ⟨i⟩⟩) (by + rintro ⟨f, hf⟩ + rw [MorphismProperty.mem_toSet_iff, MorphismProperty.ofHoms_iff] at hf + obtain ⟨i, hf⟩ := hf + obtain rfl : f = _ := hf + exact ⟨i, rfl⟩) + +lemma HasCardinalLT.iSup + {ι : Type*} {P : ι → MorphismProperty C} {κ : Cardinal.{w}} [Fact κ.IsRegular] + (hP : ∀ i, (P i).HasCardinalLT κ) (hι : HasCardinalLT ι κ) : + (⨆ i, P i).HasCardinalLT κ := by + dsimp only [MorphismProperty.HasCardinalLT] + rw [toSet_iSup] + exact hasCardinalLT_iUnion _ hι hP + +lemma HasCardinalLT.union + {P₁ P₂ : MorphismProperty C} {κ : Cardinal.{w}} + (h₁ : P₁.HasCardinalLT κ) (h₂ : P₂.HasCardinalLT κ) + (hκ : Cardinal.aleph0 ≤ κ) : + (P₁ ⊔ P₂).HasCardinalLT κ := by + dsimp only [MorphismProperty.HasCardinalLT] + rw [MorphismProperty.toSet_max] + exact hasCardinalLT_union hκ h₁ h₂ + +end MorphismProperty + +end CategoryTheory diff --git a/Mathlib/CategoryTheory/ObjectProperty/HasCardinalLT.lean b/Mathlib/CategoryTheory/ObjectProperty/HasCardinalLT.lean new file mode 100644 index 00000000000000..1033fb76812308 --- /dev/null +++ b/Mathlib/CategoryTheory/ObjectProperty/HasCardinalLT.lean @@ -0,0 +1,51 @@ +/- +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.SetTheory.Cardinal.HasCardinalLT +import Mathlib.CategoryTheory.ObjectProperty.Basic + +/-! +# Properties of objects that are bounded by a cardinal + +Given `P : ObjectProperty C` and `κ : Cardinal`, we introduce a predicate +`P.HasCardinalLT κ` saying that the cardinality of `Subtype P` is `< κ`. + +-/ + + +universe w v u + +namespace CategoryTheory + +variable {C : Type u} [Category.{v} C] + +namespace ObjectProperty + +/-- The property that the subtype of objects satisfying a property `P : ObjectProperty C` +is of cardinality `< κ`. -/ +protected abbrev HasCardinalLT (P : ObjectProperty C) (κ : Cardinal.{w}) := + _root_.HasCardinalLT (Subtype P) κ + +lemma hasCardinalLT_subtype_ofObj + {ι : Type*} (X : ι → C) {κ : Cardinal.{w}} + (h : HasCardinalLT ι κ) : (ObjectProperty.ofObj X).HasCardinalLT κ := + h.of_surjective (fun i ↦ ⟨X i, by simp⟩) (by rintro ⟨_, ⟨i⟩⟩; exact ⟨i, rfl⟩) + +lemma HasCardinalLT.iSup + {ι : Type*} {P : ι → ObjectProperty C} {κ : Cardinal.{w}} [Fact κ.IsRegular] + (hP : ∀ i, (P i).HasCardinalLT κ) (hι : HasCardinalLT ι κ) : + (⨆ i, P i).HasCardinalLT κ := + hasCardinalLT_subtype_iSup _ hι hP + +lemma HasCardinalLT.union + {P₁ P₂ : ObjectProperty C} {κ : Cardinal.{w}} + (h₁ : P₁.HasCardinalLT κ) (h₂ : P₂.HasCardinalLT κ) + (hκ : Cardinal.aleph0 ≤ κ) : + (P₁ ⊔ P₂).HasCardinalLT κ := + hasCardinalLT_union hκ h₁ h₂ + +end ObjectProperty + +end CategoryTheory diff --git a/Mathlib/CategoryTheory/Presentable/Directed.lean b/Mathlib/CategoryTheory/Presentable/Directed.lean index a79656529eda46..f36365505dfd92 100644 --- a/Mathlib/CategoryTheory/Presentable/Directed.lean +++ b/Mathlib/CategoryTheory/Presentable/Directed.lean @@ -3,10 +3,11 @@ 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.IsCardinalFiltered -import Mathlib.CategoryTheory.Limits.Final -import Mathlib.CategoryTheory.MorphismProperty.Basic import Mathlib.CategoryTheory.Filtered.Final +import Mathlib.CategoryTheory.Limits.Final +import Mathlib.CategoryTheory.MorphismProperty.HasCardinalLT +import Mathlib.CategoryTheory.ObjectProperty.HasCardinalLT +import Mathlib.CategoryTheory.Presentable.IsCardinalFiltered import Mathlib.CategoryTheory.Products.Unitor /-! @@ -34,58 +35,12 @@ have to be multiplicative.) universe u v w -lemma CategoryTheory.MorphismProperty.toSet_iSup {C : Type*} [Category C] - {ι : Type*} (W : ι → MorphismProperty C) : - (⨆ i , W i).toSet = ⋃ i, (W i).toSet := by - ext - simp [MorphismProperty.toSet] - -lemma CategoryTheory.MorphismProperty.toSet_max {C : Type*} [Category C] - (W₁ W₂ : MorphismProperty C) : - (W₁ ⊔ W₂).toSet = W₁.toSet ∪ W₂.toSet := rfl - -section - -open CategoryTheory Limits - -lemma hasCardinalLT_toSet_morphismPropertyOfHoms {C : Type*} [Category C] - {ι : Type*} {X Y : ι → C} (f : ∀ i, X i ⟶ Y i) {κ : Cardinal} - (h : HasCardinalLT ι κ) : HasCardinalLT (MorphismProperty.ofHoms f).toSet κ := - h.of_surjective (fun i ↦ ⟨Arrow.mk (f i), ⟨i⟩⟩) (by - rintro ⟨f, hf⟩ - rw [MorphismProperty.mem_toSet_iff, MorphismProperty.ofHoms_iff] at hf - obtain ⟨i, hf⟩ := hf - obtain rfl : f = _ := hf - exact ⟨i, rfl⟩) - -lemma hasCardinalLT_subtype_objectPropertyOfObj {C : Type*} [Category C] - {ι : Type*} (X : ι → C) {κ : Cardinal} - (h : HasCardinalLT ι κ) : HasCardinalLT (Subtype (ObjectProperty.ofObj X)) κ := - h.of_surjective (fun i ↦ ⟨X i, by simp⟩) (by rintro ⟨_, ⟨i⟩⟩; exact ⟨i, rfl⟩) - -end - namespace CategoryTheory open Limits namespace IsCardinalFiltered -instance prod (J₁ J₂ : Type*) [Category J₁] [Category J₂] - (κ : Cardinal.{w}) [Fact κ.IsRegular] - [IsCardinalFiltered J₁ κ] [IsCardinalFiltered J₂ κ] : - IsCardinalFiltered (J₁ × J₂) κ where - nonempty_cocone {C _} F hC := ⟨by - let c₁ := cocone (F ⋙ Prod.fst _ _) hC - let c₂ := cocone (F ⋙ Prod.snd _ _) hC - exact - { pt := (c₁.pt, c₂.pt) - ι.app i := (c₁.ι.app i, c₂.ι.app i) - ι.naturality i j f := by - ext - · simpa using c₁.w f - · simpa using c₂.w f}⟩ - namespace exists_cardinal_directed variable (J : Type w) [SmallCategory J] (κ : Cardinal.{w}) @@ -109,8 +64,8 @@ structure Diagram where P : ObjectProperty J src {i j : J} {f : i ⟶ j} : W f → P i tgt {i j : J} {f : i ⟶ j} : W f → P j - hW : HasCardinalLT W.toSet κ - hP : HasCardinalLT (Subtype P) κ + hW : W.HasCardinalLT κ + hP : P.HasCardinalLT κ namespace Diagram @@ -285,10 +240,8 @@ def Diagram.iSup {ι : Type*} (D : ι → Diagram J κ) (hι : HasCardinalLT ι simp only [MorphismProperty.iSup_iff, iSup_apply, iSup_Prop_eq] at hf ⊢ obtain ⟨i, hi⟩ := hf exact ⟨i, (D i).tgt hi⟩ - hW := by - rw [MorphismProperty.toSet_iSup] - exact hasCardinalLT_iUnion _ hι (fun i ↦ (D i).hW) - hP := hasCardinalLT_subtype_iSup _ hι (fun i ↦ (D i).hP) + hW := .iSup (fun i ↦ (D i).hW) hι + hP := .iSup (fun i ↦ (D i).hP) hι variable {J κ} in /-- The union of two `κ`-bounded diagrams. -/ @@ -305,8 +258,8 @@ def Diagram.max (D₁ D₂ : Diagram J κ) : rintro _ _ _ (h | h) · exact Or.inl (D₁.tgt h) · exact Or.inr (D₂.tgt h) - hW := hasCardinalLT_union (Cardinal.IsRegular.aleph0_le Fact.out) D₁.hW D₂.hW - hP := hasCardinalLT_union (Cardinal.IsRegular.aleph0_le Fact.out) D₁.hP D₂.hP + hW := .union D₁.hW D₂.hW (Cardinal.IsRegular.aleph0_le Fact.out) + hP := .union D₁.hP D₂.hP (Cardinal.IsRegular.aleph0_le Fact.out) variable [IsCardinalFiltered J κ] (hJ : ∀ (e : J), ∃ (m : J) (_ : e ⟶ m), IsEmpty (m ⟶ e)) @@ -390,14 +343,9 @@ lemma isCardinalFiltered : IsCardinalFiltered (DiagramWithUniqueTerminal J κ) exact Or.inl ⟨i, (D i).tgt hf⟩ · exact Or.inr rfl · exact Or.inr rfl - hW := by - rw [MorphismProperty.toSet_max] - exact hasCardinalLT_union hκ D₁.hW - (hasCardinalLT_toSet_morphismPropertyOfHoms _ - (hasCardinalLT_sigma _ _ hι (fun i ↦ (D i).hP))) - hP := hasCardinalLT_subtype_max hκ - (hasCardinalLT_subtype_iSup _ hι (fun i ↦ (D i).hP)) - (hasCardinalLT_of_finite _ _ hκ) } + hW := .union D₁.hW (MorphismProperty.hasCardinalLT_ofHoms _ + ((hasCardinalLT_sigma _ _ hι (fun i ↦ (D i).hP)))) hκ + hP := D₁.hP } have hD₂ {f : m ⟶ m} (hf : D₂.W f) : f = 𝟙 _ := by simp only [Diagram.max_W, Diagram.iSup_W, Diagram.single_W, D₁, D₀, D₂] at hf obtain ((hf | ⟨⟨⟩⟩) | hf) := hf @@ -483,16 +431,8 @@ lemma final_functor : (functor J κ).Final := by rintro i j f (hf | ⟨⟨j, hj⟩⟩) · exact D₀.tgt hf · exact Or.inr ⟨⟨⟩⟩ - hW := - hasCardinalLT_union hκ - (hasCardinalLT_union hκ D.hW - (hasCardinalLT_toSet_morphismPropertyOfHoms _ - (hasCardinalLT_of_finite _ _ hκ))) - (hasCardinalLT_toSet_morphismPropertyOfHoms _ D.hP) - hP := - hasCardinalLT_union hκ D.hP - (hasCardinalLT_subtype_objectPropertyOfObj _ - (hasCardinalLT_of_finite _ _ hκ)) } + hW := .union D₀.hW (MorphismProperty.hasCardinalLT_ofHoms _ D.hP) hκ + hP := D₀.hP } have h₂ {j : J} (hj : D.P j) {f : j ⟶ m₁} (hf : D₁.W f) : f = φ ⟨_, hj⟩ := by obtain ((hf | ⟨⟨⟩⟩) | ⟨⟨⟩⟩) := hf From f55c700dadc800e6f7bbc4564917940339b65bab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sun, 9 Nov 2025 12:11:24 +0100 Subject: [PATCH 168/309] cleaning up --- Mathlib/CategoryTheory/Presentable/Directed.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Presentable/Directed.lean b/Mathlib/CategoryTheory/Presentable/Directed.lean index f36365505dfd92..a5ebba5812cb5b 100644 --- a/Mathlib/CategoryTheory/Presentable/Directed.lean +++ b/Mathlib/CategoryTheory/Presentable/Directed.lean @@ -73,7 +73,7 @@ variable {J κ} /-- Given a `κ`-bounded diagram `D` in a category `J`, an object `e : J` is terminal if for any object `j` of `D`, there is a unique morphism `j ⟶ e` in `D`, -that these unique morphisms are compatible with precomposition with morphims in `D`, +that these unique morphisms are compatible with precomposition with morphisms in `D`, and that `𝟙 e` belongs to `D`. -/ structure IsTerminal (D : Diagram J κ) (e : J) where prop_id : D.W (𝟙 e) From 985b23215503a5a9e1f2b9888ac390f124d2a192 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sun, 9 Nov 2025 12:17:52 +0100 Subject: [PATCH 169/309] feat(CategoryTheory): HasCardinalLT for MorphismProperty and ObjectProperty --- Mathlib.lean | 2 + .../MorphismProperty/Basic.lean | 10 ++++ .../MorphismProperty/HasCardinalLT.lean | 60 +++++++++++++++++++ .../ObjectProperty/HasCardinalLT.lean | 51 ++++++++++++++++ 4 files changed, 123 insertions(+) create mode 100644 Mathlib/CategoryTheory/MorphismProperty/HasCardinalLT.lean create mode 100644 Mathlib/CategoryTheory/ObjectProperty/HasCardinalLT.lean diff --git a/Mathlib.lean b/Mathlib.lean index 601f8be916d5d9..d5537f79010b65 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -2733,6 +2733,7 @@ import Mathlib.CategoryTheory.MorphismProperty.Concrete import Mathlib.CategoryTheory.MorphismProperty.Descent import Mathlib.CategoryTheory.MorphismProperty.Factorization import Mathlib.CategoryTheory.MorphismProperty.FunctorCategory +import Mathlib.CategoryTheory.MorphismProperty.HasCardinalLT import Mathlib.CategoryTheory.MorphismProperty.Ind import Mathlib.CategoryTheory.MorphismProperty.IsInvertedBy import Mathlib.CategoryTheory.MorphismProperty.IsSmall @@ -2757,6 +2758,7 @@ import Mathlib.CategoryTheory.ObjectProperty.ContainsZero import Mathlib.CategoryTheory.ObjectProperty.EpiMono import Mathlib.CategoryTheory.ObjectProperty.Extensions import Mathlib.CategoryTheory.ObjectProperty.FullSubcategory +import Mathlib.CategoryTheory.ObjectProperty.HasCardinalLT import Mathlib.CategoryTheory.ObjectProperty.Ind import Mathlib.CategoryTheory.ObjectProperty.LimitsClosure import Mathlib.CategoryTheory.ObjectProperty.LimitsOfShape diff --git a/Mathlib/CategoryTheory/MorphismProperty/Basic.lean b/Mathlib/CategoryTheory/MorphismProperty/Basic.lean index 77d45f0447dc20..5caa3ac36b3f7f 100644 --- a/Mathlib/CategoryTheory/MorphismProperty/Basic.lean +++ b/Mathlib/CategoryTheory/MorphismProperty/Basic.lean @@ -125,6 +125,16 @@ variable (P : MorphismProperty C) /-- The set in `Set (Arrow C)` which corresponds to `P : MorphismProperty C`. -/ def toSet : Set (Arrow C) := setOf (fun f ↦ P f.hom) +lemma mem_toSet_iff (f : Arrow C) : f ∈ P.toSet ↔ P f.hom := Iff.rfl + +lemma toSet_iSup {ι : Type*} (W : ι → MorphismProperty C) : + (⨆ i , W i).toSet = ⋃ i, (W i).toSet := by + ext + simp [mem_toSet_iff] + +lemma toSet_max (W₁ W₂ : MorphismProperty C) : + (W₁ ⊔ W₂).toSet = W₁.toSet ∪ W₂.toSet := rfl + /-- The family of morphisms indexed by `P.toSet` which corresponds to `P : MorphismProperty C`, see `MorphismProperty.ofHoms_homFamily`. -/ def homFamily (f : P.toSet) : f.1.left ⟶ f.1.right := f.1.hom diff --git a/Mathlib/CategoryTheory/MorphismProperty/HasCardinalLT.lean b/Mathlib/CategoryTheory/MorphismProperty/HasCardinalLT.lean new file mode 100644 index 00000000000000..88a3ff07787bb7 --- /dev/null +++ b/Mathlib/CategoryTheory/MorphismProperty/HasCardinalLT.lean @@ -0,0 +1,60 @@ +/- +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.SetTheory.Cardinal.HasCardinalLT +import Mathlib.CategoryTheory.MorphismProperty.Basic + +/-! +# Properties of morphisms that are bounded by a cardinal + +Given `P : MorphismProperty C` and `κ : Cardinal`, we introduce a predicate +`P.HasCardinalLT κ` saying that the cardinality of `P.toSet` is `< κ`. + +-/ + + +universe w v u + +namespace CategoryTheory + +variable {C : Type u} [Category.{v} C] + +namespace MorphismProperty + +/-- The property that the subtype of arrows satisfying a property `P : MorphismProperty C` +is of cardinality `< κ`. -/ +protected abbrev HasCardinalLT (P : MorphismProperty C) (κ : Cardinal.{w}) := + _root_.HasCardinalLT P.toSet κ + +lemma hasCardinalLT_ofHoms {C : Type*} [Category C] + {ι : Type*} {X Y : ι → C} (f : ∀ i, X i ⟶ Y i) {κ : Cardinal} + (h : HasCardinalLT ι κ) : (MorphismProperty.ofHoms f).HasCardinalLT κ := + h.of_surjective (fun i ↦ ⟨Arrow.mk (f i), ⟨i⟩⟩) (by + rintro ⟨f, hf⟩ + rw [MorphismProperty.mem_toSet_iff, MorphismProperty.ofHoms_iff] at hf + obtain ⟨i, hf⟩ := hf + obtain rfl : f = _ := hf + exact ⟨i, rfl⟩) + +lemma HasCardinalLT.iSup + {ι : Type*} {P : ι → MorphismProperty C} {κ : Cardinal.{w}} [Fact κ.IsRegular] + (hP : ∀ i, (P i).HasCardinalLT κ) (hι : HasCardinalLT ι κ) : + (⨆ i, P i).HasCardinalLT κ := by + dsimp only [MorphismProperty.HasCardinalLT] + rw [toSet_iSup] + exact hasCardinalLT_iUnion _ hι hP + +lemma HasCardinalLT.union + {P₁ P₂ : MorphismProperty C} {κ : Cardinal.{w}} + (h₁ : P₁.HasCardinalLT κ) (h₂ : P₂.HasCardinalLT κ) + (hκ : Cardinal.aleph0 ≤ κ) : + (P₁ ⊔ P₂).HasCardinalLT κ := by + dsimp only [MorphismProperty.HasCardinalLT] + rw [MorphismProperty.toSet_max] + exact hasCardinalLT_union hκ h₁ h₂ + +end MorphismProperty + +end CategoryTheory diff --git a/Mathlib/CategoryTheory/ObjectProperty/HasCardinalLT.lean b/Mathlib/CategoryTheory/ObjectProperty/HasCardinalLT.lean new file mode 100644 index 00000000000000..1033fb76812308 --- /dev/null +++ b/Mathlib/CategoryTheory/ObjectProperty/HasCardinalLT.lean @@ -0,0 +1,51 @@ +/- +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.SetTheory.Cardinal.HasCardinalLT +import Mathlib.CategoryTheory.ObjectProperty.Basic + +/-! +# Properties of objects that are bounded by a cardinal + +Given `P : ObjectProperty C` and `κ : Cardinal`, we introduce a predicate +`P.HasCardinalLT κ` saying that the cardinality of `Subtype P` is `< κ`. + +-/ + + +universe w v u + +namespace CategoryTheory + +variable {C : Type u} [Category.{v} C] + +namespace ObjectProperty + +/-- The property that the subtype of objects satisfying a property `P : ObjectProperty C` +is of cardinality `< κ`. -/ +protected abbrev HasCardinalLT (P : ObjectProperty C) (κ : Cardinal.{w}) := + _root_.HasCardinalLT (Subtype P) κ + +lemma hasCardinalLT_subtype_ofObj + {ι : Type*} (X : ι → C) {κ : Cardinal.{w}} + (h : HasCardinalLT ι κ) : (ObjectProperty.ofObj X).HasCardinalLT κ := + h.of_surjective (fun i ↦ ⟨X i, by simp⟩) (by rintro ⟨_, ⟨i⟩⟩; exact ⟨i, rfl⟩) + +lemma HasCardinalLT.iSup + {ι : Type*} {P : ι → ObjectProperty C} {κ : Cardinal.{w}} [Fact κ.IsRegular] + (hP : ∀ i, (P i).HasCardinalLT κ) (hι : HasCardinalLT ι κ) : + (⨆ i, P i).HasCardinalLT κ := + hasCardinalLT_subtype_iSup _ hι hP + +lemma HasCardinalLT.union + {P₁ P₂ : ObjectProperty C} {κ : Cardinal.{w}} + (h₁ : P₁.HasCardinalLT κ) (h₂ : P₂.HasCardinalLT κ) + (hκ : Cardinal.aleph0 ≤ κ) : + (P₁ ⊔ P₂).HasCardinalLT κ := + hasCardinalLT_union hκ h₁ h₂ + +end ObjectProperty + +end CategoryTheory From 4fb92d2b872e628c456ca81286602f44cc240ea9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sun, 9 Nov 2025 12:22:25 +0100 Subject: [PATCH 170/309] feat(CategoryTheory): description of the type WalkingMultispan --- .../Limits/Shapes/Multiequalizer.lean | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/Mathlib/CategoryTheory/Limits/Shapes/Multiequalizer.lean b/Mathlib/CategoryTheory/Limits/Shapes/Multiequalizer.lean index 9603cb981d8367..f46a16aa46cfe9 100644 --- a/Mathlib/CategoryTheory/Limits/Shapes/Multiequalizer.lean +++ b/Mathlib/CategoryTheory/Limits/Shapes/Multiequalizer.lean @@ -184,6 +184,31 @@ lemma Hom.id_eq_id (X : WalkingMultispan J) : Hom.id X = 𝟙 X := rfl lemma Hom.comp_eq_comp {X Y Z : WalkingMultispan J} (f : X ⟶ Y) (g : Y ⟶ Z) : Hom.comp f g = f ≫ g := rfl +variable (J) in +/-- The bijection `WalkingMultispan J ≃ J.L ⊕ J.R`. -/ +def equiv : WalkingMultispan J ≃ J.L ⊕ J.R where + toFun x := match x with + | left a => Sum.inl a + | right b => Sum.inr b + invFun := Sum.elim left right + left_inv := by rintro (_ | _) <;> rfl + right_inv := by rintro (_ | _) <;> rfl + +variable (J) in +/-- The bijection `Arrow (WalkingMultispan J) ≃ WalkingMultispan J ⊕ J.R ⊕ J.R`. -/ +def arrowEquiv : + Arrow (WalkingMultispan J) ≃ WalkingMultispan J ⊕ J.L ⊕ J.L where + toFun f := match f.hom with + | .id x => Sum.inl x + | .fst a => Sum.inr (Sum.inl a) + | .snd a => Sum.inr (Sum.inr a) + invFun := + Sum.elim (fun X ↦ Arrow.mk (𝟙 X)) + (Sum.elim (fun a ↦ Arrow.mk (Hom.fst a : left _ ⟶ right _)) + (fun a ↦ Arrow.mk (Hom.snd a : left _ ⟶ right _))) + left_inv := by rintro ⟨_, _, (_ | _ | _)⟩ <;> rfl + right_inv := by rintro (_ | _ | _) <;> rfl + end WalkingMultispan /-- This is a structure encapsulating the data necessary to define a `Multicospan`. -/ From 928e605c1124aef717ba682985654c8da8d32942 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sun, 9 Nov 2025 12:38:37 +0100 Subject: [PATCH 171/309] added Directed.lean file --- Mathlib.lean | 1 + .../CategoryTheory/Presentable/Directed.lean | 268 ++++++++++++++++++ 2 files changed, 269 insertions(+) create mode 100644 Mathlib/CategoryTheory/Presentable/Directed.lean diff --git a/Mathlib.lean b/Mathlib.lean index d5537f79010b65..f8d32df40586e9 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -2806,6 +2806,7 @@ 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.Directed import Mathlib.CategoryTheory.Presentable.Finite import Mathlib.CategoryTheory.Presentable.IsCardinalFiltered import Mathlib.CategoryTheory.Presentable.Limits diff --git a/Mathlib/CategoryTheory/Presentable/Directed.lean b/Mathlib/CategoryTheory/Presentable/Directed.lean new file mode 100644 index 00000000000000..7504329ca9f904 --- /dev/null +++ b/Mathlib/CategoryTheory/Presentable/Directed.lean @@ -0,0 +1,268 @@ +/- +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.Filtered.Final +import Mathlib.CategoryTheory.Limits.Final +import Mathlib.CategoryTheory.MorphismProperty.HasCardinalLT +import Mathlib.CategoryTheory.ObjectProperty.HasCardinalLT +import Mathlib.CategoryTheory.Presentable.IsCardinalFiltered +import Mathlib.CategoryTheory.Products.Unitor + +/-! +# `κ`-filtered categories and `κ`-directed poset + +In this file, we shall formalize the proof by Deligne (SGA 4 I 8.1.6) that for +any (small) filtered category `J`, there exists a final functor `F : α ⥤ J` +where `α` is a directed partially ordered set (TODO). +The construction applies more generally to `κ`-filtered categories and +`κ`-directed posets (TODO). + +Note: the argument by Deligne is reproduced (without reference) in the book +by Adámek and Rosický (theorem 1.5), but with a mistake: +the construction by Deligne involves considering diagrams +(see `CategoryTheory.IsCardinalFiltered.exists_cardinal_directed.DiagramWithUniqueTerminal`) +which are not necessarily *subcategories* (the class of morphisms `W` does not +have to be multiplicative.) + +## References +* [Alexander Grothendieck and Jean-Louis Verdier, *Exposé I : Préfaisceaux*, + SGA 4 I 8.1.6][sga-4-tome-1] +* [Adámek, J. and Rosický, J., *Locally presentable and accessible categories*][Adamek_Rosicky_1994] + +-/ + +universe u v w + +namespace CategoryTheory + +open Limits + +namespace IsCardinalFiltered + +namespace exists_cardinal_directed + +variable (J : Type w) [SmallCategory J] (κ : Cardinal.{w}) + +/-! +Let `J` is a `κ`-filtered category. In order to construct a cofinal functor `α ⥤ J` +with a `κ`-directed poset `α`, we first consider the case where there is no +object `m : J` such that for any object `j : J`, there exists a map `j ⟶ m`. +Under this assumption (`hJ`), the partially ordered type `DiagramWithUniqueTerminal J κ` +of `κ`-bounded diagrams with a unique terminal object in `J` shall be a possible +choice for `α`. +-/ + +/-- If `κ` is a cardinal, this structure contains the data of a `κ`-bounded diagram +in a category `J`. -/ +@[ext] +structure Diagram where + /-- the morphisms which belongs to the diagram -/ + W : MorphismProperty J + /-- the objects in the diagram -/ + P : ObjectProperty J + src {i j : J} {f : i ⟶ j} : W f → P i + tgt {i j : J} {f : i ⟶ j} : W f → P j + hW : W.HasCardinalLT κ + hP : P.HasCardinalLT κ + +namespace Diagram + +variable {J κ} + +/-- Given a `κ`-bounded diagram `D` in a category `J`, an object `e : J` +is terminal if for any object `j` of `D`, there is a unique morphism `j ⟶ e` in `D`, +that these unique morphisms are compatible with precomposition with morphisms in `D`, +and that `𝟙 e` belongs to `D`. -/ +structure IsTerminal (D : Diagram J κ) (e : J) where + prop_id : D.W (𝟙 e) + /-- the unique map to the terminal object in the diagram -/ + lift {j : J} (hj : D.P j) : j ⟶ e + hlift {j : J} (hj : D.P j) : D.W (lift hj) + uniq {j : J} (hj : D.P j) {φ : j ⟶ e} (hφ : D.W φ) : lift hj = φ + comm {i j : J} (f : i ⟶ j) (hf : D.W f) : f ≫ lift (D.tgt hf) = lift (D.src hf) + +namespace IsTerminal + +attribute [reassoc] IsTerminal.comm + +variable {D : Diagram J κ} {e : J} + +lemma prop (h : D.IsTerminal e) : D.P e := D.src (h.prop_id) + +@[simp] +lemma lift_self (h : D.IsTerminal e) : h.lift h.prop = 𝟙 e := h.uniq _ h.prop_id + +instance : Subsingleton (D.IsTerminal e) where + allEq h₁ h₂ := by + have : @h₁.lift = @h₂.lift := by + ext j hj + exact h₁.uniq hj (h₂.hlift hj) + cases h₁ + cases h₂ + aesop + +/-- Constructor for `Diagram.IsTerminal` for which no data is provided, +but only its existence. -/ +noncomputable def ofExistsUnique (prop_id : D.W (𝟙 e)) + (h₁ : ∀ ⦃j : J⦄ (_ : D.P j), ∃ (lift : j ⟶ e), D.W lift) + (h₂ : ∀ ⦃j : J⦄ (_ : D.P j) (l₁ l₂ : j ⟶ e), D.W l₁ → D.W l₂ → l₁ = l₂) + (h₃ : ∀ ⦃i j : J⦄ (f : i ⟶ j) (_ : D.W f), ∃ (li : i ⟶ e) (lj : j ⟶ e), + D.W li ∧ D.W lj ∧ f ≫ lj = li) : + D.IsTerminal e where + prop_id := prop_id + lift hj := (h₁ hj).choose + hlift hj := (h₁ hj).choose_spec + uniq hj φ hφ := h₂ hj (h₁ hj).choose φ (h₁ hj).choose_spec hφ + comm _ hf := by + obtain ⟨li, lj, hli, hlj, fac⟩ := h₃ _ hf + rw [h₂ (D.src hf) _ li (h₁ (D.src hf)).choose_spec hli, + h₂ (D.tgt hf) _ lj (h₁ (D.tgt hf)).choose_spec hlj, fac] + +end IsTerminal + +end Diagram + +/-- If `κ` is a cardinal, this structure contains the data of a `κ`-bounded diagram +with a unique terminal object in a category `J`. -/ +structure DiagramWithUniqueTerminal extends Diagram J κ where + /-- the terminal object -/ + top : J + /-- `top` is terminal -/ + isTerminal : toDiagram.IsTerminal top + uniq_terminal (j : J) (hj : toDiagram.IsTerminal j) : j = top + +@[ext] +lemma DiagramWithUniqueTerminal.ext {D₁ D₂ : DiagramWithUniqueTerminal J κ} + (hW : D₁.W = D₂.W) (hP : D₁.P = D₂.P) : D₁ = D₂ := by + obtain ⟨D₁, top, h₁, h₁'⟩ := D₁ + obtain ⟨D₂, top', h₂, h₂'⟩ := D₂ + obtain rfl : D₁ = D₂ := by aesop + obtain rfl : top = top' := h₂' _ h₁ + obtain rfl : h₁ = h₂ := by subsingleton + rfl + +instance : PartialOrder (DiagramWithUniqueTerminal J κ) where + le D₁ D₂ := D₁.W ≤ D₂.W ∧ D₁.P ≤ D₂.P + le_refl _ := ⟨by rfl, by rfl⟩ + le_trans _ _ _ h₁ h₂ := ⟨h₁.1.trans h₂.1, h₁.2.trans h₂.2⟩ + le_antisymm _ _ h₁ h₂ := by + ext : 1 + · exact le_antisymm h₁.1 h₂.1 + · exact le_antisymm h₁.2 h₂.2 + +section + +variable {J κ} + +/-- Auxiliary definition for `functor`. -/ +def functorMap {D₁ D₂ : DiagramWithUniqueTerminal J κ} (h : D₁ ≤ D₂) : D₁.top ⟶ D₂.top := + D₂.isTerminal.lift (h.2 _ D₁.isTerminal.prop) + +@[simp] +lemma functorMap_id (D : DiagramWithUniqueTerminal J κ) : functorMap (le_refl D) = 𝟙 D.top := by + simp [functorMap] + +@[reassoc (attr := simp)] +lemma functorMap_comp {D₁ D₂ D₃ : DiagramWithUniqueTerminal J κ} (h₁₂ : D₁ ≤ D₂) (h₂₃ : D₂ ≤ D₃) : + functorMap h₁₂ ≫ functorMap h₂₃ = functorMap (h₁₂.trans h₂₃) := + D₃.isTerminal.comm _ (h₂₃.1 _ (D₂.isTerminal.hlift _)) + +end + +/-- The functor which sends a `κ`-bounded diagram with a unique terminal object to +its terminal object. -/ +@[simps] +def functor : DiagramWithUniqueTerminal J κ ⥤ J where + obj D := D.top + map h := functorMap (leOfHom h) + +variable [Fact κ.IsRegular] + +variable {J κ} in +/-- The diagram containing a single object (and its identity morphism). -/ +@[simps] +def Diagram.single (j : J) : Diagram J κ where + W := .ofHoms (fun (_ : Unit) ↦ 𝟙 j) + P := .ofObj (fun (_ : Unit) ↦ j) + src := by rintro _ _ _ ⟨⟩; exact ⟨⟨⟩⟩ + tgt := by rintro _ _ _ ⟨⟩; exact ⟨⟨⟩⟩ + hW := + (hasCardinalLT_of_finite _ κ (Cardinal.IsRegular.aleph0_le Fact.out)).of_surjective + (fun (_ : Unit) ↦ ⟨Arrow.mk (𝟙 j), ⟨⟨⟩⟩⟩) (by + rintro ⟨f, hf⟩ + refine ⟨⟨⟩, ?_⟩ + ext + exact ((MorphismProperty.ofHoms_iff _ _).1 + ((MorphismProperty.arrow_mk_mem_toSet_iff _ _).1 hf)).choose_spec.symm) + hP := + (hasCardinalLT_of_finite _ κ (Cardinal.IsRegular.aleph0_le Fact.out)).of_surjective + (fun (_ : Unit) ↦ ⟨j, by simp⟩) (fun ⟨k, hk⟩ ↦ ⟨⟨⟩, by aesop⟩) + +instance (j : J) : Finite (Subtype (Diagram.single (κ := κ) j).P) := + Finite.of_surjective (fun (_ : Unit) ↦ ⟨j, by simp⟩) + (by rintro ⟨_, ⟨⟩⟩; exact ⟨⟨⟩, rfl⟩) + +variable {J κ} in +/-- The diagram with a unique terminal object containing a single object +(and its identity morphism). -/ +noncomputable def DiagramWithUniqueTerminal.single (j : J) : + DiagramWithUniqueTerminal J κ where + toDiagram := .single j + top := j + isTerminal := by + refine .ofExistsUnique ⟨⟨⟩⟩ (fun _ h ↦ ?_) (fun _ h₁ _ _ h₂ h₃ ↦ ? _) (fun _ _ _ h ↦ ?_) + · simp only [Diagram.single_P, ObjectProperty.singleton_iff] at h + subst h + exact ⟨𝟙 _, ⟨⟨⟩⟩⟩ + · simp only [Diagram.single_P, ObjectProperty.singleton_iff] at h₁ + subst h₁ + obtain ⟨⟨⟩⟩ := h₂ + obtain ⟨⟨⟩⟩ := h₃ + simp + · obtain ⟨⟨⟩⟩ := h + exact ⟨𝟙 _, 𝟙 _, ⟨⟨⟩⟩, ⟨⟨⟩⟩, by simp⟩ + uniq_terminal := by rintro _ ⟨⟨⟩⟩; rfl + +variable {J κ} in +/-- The union of a `κ`-bounded family of `κ`-bounded diagrams. -/ +@[simps] +def Diagram.iSup {ι : Type*} (D : ι → Diagram J κ) (hι : HasCardinalLT ι κ) : + Diagram J κ where + W := ⨆ (i : ι), (D i).W + P := ⨆ (i : ι), (D i).P + src hf := by + simp only [MorphismProperty.iSup_iff, iSup_apply, iSup_Prop_eq] at hf ⊢ + obtain ⟨i, hi⟩ := hf + exact ⟨i, (D i).src hi⟩ + tgt hf := by + simp only [MorphismProperty.iSup_iff, iSup_apply, iSup_Prop_eq] at hf ⊢ + obtain ⟨i, hi⟩ := hf + exact ⟨i, (D i).tgt hi⟩ + hW := .iSup (fun i ↦ (D i).hW) hι + hP := .iSup (fun i ↦ (D i).hP) hι + +variable {J κ} in +/-- The union of two `κ`-bounded diagrams. -/ +@[simps] +def Diagram.max (D₁ D₂ : Diagram J κ) : + Diagram J κ where + W := D₁.W ⊔ D₂.W + P := D₁.P ⊔ D₂.P + src := by + rintro _ _ _ (h | h) + · exact Or.inl (D₁.src h) + · exact Or.inr (D₂.src h) + tgt := by + rintro _ _ _ (h | h) + · exact Or.inl (D₁.tgt h) + · exact Or.inr (D₂.tgt h) + hW := .union D₁.hW D₂.hW (Cardinal.IsRegular.aleph0_le Fact.out) + hP := .union D₁.hP D₂.hP (Cardinal.IsRegular.aleph0_le Fact.out) + +end exists_cardinal_directed + +end IsCardinalFiltered + +end CategoryTheory From bdb4a3fc36ca310fa77b2569ac8d4ffc910f5db8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sun, 9 Nov 2025 12:45:15 +0100 Subject: [PATCH 172/309] fix --- docs/references.bib | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/references.bib b/docs/references.bib index f94604d92a98e6..d06018734a6357 100644 --- a/docs/references.bib +++ b/docs/references.bib @@ -4405,8 +4405,8 @@ @Book{ sga-4-tome-1 language = {French}, doi = {10.1007/BFb0081551}, keywords = {00B15,14-06}, - zbMATH = {3370272}, - Zbl = {0234.00007} + zbmath = {3370272}, + zbl = {0234.00007} } @Book{ silverman2009, From a4fcafb6adc153aa9e03643e5cb26861d9c85452 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Mon, 17 Nov 2025 02:51:14 +0100 Subject: [PATCH 173/309] better syntax --- Mathlib/CategoryTheory/Presentable/Type.lean | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/Type.lean b/Mathlib/CategoryTheory/Presentable/Type.lean index 5eb37b5108b72f..f83ec53a245203 100644 --- a/Mathlib/CategoryTheory/Presentable/Type.lean +++ b/Mathlib/CategoryTheory/Presentable/Type.lean @@ -110,9 +110,9 @@ namespace CategoryTheory namespace Types -variable {X : Type u} (κ : Cardinal.{u}) [Fact κ.IsRegular] +variable {X : Type u} -lemma isCardinalPresentable_iff : +lemma isCardinalPresentable_iff (κ : Cardinal.{u}) [Fact κ.IsRegular] : IsCardinalPresentable X κ ↔ HasCardinalLT X κ := by refine ⟨fun _ ↦ ?_, fun hX ↦ hX.isCardinalPresentable⟩ have := preservesColimitsOfShape_of_isCardinalPresentable X κ From f3a284a7c83f4518d6d335a68e850b57210e776d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 18 Nov 2025 10:51:56 +0100 Subject: [PATCH 174/309] wip --- Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean index 232db26dab9900..15de1f16fb7d35 100644 --- a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean +++ b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean @@ -93,6 +93,8 @@ abbrev CardinalFilteredPoset.ι : CardinalFilteredPoset κ ⥤ PartOrdEmb := ObjectProperty.ι _ +namespace CardinalFilteredPoset + instance : HasCardinalFilteredColimits (CardinalFilteredPoset κ) κ where hasColimitsOfShape J _ _ := by have := isFiltered_of_isCardinalFiltered J κ @@ -101,4 +103,6 @@ instance : HasCardinalFilteredColimits (CardinalFilteredPoset κ) κ where instance : IsCardinalAccessibleCategory (CardinalFilteredPoset κ) κ where exists_generator := sorry +end CardinalFilteredPoset + end CategoryTheory From 19cba861ad974249bc8adc4d8d4cb47dc56beb34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 18 Nov 2025 10:59:25 +0100 Subject: [PATCH 175/309] =?UTF-8?q?feat(CategoryTheory):=20a=20category=20?= =?UTF-8?q?with=20a=20terminal=20object=20is=20=CE=BA-filtered?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Presentable/IsCardinalFiltered.lean | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean b/Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean index 8d9fac795324dd..a4f40d4f52d883 100644 --- a/Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean +++ b/Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean @@ -302,4 +302,16 @@ lemma IsCardinalFiltered.multicoequalizer (fun i ↦ IsFiltered.coeqHom (f₁ i) (f₂ i)) hι exact ⟨l, b, fun i ↦ by rw [← h i, IsFiltered.coeq_condition_assoc]⟩ +lemma Limits.IsTerminal.isCardinalFiltered {J : Type u} [Category.{v} J] + {X : J} (hX : IsTerminal X) (κ : Cardinal.{w}) [Fact κ.IsRegular] : + IsCardinalFiltered J κ where + nonempty_cocone {A _} F _ := ⟨{ + pt := X + ι.app _ := hX.from _ }⟩ + +lemma isCardinalFiltered_of_hasTerminal (J : Type u) [Category.{v} J] + [HasTerminal J] (κ : Cardinal.{w}) [Fact κ.IsRegular] : + IsCardinalFiltered J κ := + terminalIsTerminal.isCardinalFiltered _ + end CategoryTheory From 6a134b4ef2eefd63a0f3ec19e3034a91b759e83b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 18 Nov 2025 11:09:58 +0100 Subject: [PATCH 176/309] better syntax --- Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean b/Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean index a4f40d4f52d883..1e015d05d089a6 100644 --- a/Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean +++ b/Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean @@ -305,9 +305,7 @@ lemma IsCardinalFiltered.multicoequalizer lemma Limits.IsTerminal.isCardinalFiltered {J : Type u} [Category.{v} J] {X : J} (hX : IsTerminal X) (κ : Cardinal.{w}) [Fact κ.IsRegular] : IsCardinalFiltered J κ where - nonempty_cocone {A _} F _ := ⟨{ - pt := X - ι.app _ := hX.from _ }⟩ + nonempty_cocone _ _ := ⟨{ pt := X, ι.app _ := hX.from _ }⟩ lemma isCardinalFiltered_of_hasTerminal (J : Type u) [Category.{v} J] [HasTerminal J] (κ : Cardinal.{w}) [Fact κ.IsRegular] : From ac1066b00b4af349cd998adf2f707e6892fc55cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 18 Nov 2025 11:56:17 +0100 Subject: [PATCH 177/309] wip --- .../Presentable/CardinalDirectedPoset.lean | 36 +++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean index 15de1f16fb7d35..ddb59ceeeb0572 100644 --- a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean +++ b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean @@ -67,7 +67,6 @@ instance (J : Type u) [SmallCategory J] [IsCardinalFiltered J κ] : colimitsOfShape_le := by have := isFiltered_of_isCardinalFiltered J κ rintro X ⟨p⟩ - have hc := colimit.isColimit (p.diag ⋙ forget PartOrdEmb) simp only [(isCardinalFiltered κ).prop_iff_of_iso (p.isColimit.coconePointUniqueUpToIso (Limits.isColimitCocone (colimit.isColimit (p.diag ⋙ forget PartOrdEmb)))), @@ -95,13 +94,46 @@ abbrev CardinalFilteredPoset.ι : namespace CardinalFilteredPoset +instance (J : CardinalFilteredPoset κ) : IsCardinalFiltered J.obj κ := J.property + instance : HasCardinalFilteredColimits (CardinalFilteredPoset κ) κ where hasColimitsOfShape J _ _ := by have := isFiltered_of_isCardinalFiltered J κ infer_instance +/-- The property of posets in `CardinalFilteredPoset κ` that are +of cardinality `< κ` and have terminal object. -/ +def hasCardinalLTWithTerminal : ObjectProperty (CardinalFilteredPoset κ) := + fun J ↦ HasCardinalLT J.obj κ ∧ HasTerminal J.obj + +instance : ObjectProperty.EssentiallySmall.{u} (hasCardinalLTWithTerminal κ) where + exists_small_le' := by + obtain ⟨X, hX⟩ : ∃ (X : Type u), Cardinal.mk X = κ := ⟨κ.ord.toType, by simp⟩ + let α : Type u := Σ (S : Set X) (_ : PartialOrder S), + ULift.{u} (PLift (IsCardinalFiltered S κ)) + let (a : α) : PartialOrder a.1 := a.2.1 + let ι (a : α) : CardinalFilteredPoset κ := + { obj := .of a.1 + property := a.2.2.1.1 } + refine ⟨.ofObj ι, inferInstance, fun J ⟨hJ, _⟩ ↦ ?_⟩ + obtain ⟨f⟩ : Cardinal.mk J.obj ≤ Cardinal.mk X := by + simpa [hX] using ((hasCardinalLT_iff_cardinal_mk_lt _ _).1 hJ).le + let e := Equiv.ofInjective _ f.injective + letI : PartialOrder (Set.range f) := PartialOrder.lift e.symm e.symm.injective + let e' : Set.range f ≃o J.obj := { toEquiv := e.symm, map_rel_iff' := by rfl } + exact ⟨_, ⟨⟨Set.range f, inferInstance, + ⟨⟨IsCardinalFiltered.of_equivalence κ e'.symm.equivalence⟩⟩⟩⟩, + ⟨CardinalFilteredPoset.ι.preimageIso (PartOrdEmb.Iso.mk (by exact e'.symm))⟩⟩ + +lemma isCardinalFilteredGenerator_hasCardinalLTWithTerminal : + (hasCardinalLTWithTerminal κ).IsCardinalFilteredGenerator κ where + le_isCardinalPresentable := sorry + exists_colimitsOfShape := sorry + instance : IsCardinalAccessibleCategory (CardinalFilteredPoset κ) κ where - exists_generator := sorry + exists_generator := + ⟨hasCardinalLTWithTerminal κ, inferInstance, + isCardinalFilteredGenerator_hasCardinalLTWithTerminal κ⟩ end CardinalFilteredPoset From a98428dc996439dc26d9773c3c8163a85ee8ff3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 18 Nov 2025 12:17:23 +0100 Subject: [PATCH 178/309] wip --- Mathlib/Order/Category/PartOrdEmb.lean | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Mathlib/Order/Category/PartOrdEmb.lean b/Mathlib/Order/Category/PartOrdEmb.lean index 277de5ea866062..e6c539ea8560e1 100644 --- a/Mathlib/Order/Category/PartOrdEmb.lean +++ b/Mathlib/Order/Category/PartOrdEmb.lean @@ -162,6 +162,14 @@ def orderIsoOfIso {α β : PartOrdEmb.{u}} (e : α ≅ β) : right_inv := ConcreteCategory.congr_hom e.inv_hom_id map_rel_iff' := Hom.le_iff_le _ _ _ +instance : (forget PartOrdEmb.{u}).ReflectsIsomorphisms where + reflects {α β} f hf := by + rw [CategoryTheory.isIso_iff_bijective] at hf + let e : α ≃o β := + { toEquiv := Equiv.ofBijective _ hf + map_rel_iff' := by simp } + exact (Iso.mk e).isIso_hom + /-- `OrderDual` as a functor. -/ @[simps map] def dual : PartOrdEmb ⥤ PartOrdEmb where @@ -313,6 +321,9 @@ instance : HasColimitsOfShape J PartOrdEmb.{u} where instance : PreservesColimitsOfShape J (forget PartOrdEmb.{u}) where +instance : ReflectsColimitsOfShape J (forget PartOrdEmb.{u}) := + reflectsColimitsOfShape_of_reflectsIsomorphisms + instance : HasFilteredColimitsOfSize.{u, u} PartOrdEmb.{u} where HasColimitsOfShape _ := inferInstance From c350666170d6cace5efaca7f15d845cb6fae7d72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 18 Nov 2025 13:11:59 +0100 Subject: [PATCH 179/309] wip --- .../Presentable/CardinalDirectedPoset.lean | 81 ++++++++++++++++++- 1 file changed, 80 insertions(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean index ddb59ceeeb0572..bc221f7f18628b 100644 --- a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean +++ b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean @@ -94,6 +94,12 @@ abbrev CardinalFilteredPoset.ι : namespace CardinalFilteredPoset +variable {κ} in +/-- Constructor for objects in `CardinalFilteredPoset κ`. -/ +abbrev of (J : PartOrdEmb.{u}) [IsCardinalFiltered J κ] : CardinalFilteredPoset κ where + obj := J + property := inferInstance + instance (J : CardinalFilteredPoset κ) : IsCardinalFiltered J.obj κ := J.property instance : HasCardinalFilteredColimits (CardinalFilteredPoset κ) κ where @@ -125,10 +131,83 @@ instance : ObjectProperty.EssentiallySmall.{u} (hasCardinalLTWithTerminal κ) wh ⟨⟨IsCardinalFiltered.of_equivalence κ e'.symm.equivalence⟩⟩⟩⟩, ⟨CardinalFilteredPoset.ι.preimageIso (PartOrdEmb.Iso.mk (by exact e'.symm))⟩⟩ +namespace cocone + +variable {κ} (J : CardinalFilteredPoset κ) + +def indexSet : Set (Set J.obj) := setOf (fun S ↦ HasCardinalLT S κ ∧ HasTerminal S) + +instance (S : indexSet J) : HasTerminal S := S.prop.2 + +instance (S : indexSet J) : IsCardinalFiltered S κ := isCardinalFiltered_of_hasTerminal _ _ + +variable {J} in +lemma singleton_mem_indexSet (j : J.obj) : {j} ∈ indexSet J := + ⟨hasCardinalLT_of_finite _ _ (Cardinal.IsRegular.aleph0_le Fact.out), by + let : OrderTop ({j} : Set J.obj) := { top := ⟨j, rfl⟩, le_top := by simp } + exact isTerminalTop.hasTerminal⟩ + +instance : IsCardinalFiltered (indexSet J) κ := + isCardinalFiltered_preorder _ _ (fun K α hK ↦ by + rw [← hasCardinalLT_iff_cardinal_mk_lt] at hK + let t (k : K) : (α k).val := ⊤_ _ + let m := IsCardinalFiltered.max (fun k ↦ (t k).val) hK + let S : Set J.obj := (⋃ (k : K), α k) ∪ {m} + let : OrderTop S := + { top := ⟨m, by simp [S]⟩ + le_top := by + rintro ⟨s, hs⟩ + simp [S] at hs + obtain rfl | ⟨k, hs⟩ := hs + · simp + · simp only [Subtype.mk_le_mk] + exact leOfHom ((by exact terminal.from (C := (α k).val) ⟨_, hs⟩) ≫ + IsCardinalFiltered.toMax _ hK k) + } + refine ⟨⟨S, ?_, isTerminalTop.hasTerminal⟩, fun k ↦ ?_⟩ + · have hκ : Cardinal.aleph0 ≤ κ := Cardinal.IsRegular.aleph0_le Fact.out + exact hasCardinalLT_union hκ (hasCardinalLT_iUnion _ hK (fun k ↦ (α k).2.1)) + (hasCardinalLT_of_finite _ _ hκ) + · simp only [← Subtype.coe_le_coe, Set.le_eq_subset] + exact subset_trans (Set.subset_iUnion_of_subset k (subset_refl _)) Set.subset_union_left ) + +instance : IsFiltered (indexSet J) := isFiltered_of_isCardinalFiltered _ κ + +@[simps] +def functor : indexSet J ⥤ CardinalFilteredPoset κ where + obj S := of (PartOrdEmb.of S.val) + map {j₁ j₂} f := PartOrdEmb.ofHom + { toFun x := ⟨x, leOfHom f x.2⟩ + inj' := by rintro ⟨x, _⟩ ⟨y, _⟩ h; simpa using h + map_rel_iff' := by rfl } + +end cocone + +variable {κ} in +@[simps] +def cocone (J : CardinalFilteredPoset κ) : Cocone (cocone.functor J) where + pt := J + ι.app _ := PartOrdEmb.ofHom (OrderEmbedding.subtype _) + +variable {κ} in +open cocone in +noncomputable def isColimitCocone (J : CardinalFilteredPoset κ) : + IsColimit (cocone J) := + isColimitOfReflects (CardinalFilteredPoset.ι ⋙ forget PartOrdEmb) (by + refine Types.FilteredColimit.isColimitOf' _ _ (fun x ↦ ?_) (fun j ⟨x, _⟩ ⟨y, _⟩ h ↦ ?_) + · exact ⟨⟨_, singleton_mem_indexSet x⟩, ⟨x, rfl⟩, rfl⟩ + · obtain rfl : x = y := by simpa using h + exact ⟨j, 𝟙 _, rfl⟩) + lemma isCardinalFilteredGenerator_hasCardinalLTWithTerminal : (hasCardinalLTWithTerminal κ).IsCardinalFilteredGenerator κ where le_isCardinalPresentable := sorry - exists_colimitsOfShape := sorry + exists_colimitsOfShape J := + ⟨_, inferInstance, inferInstance, ⟨{ + diag := _ + ι := _ + isColimit := isColimitCocone J + prop_diag_obj j := j.2 }⟩⟩ instance : IsCardinalAccessibleCategory (CardinalFilteredPoset κ) κ where exists_generator := From fccfe95cacb8e228ac20fce7254398cf15abeeb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 18 Nov 2025 14:15:39 +0100 Subject: [PATCH 180/309] wip --- Mathlib/CategoryTheory/Presentable/Basic.lean | 8 ++++++++ .../Presentable/CardinalDirectedPoset.lean | 14 +++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Presentable/Basic.lean b/Mathlib/CategoryTheory/Presentable/Basic.lean index 058150811d5f18..5be6b7f4a23096 100644 --- a/Mathlib/CategoryTheory/Presentable/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/Basic.lean @@ -183,6 +183,14 @@ lemma isCardinalPresentable_iff_of_isEquivalence · intro infer_instance +variable {X} in +lemma IsCardinalPresentable.exists_hom_of_isColimit [IsCardinalPresentable X κ] + {J : Type u₂} [Category.{v₂} J] [EssentiallySmall.{w} J] [IsCardinalFiltered J κ] + {F : J ⥤ C} {c : Cocone F} (hc : IsColimit c) (f : X ⟶ c.pt) : + ∃ (j : J) (f' : X ⟶ F.obj j), f' ≫ c.ι.app j = f := by + have := preservesColimitsOfShape_of_isCardinalPresentable_of_essentiallySmall X κ J + exact Types.jointly_surjective_of_isColimit (isColimitOfPreserves (coyoneda.obj (op X)) hc) f + end section diff --git a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean index bc221f7f18628b..1a26cb6ba77dec 100644 --- a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean +++ b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean @@ -199,9 +199,21 @@ noncomputable def isColimitCocone (J : CardinalFilteredPoset κ) : · obtain rfl : x = y := by simpa using h exact ⟨j, 𝟙 _, rfl⟩) +protected lemma isCardinalPresentable_iff (J : CardinalFilteredPoset κ) : + IsCardinalPresentable J κ ↔ HasCardinalLT J.obj κ := by + refine ⟨fun _ ↦ ?_, fun hJ ↦ ?_⟩ + · have : IsCardinalPresentable J.cocone.pt κ := by assumption + obtain ⟨X, f, hf⟩ := IsCardinalPresentable.exists_hom_of_isColimit κ (isColimitCocone J) (𝟙 _) + have : IsSplitMono f := ⟨_, hf⟩ + exact X.2.1.of_injective f + ((mono_iff_injective _).1 (inferInstanceAs (Mono ((forget _).map f)))) + · sorry + lemma isCardinalFilteredGenerator_hasCardinalLTWithTerminal : (hasCardinalLTWithTerminal κ).IsCardinalFilteredGenerator κ where - le_isCardinalPresentable := sorry + le_isCardinalPresentable := by + rintro J ⟨_, _⟩ + rwa [isCardinalPresentable_iff, J.isCardinalPresentable_iff] exists_colimitsOfShape J := ⟨_, inferInstance, inferInstance, ⟨{ diag := _ From 4a752afa95e723b08fa2c62091e2e17561b5860d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 18 Nov 2025 15:07:46 +0100 Subject: [PATCH 181/309] sorry free --- .../Presentable/CardinalDirectedPoset.lean | 68 ++++++++++++++++--- 1 file changed, 60 insertions(+), 8 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean index 1a26cb6ba77dec..a202118e7f996b 100644 --- a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean +++ b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean @@ -84,7 +84,8 @@ with morphisms given by order embeddings. -/ abbrev CardinalFilteredPoset := (PartOrdEmb.isCardinalFiltered κ).FullSubcategory -variable {κ} in +variable {κ} + /-- The embedding of the category of `κ`-filtered partially ordered types in the category of partially ordered types. -/ @@ -94,12 +95,18 @@ abbrev CardinalFilteredPoset.ι : namespace CardinalFilteredPoset -variable {κ} in /-- Constructor for objects in `CardinalFilteredPoset κ`. -/ abbrev of (J : PartOrdEmb.{u}) [IsCardinalFiltered J κ] : CardinalFilteredPoset κ where obj := J property := inferInstance +lemma Hom.injective {J₁ J₂ : CardinalFilteredPoset κ} (f : J₁ ⟶ J₂) : + Function.Injective f := f.injective + +lemma Hom.le_iff_le {J₁ J₂ : CardinalFilteredPoset κ} (f : J₁ ⟶ J₂) (x₁ x₂ : J₁.obj) : + f x₁ ≤ f x₂ ↔ x₁ ≤ x₂ := + f.hom.le_iff_le + instance (J : CardinalFilteredPoset κ) : IsCardinalFiltered J.obj κ := J.property instance : HasCardinalFilteredColimits (CardinalFilteredPoset κ) κ where @@ -107,6 +114,13 @@ instance : HasCardinalFilteredColimits (CardinalFilteredPoset κ) κ where have := isFiltered_of_isCardinalFiltered J κ infer_instance +instance (A : Type u) [SmallCategory A] [IsCardinalFiltered A κ] : + PreservesColimitsOfShape A (forget (CardinalFilteredPoset κ)) := by + have := isFiltered_of_isCardinalFiltered A κ + change PreservesColimitsOfShape A (CardinalFilteredPoset.ι ⋙ forget _) + infer_instance + +variable (κ) in /-- The property of posets in `CardinalFilteredPoset κ` that are of cardinality `< κ` and have terminal object. -/ def hasCardinalLTWithTerminal : ObjectProperty (CardinalFilteredPoset κ) := @@ -133,7 +147,7 @@ instance : ObjectProperty.EssentiallySmall.{u} (hasCardinalLTWithTerminal κ) wh namespace cocone -variable {κ} (J : CardinalFilteredPoset κ) +variable (J : CardinalFilteredPoset κ) def indexSet : Set (Set J.obj) := setOf (fun S ↦ HasCardinalLT S κ ∧ HasTerminal S) @@ -183,13 +197,11 @@ def functor : indexSet J ⥤ CardinalFilteredPoset κ where end cocone -variable {κ} in @[simps] def cocone (J : CardinalFilteredPoset κ) : Cocone (cocone.functor J) where pt := J ι.app _ := PartOrdEmb.ofHom (OrderEmbedding.subtype _) -variable {κ} in open cocone in noncomputable def isColimitCocone (J : CardinalFilteredPoset κ) : IsColimit (cocone J) := @@ -201,14 +213,54 @@ noncomputable def isColimitCocone (J : CardinalFilteredPoset κ) : protected lemma isCardinalPresentable_iff (J : CardinalFilteredPoset κ) : IsCardinalPresentable J κ ↔ HasCardinalLT J.obj κ := by - refine ⟨fun _ ↦ ?_, fun hJ ↦ ?_⟩ + refine ⟨fun _ ↦ ?_, fun hJ ↦ ⟨fun A _ _ ↦ ⟨fun {F} ↦ ⟨fun {c} hc ↦ ⟨?_⟩⟩⟩⟩⟩ · have : IsCardinalPresentable J.cocone.pt κ := by assumption obtain ⟨X, f, hf⟩ := IsCardinalPresentable.exists_hom_of_isColimit κ (isColimitCocone J) (𝟙 _) have : IsSplitMono f := ⟨_, hf⟩ exact X.2.1.of_injective f ((mono_iff_injective _).1 (inferInstanceAs (Mono ((forget _).map f)))) - · sorry - + · have := isFiltered_of_isCardinalFiltered A κ + replace hc := isColimitOfPreserves (forget _) hc + refine Types.FilteredColimit.isColimitOf' _ _ (fun f ↦ ?_) (fun j f g h ↦ ?_) + · dsimp at f + choose j g hg using fun (x : J.obj) ↦ Types.jointly_surjective_of_isColimit hc (f x) + let m := IsCardinalFiltered.max j hJ + let φ (x : J.obj) : (F.obj m).obj := F.map (IsCardinalFiltered.toMax j hJ x) (g x) + have hφ (x : J.obj) : f x = c.ι.app _ (φ x) := by + dsimp [φ] + rw [← hg, ← ConcreteCategory.comp_apply, c.w] + rfl + refine ⟨m, + PartOrdEmb.ofHom + { toFun := φ + inj' x y h := Hom.injective f (by simpa [hφ]) + map_rel_iff' {x y} := ?_ }, ?_⟩ + · simp only [Function.Embedding.coeFn_mk, + ← Hom.le_iff_le f, hφ, Hom.le_iff_le (c.ι.app m)] + · dsimp + ext x + rw [← hg] + exact ConcreteCategory.congr_hom (c.w (IsCardinalFiltered.toMax j hJ x)).symm (g x) + · choose k a hk using fun (x : J.obj) ↦ + (Types.FilteredColimit.isColimit_eq_iff' hc _ _).1 (ConcreteCategory.congr_hom h x) + dsimp at f g h k a hk ⊢ + obtain ⟨l, b, c, hl⟩ : ∃ (l : A) (c : j ⟶ l) (b : ∀ x, k x ⟶ l), + ∀ x, a x ≫ b x = c := by + let φ (x : J.obj) : j ⟶ IsCardinalFiltered.max k hJ := + a x ≫ IsCardinalFiltered.toMax k hJ x + exact ⟨IsCardinalFiltered.coeq φ hJ, + IsCardinalFiltered.toCoeq φ hJ, + fun x ↦ IsCardinalFiltered.toMax k hJ x ≫ IsCardinalFiltered.coeqHom φ hJ, + fun x ↦ by simpa [φ] using IsCardinalFiltered.coeq_condition φ hJ x⟩ + refine ⟨l, b, ?_⟩ + ext x + dsimp + simp only [ConcreteCategory.comp_apply] + rw [← hl x] + simp only [Functor.map_comp, ConcreteCategory.comp_apply] + exact congr_arg _ (hk x) + +variable (κ) in lemma isCardinalFilteredGenerator_hasCardinalLTWithTerminal : (hasCardinalLTWithTerminal κ).IsCardinalFilteredGenerator κ where le_isCardinalPresentable := by From dce5fa6e1f974a2e41e7df357a16ef0ef2b01109 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 18 Nov 2025 15:35:21 +0100 Subject: [PATCH 182/309] docstrings --- .../Presentable/CardinalDirectedPoset.lean | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean index a202118e7f996b..0cef009a6a945f 100644 --- a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean +++ b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean @@ -5,7 +5,6 @@ Authors: Joël Riou -/ import Mathlib.CategoryTheory.Limits.FullSubcategory import Mathlib.Order.Category.PartOrdEmb -import Mathlib.CategoryTheory.Presentable.Directed import Mathlib.CategoryTheory.Presentable.LocallyPresentable /-! @@ -149,6 +148,8 @@ namespace cocone variable (J : CardinalFilteredPoset κ) +/-- Given `J : CardinalFilteredPoset κ`, this is hte partially ordered set consisting +of subsets of `J.obj` that are of cardinality `< κ` and have a terminal object. -/ def indexSet : Set (Set J.obj) := setOf (fun S ↦ HasCardinalLT S κ ∧ HasTerminal S) instance (S : indexSet J) : HasTerminal S := S.prop.2 @@ -187,22 +188,29 @@ instance : IsCardinalFiltered (indexSet J) κ := instance : IsFiltered (indexSet J) := isFiltered_of_isCardinalFiltered _ κ +/-- Given `J : CardinalFilteredPoset κ`, this is the functor which sends +a subset `S` of `J.obj` of cardinality `< κ` with a terminal object to `S` +as an object in `CardinalFilteredPoset κ`. -/ @[simps] def functor : indexSet J ⥤ CardinalFilteredPoset κ where obj S := of (PartOrdEmb.of S.val) - map {j₁ j₂} f := PartOrdEmb.ofHom + map f := PartOrdEmb.ofHom { toFun x := ⟨x, leOfHom f x.2⟩ inj' := by rintro ⟨x, _⟩ ⟨y, _⟩ h; simpa using h map_rel_iff' := by rfl } end cocone +/-- The (colimit) cocone which expresses `J : CardinalFilteredPoset κ` as a colimit +of its subsets that are of cardinality `< κ` and have a terminal object. -/ @[simps] def cocone (J : CardinalFilteredPoset κ) : Cocone (cocone.functor J) where pt := J ι.app _ := PartOrdEmb.ofHom (OrderEmbedding.subtype _) open cocone in +/-- Any object `J : CardinalFilteredPoset κ` is a colimit +of its subsets that are of cardinality `< κ` and have a terminal object. -/ noncomputable def isColimitCocone (J : CardinalFilteredPoset κ) : IsColimit (cocone J) := isColimitOfReflects (CardinalFilteredPoset.ι ⋙ forget PartOrdEmb) (by From 3e102a958c157cc021da6b7234797352aab9b2a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 18 Nov 2025 16:25:19 +0100 Subject: [PATCH 183/309] wip --- .../Presentable/CardinalDirectedPoset.lean | 26 ++++++++++++------- .../CategoryTheory/Presentable/SharplyLT.lean | 25 ++++++++++++++++++ 2 files changed, 41 insertions(+), 10 deletions(-) create mode 100644 Mathlib/CategoryTheory/Presentable/SharplyLT.lean diff --git a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean index 0cef009a6a945f..2448f04f09c70e 100644 --- a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean +++ b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean @@ -219,15 +219,12 @@ noncomputable def isColimitCocone (J : CardinalFilteredPoset κ) : · obtain rfl : x = y := by simpa using h exact ⟨j, 𝟙 _, rfl⟩) -protected lemma isCardinalPresentable_iff (J : CardinalFilteredPoset κ) : - IsCardinalPresentable J κ ↔ HasCardinalLT J.obj κ := by - refine ⟨fun _ ↦ ?_, fun hJ ↦ ⟨fun A _ _ ↦ ⟨fun {F} ↦ ⟨fun {c} hc ↦ ⟨?_⟩⟩⟩⟩⟩ - · have : IsCardinalPresentable J.cocone.pt κ := by assumption - obtain ⟨X, f, hf⟩ := IsCardinalPresentable.exists_hom_of_isColimit κ (isColimitCocone J) (𝟙 _) - have : IsSplitMono f := ⟨_, hf⟩ - exact X.2.1.of_injective f - ((mono_iff_injective _).1 (inferInstanceAs (Mono ((forget _).map f)))) - · have := isFiltered_of_isCardinalFiltered A κ +lemma isCardinalPresentable_of_hasCardinalLT_of_le (J : CardinalFilteredPoset κ) + {κ' : Cardinal.{u}} [Fact κ'.IsRegular] (hJ : HasCardinalLT J.obj κ') (h : κ ≤ κ') : + IsCardinalPresentable J κ' where + preservesColimitOfShape A _ _ := ⟨fun {F} ↦ ⟨fun {c} hc ↦ ⟨by + · have := isFiltered_of_isCardinalFiltered A κ' + have := IsCardinalFiltered.of_le A h replace hc := isColimitOfPreserves (forget _) hc refine Types.FilteredColimit.isColimitOf' _ _ (fun f ↦ ?_) (fun j f g h ↦ ?_) · dsimp at f @@ -266,7 +263,16 @@ protected lemma isCardinalPresentable_iff (J : CardinalFilteredPoset κ) : simp only [ConcreteCategory.comp_apply] rw [← hl x] simp only [Functor.map_comp, ConcreteCategory.comp_apply] - exact congr_arg _ (hk x) + exact congr_arg _ (hk x)⟩⟩⟩ + +protected lemma isCardinalPresentable_iff (J : CardinalFilteredPoset κ) : + IsCardinalPresentable J κ ↔ HasCardinalLT J.obj κ := by + refine ⟨fun _ ↦ ?_, fun hJ ↦ isCardinalPresentable_of_hasCardinalLT_of_le _ hJ (le_refl _)⟩ + have : IsCardinalPresentable J.cocone.pt κ := by assumption + obtain ⟨X, f, hf⟩ := IsCardinalPresentable.exists_hom_of_isColimit κ (isColimitCocone J) (𝟙 _) + have : IsSplitMono f := ⟨_, hf⟩ + exact X.2.1.of_injective f + ((mono_iff_injective _).1 (inferInstanceAs (Mono ((forget _).map f)))) variable (κ) in lemma isCardinalFilteredGenerator_hasCardinalLTWithTerminal : diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT.lean new file mode 100644 index 00000000000000..68478eff9becff --- /dev/null +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT.lean @@ -0,0 +1,25 @@ +/- +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.CardinalDirectedPoset + +/-! +# Sharply smaller regular cardinals +-/ + +universe w v u + +open CategoryTheory + +namespace Cardinal + +variable {κ₁ κ₂ : Cardinal.{w}} + +structure SharplyLT [Fact κ₁.IsRegular] [Fact κ₂.IsRegular] : Prop where + lt : κ₁ < κ₂ + isCardinalAccessible_cardinalDirectedPoset : + IsCardinalAccessibleCategory (CardinalFilteredPoset κ₁) κ₂ + +end Cardinal From ac29ff39cccbd2fcd8690ad71e24c976594e1932 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 18 Nov 2025 16:35:16 +0100 Subject: [PATCH 184/309] wip --- Mathlib/CategoryTheory/Presentable/Basic.lean | 17 ++++++++++++---- .../CategoryTheory/Presentable/SharplyLT.lean | 20 +++++++++++++++++-- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/Basic.lean b/Mathlib/CategoryTheory/Presentable/Basic.lean index 5be6b7f4a23096..17516dec770987 100644 --- a/Mathlib/CategoryTheory/Presentable/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/Basic.lean @@ -211,16 +211,25 @@ end section -variable (C) (κ : Cardinal.{w}) [Fact κ.IsRegular] - /-- A category has `κ`-filtered colimits if it has colimits of shape `J` for any `κ`-filtered category `J`. -/ -class HasCardinalFilteredColimits : Prop where - hasColimitsOfShape (J : Type w) [SmallCategory J] [IsCardinalFiltered J κ] : +class HasCardinalFilteredColimits + (C : Type u₁) [Category.{v₁} C] (κ : Cardinal.{w}) [Fact κ.IsRegular] : Prop where + hasColimitsOfShape (C) (κ) (J : Type w) [SmallCategory J] [IsCardinalFiltered J κ] : HasColimitsOfShape J C := by intros; infer_instance +variable (C : Type u₁) [Category.{v₁} C] (κ : Cardinal.{w}) [Fact κ.IsRegular] + instance [HasColimitsOfSize.{w, w} C] : HasCardinalFilteredColimits.{w} C κ where +variable {κ} in +lemma HasCardinalFilteredColimits.of_le + [HasCardinalFilteredColimits C κ] {κ' : Cardinal.{w}} [Fact κ'.IsRegular] (h : κ ≤ κ') : + HasCardinalFilteredColimits C κ' where + hasColimitsOfShape J _ _ := by + have := IsCardinalFiltered.of_le J h + exact HasCardinalFilteredColimits.hasColimitsOfShape C κ J + end end CategoryTheory diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT.lean index 68478eff9becff..0df83d15222003 100644 --- a/Mathlib/CategoryTheory/Presentable/SharplyLT.lean +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT.lean @@ -15,11 +15,27 @@ open CategoryTheory namespace Cardinal -variable {κ₁ κ₂ : Cardinal.{w}} +variable {κ₁ κ₂ : Cardinal.{w}} [Fact κ₁.IsRegular] [Fact κ₂.IsRegular] -structure SharplyLT [Fact κ₁.IsRegular] [Fact κ₂.IsRegular] : Prop where +variable (κ₁ κ₂) in +structure SharplyLT : Prop where lt : κ₁ < κ₂ isCardinalAccessible_cardinalDirectedPoset : IsCardinalAccessibleCategory (CardinalFilteredPoset κ₁) κ₂ +namespace SharplyLT + +variable (h : SharplyLT κ₁ κ₂) + +include h +lemma le : κ₁ ≤ κ₂ := h.lt.le + +lemma isCardinalAccessible + (C : Type u) [Category.{v} C] [IsCardinalAccessibleCategory C κ₁] : + IsCardinalAccessibleCategory C κ₂ where + toHasCardinalFilteredColimits := HasCardinalFilteredColimits.of_le C h.le + exists_generator := sorry + +end SharplyLT + end Cardinal From b31764a9858d5716a4ecd67c61c9766912fc2fed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 18 Nov 2025 16:48:38 +0100 Subject: [PATCH 185/309] wip --- Mathlib/CategoryTheory/Presentable/SharplyLT.lean | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT.lean index 0df83d15222003..a794ac310b7c79 100644 --- a/Mathlib/CategoryTheory/Presentable/SharplyLT.lean +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT.lean @@ -25,17 +25,22 @@ structure SharplyLT : Prop where namespace SharplyLT -variable (h : SharplyLT κ₁ κ₂) +lemma le (h : SharplyLT κ₁ κ₂) : κ₁ ≤ κ₂ := h.lt.le -include h -lemma le : κ₁ ≤ κ₂ := h.lt.le - -lemma isCardinalAccessible +lemma isCardinalAccessible (h : SharplyLT κ₁ κ₂) (C : Type u) [Category.{v} C] [IsCardinalAccessibleCategory C κ₁] : IsCardinalAccessibleCategory C κ₂ where toHasCardinalFilteredColimits := HasCardinalFilteredColimits.of_le C h.le exists_generator := sorry +lemma trans (h₁₂ : SharplyLT κ₁ κ₂) {κ₃ : Cardinal.{w}} [Fact κ₃.IsRegular] + (h₂₃ : SharplyLT κ₂ κ₃) : + SharplyLT κ₁ κ₃ where + lt := h₁₂.lt.trans h₂₃.lt + isCardinalAccessible_cardinalDirectedPoset := by + have := h₁₂.isCardinalAccessible_cardinalDirectedPoset + exact h₂₃.isCardinalAccessible _ + end SharplyLT end Cardinal From a45f83333946a6a31903b60f0014ea9a90d83ddf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 26 Dec 2025 21:42:32 +0100 Subject: [PATCH 186/309] fix --- .../Presentable/CardinalFilteredPresentation.lean | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean b/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean index c205f4b26af6f1..e3b7ade10d6e2f 100644 --- a/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean +++ b/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean @@ -15,11 +15,7 @@ public import Mathlib.CategoryTheory.Generator.StrongGenerator Let `C` be a category, a regular cardinal `κ` and `P : ObjectProperty C`. We define a predicate `P.IsCardinalFilteredGenerator κ` saying that -<<<<<<< HEAD -`P` consists of `κ`-presentable objects and that any objects in `C` -======= `P` consists of `κ`-presentable objects and that any object in `C` ->>>>>>> origin/cardinal-directed is a `κ`-filtered colimit of objects satisfying `P`. We show that if this condition is satisfied, then `P` is a strong generator (see `IsCardinalFilteredGenerator.isStrongGenerator`). Moreover, From eb67b8bd494495b0a43db050bc8b0c17232a6564 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 26 Dec 2025 21:45:40 +0100 Subject: [PATCH 187/309] fix --- Mathlib/CategoryTheory/Presentable/Basic.lean | 2 +- Mathlib/CategoryTheory/Presentable/SharplyLT.lean | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/Basic.lean b/Mathlib/CategoryTheory/Presentable/Basic.lean index cf006ff18a4d0c..2e322bfa12dea3 100644 --- a/Mathlib/CategoryTheory/Presentable/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/Basic.lean @@ -286,7 +286,7 @@ variable (κ : Cardinal.{w}) [Fact κ.IsRegular] instance [HasColimitsOfSize.{w, w} C] : HasCardinalFilteredColimits.{w} C κ where -variable {κ} in +variable (C) {κ} in lemma HasCardinalFilteredColimits.of_le [HasCardinalFilteredColimits C κ] {κ' : Cardinal.{w}} [Fact κ'.IsRegular] (h : κ ≤ κ') : HasCardinalFilteredColimits C κ' where diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT.lean index a794ac310b7c79..32d23947779b6c 100644 --- a/Mathlib/CategoryTheory/Presentable/SharplyLT.lean +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT.lean @@ -3,12 +3,16 @@ 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.CardinalDirectedPoset +module + +public import Mathlib.CategoryTheory.Presentable.CardinalDirectedPoset /-! # Sharply smaller regular cardinals -/ +@[expose] public section + universe w v u open CategoryTheory @@ -30,7 +34,7 @@ lemma le (h : SharplyLT κ₁ κ₂) : κ₁ ≤ κ₂ := h.lt.le lemma isCardinalAccessible (h : SharplyLT κ₁ κ₂) (C : Type u) [Category.{v} C] [IsCardinalAccessibleCategory C κ₁] : IsCardinalAccessibleCategory C κ₂ where - toHasCardinalFilteredColimits := HasCardinalFilteredColimits.of_le C h.le + toHasCardinalFilteredColimits := .of_le C h.le exists_generator := sorry lemma trans (h₁₂ : SharplyLT κ₁ κ₂) {κ₃ : Cardinal.{w}} [Fact κ₃.IsRegular] From fc6fa637a669786a47c152bb81ae927430a2c63a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sat, 27 Dec 2025 15:37:54 +0100 Subject: [PATCH 188/309] wip --- .../CategoryTheory/Presentable/SharplyLT.lean | 38 ++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT.lean index 32d23947779b6c..f7563bc4fa1519 100644 --- a/Mathlib/CategoryTheory/Presentable/SharplyLT.lean +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT.lean @@ -5,10 +5,12 @@ Authors: Joël Riou -/ module +public import Mathlib.CategoryTheory.ObjectProperty.ColimitsCardinalClosure public import Mathlib.CategoryTheory.Presentable.CardinalDirectedPoset /-! # Sharply smaller regular cardinals + -/ @[expose] public section @@ -31,11 +33,45 @@ namespace SharplyLT lemma le (h : SharplyLT κ₁ κ₂) : κ₁ ≤ κ₂ := h.lt.le +section + +/-- Whan `k₁` is sharply smaller than `κ₂`, and `C` is a `κ₁`-accessible category, this +is a property of objects which allows to show that `C` is a `κ₂`-accessible category. +This property is defined as the closure of `κ₁`-presentable objects under +colimits of shape `J` for categories `J` such that `Arrow J` is of cardinality `< κ₂`. -/ +def generator (_ : SharplyLT κ₁ κ₂) (C : Type u) [Category.{v} C] : + ObjectProperty C := + (isCardinalPresentable C κ₁).colimitsCardinalClosure κ₂ + +variable (h : SharplyLT κ₁ κ₂) (C : Type u) [Category.{v} C] + +lemma generator_le_sCardinalPresentable [LocallySmall.{w} C] : + h.generator C ≤ isCardinalPresentable C κ₂ := + ObjectProperty.colimitsCardinalClosure_le _ _ + (fun _ _ hJ ↦ isClosedUnderColimitsOfShape_isCardinalPresentable C hJ) + (isCardinalPresentable_monotone _ h.le) + +instance [IsCardinalAccessibleCategory C κ₁] : + ObjectProperty.EssentiallySmall.{w} (h.generator C) := by + dsimp [generator] + infer_instance + +variable [IsCardinalAccessibleCategory C κ₁] + +lemma isCardinalFilteredGenerator : + (h.generator C).IsCardinalFilteredGenerator κ₂ where + le_isCardinalPresentable := h.generator_le_sCardinalPresentable C + exists_colimitsOfShape X := by + sorry + +end + lemma isCardinalAccessible (h : SharplyLT κ₁ κ₂) (C : Type u) [Category.{v} C] [IsCardinalAccessibleCategory C κ₁] : IsCardinalAccessibleCategory C κ₂ where toHasCardinalFilteredColimits := .of_le C h.le - exists_generator := sorry + exists_generator := + ⟨_, inferInstance, h.isCardinalFilteredGenerator C⟩ lemma trans (h₁₂ : SharplyLT κ₁ κ₂) {κ₃ : Cardinal.{w}} [Fact κ₃.IsRegular] (h₂₃ : SharplyLT κ₂ κ₃) : From b1f4ff99e34e3450aa7d76ce3fd64be803bee2c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sat, 27 Dec 2025 16:14:04 +0100 Subject: [PATCH 189/309] wip --- .../CategoryTheory/Presentable/SharplyLT.lean | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT.lean index f7563bc4fa1519..d2ccedd2fe619f 100644 --- a/Mathlib/CategoryTheory/Presentable/SharplyLT.lean +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT.lean @@ -17,7 +17,7 @@ public import Mathlib.CategoryTheory.Presentable.CardinalDirectedPoset universe w v u -open CategoryTheory +open CategoryTheory Limits namespace Cardinal @@ -58,6 +58,32 @@ instance [IsCardinalAccessibleCategory C κ₁] : variable [IsCardinalAccessibleCategory C κ₁] +namespace isCardinalFilteredGenerator + +def prop (_ : SharplyLT κ₁ κ₂) (J : Type w) [PartialOrder J] (A : Set J) : Prop := + IsCardinalFiltered (Subtype A) κ₁ ∧ HasCardinalLT (Subtype A) κ₂ + +variable {C} {X : C} {J : Type w} [PartialOrder J] [IsCardinalFiltered J κ₁] + (p : (isCardinalPresentable C κ₁).ColimitOfShape J X) + +instance (A : Subtype (prop h J)) : + HasColimit ((Subtype.mono_coe A.val).functor ⋙ p.diag) := by + have := A.prop.1 + infer_instance + +variable {h} in +noncomputable def colimit (A : Subtype (prop h J)) : C := + Limits.colimit ((Subtype.mono_coe A.val).functor ⋙ p.diag) + +noncomputable def functor : Subtype (prop h J) ⥤ C where + obj A := colimit p A + map {A₁ A₂} f := by + sorry + map_id := sorry + map_comp := sorry + +end isCardinalFilteredGenerator + lemma isCardinalFilteredGenerator : (h.generator C).IsCardinalFilteredGenerator κ₂ where le_isCardinalPresentable := h.generator_le_sCardinalPresentable C From 4dd79190e975b33f79e4e7117a435543b685f253 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Wed, 20 May 2026 22:00:35 +0200 Subject: [PATCH 190/309] wip --- .../Presentable/CardinalDirectedPoset.lean | 9 +- .../CategoryTheory/Presentable/SharplyLT.lean | 96 +++++++++++++++++-- 2 files changed, 93 insertions(+), 12 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean index 9068f4a606ae85..7cd825f760e23e 100644 --- a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean +++ b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean @@ -56,7 +56,7 @@ lemma isCardinalFiltered_pt (hF : ∀ j, IsCardinalFiltered (F.obj j) κ) : let j := IsCardinalFiltered.max j₀ hK let x₁ (k : K) : F.obj j := F.map (IsCardinalFiltered.toMax j₀ hK k) (x₀ k) have hx₁ (k : K) : c.ι.app j (x₁ k) = c.ι.app (j₀ k) (x₀ k) := - congr_fun (c.w (IsCardinalFiltered.toMax j₀ hK k)) _ + ConcreteCategory.congr_hom (c.w (IsCardinalFiltered.toMax j₀ hK k)) _ refine ⟨(cocone hc).ι.app j (IsCardinalFiltered.max x₁ hK), fun k ↦ ?_⟩ rw [← hx₀, ← hx₁] @@ -222,6 +222,7 @@ noncomputable def isColimitCocone (J : CardinalFilteredPoset κ) : · obtain rfl : x = y := by simpa using h exact ⟨j, 𝟙 _, rfl⟩) +set_option backward.isDefEq.respectTransparency false in lemma isCardinalPresentable_of_hasCardinalLT_of_le (J : CardinalFilteredPoset κ) {κ' : Cardinal.{u}} [Fact κ'.IsRegular] (hJ : HasCardinalLT J.obj κ') (h : κ ≤ κ') : IsCardinalPresentable J κ' where @@ -271,9 +272,13 @@ protected lemma isCardinalPresentable_iff (J : CardinalFilteredPoset κ) : refine ⟨fun _ ↦ ?_, fun hJ ↦ isCardinalPresentable_of_hasCardinalLT_of_le _ hJ (le_refl _)⟩ have : IsCardinalPresentable J.cocone.pt κ := by assumption obtain ⟨X, f, hf⟩ := IsCardinalPresentable.exists_hom_of_isColimit κ (isColimitCocone J) (𝟙 _) + dsimp at f have : IsSplitMono f := ⟨_, hf⟩ + have : IsSplitMono ((forget _).map f) := by + -- `infer_instance` fails + apply CategoryTheory.instIsSplitMonoMap exact X.2.1.of_injective f - ((mono_iff_injective _).1 (inferInstanceAs (Mono ((forget _).map f)))) + ((mono_iff_injective ((forget _).map f)).1 inferInstance) variable (κ) in lemma isCardinalFilteredGenerator_hasCardinalLTWithTerminal : diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT.lean index d2ccedd2fe619f..3a8b280b4a35a8 100644 --- a/Mathlib/CategoryTheory/Presentable/SharplyLT.lean +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT.lean @@ -7,6 +7,7 @@ module public import Mathlib.CategoryTheory.ObjectProperty.ColimitsCardinalClosure public import Mathlib.CategoryTheory.Presentable.CardinalDirectedPoset +public import Mathlib.CategoryTheory.Presentable.Dense /-! # Sharply smaller regular cardinals @@ -45,7 +46,7 @@ def generator (_ : SharplyLT κ₁ κ₂) (C : Type u) [Category.{v} C] : variable (h : SharplyLT κ₁ κ₂) (C : Type u) [Category.{v} C] -lemma generator_le_sCardinalPresentable [LocallySmall.{w} C] : +lemma generator_le_isCardinalPresentable [LocallySmall.{w} C] : h.generator C ≤ isCardinalPresentable C κ₂ := ObjectProperty.colimitsCardinalClosure_le _ _ (fun _ _ hJ ↦ isClosedUnderColimitsOfShape_isCardinalPresentable C hJ) @@ -63,7 +64,7 @@ namespace isCardinalFilteredGenerator def prop (_ : SharplyLT κ₁ κ₂) (J : Type w) [PartialOrder J] (A : Set J) : Prop := IsCardinalFiltered (Subtype A) κ₁ ∧ HasCardinalLT (Subtype A) κ₂ -variable {C} {X : C} {J : Type w} [PartialOrder J] [IsCardinalFiltered J κ₁] +variable {h} {C} {X : C} {J : Type w} [PartialOrder J] (p : (isCardinalPresentable C κ₁).ColimitOfShape J X) instance (A : Subtype (prop h J)) : @@ -71,24 +72,99 @@ instance (A : Subtype (prop h J)) : have := A.prop.1 infer_instance -variable {h} in -noncomputable def colimit (A : Subtype (prop h J)) : C := +noncomputable abbrev colimit (A : Subtype (prop h J)) : C := Limits.colimit ((Subtype.mono_coe A.val).functor ⋙ p.diag) +noncomputable abbrev colimit.ι (A : Subtype (prop h J)) (a : J) (ha : a ∈ A.val) : + p.diag.obj a ⟶ colimit p A := + Limits.colimit.ι ((Subtype.mono_coe A.val).functor ⋙ p.diag) ⟨a, ha⟩ + +@[reassoc (attr := simp)] +lemma colimit.w (A : Subtype (prop h J)) {a b : J} (hab : a ≤ b) (ha : a ∈ A.val) + (hb : b ∈ A.val) : + p.diag.map (homOfLE hab) ≫ colimit.ι p A b hb = colimit.ι p A a ha := + Limits.colimit.w ((Subtype.mono_coe A.val).functor ⋙ p.diag) + (j := ⟨a, ha⟩) (j' := ⟨b, hb⟩) (homOfLE hab) + +noncomputable def colimit.map {A₁ A₂ : Subtype (prop h J)} (hA : A₁ ≤ A₂) : + colimit p A₁ ⟶ colimit p A₂ := + colimit.desc _ (Cocone.mk _ + { app j := colimit.ι p A₂ j.val (hA j.prop) + naturality j₁ j₂ f := by + simpa using colimit.w p A₂ (leOfHom f) (hA j₁.prop) (hA j₂.prop) }) + +@[reassoc (attr := simp)] +lemma colimit.ι_map {A₁ A₂ : Subtype (prop h J)} (hA : A₁ ≤ A₂) (j : J) (hj : j ∈ A₁.val) : + colimit.ι p A₁ j hj ≫ colimit.map p hA = colimit.ι p A₂ j (hA hj) := + colimit.ι_desc .. + +@[ext high] +lemma colimit.hom_ext {A : Subtype (prop h J)} {T : C} {φ₁ φ₂ : colimit p A ⟶ T} + (h : ∀ (j : J) (hj : j ∈ A.val), colimit.ι p A j hj ≫ φ₁ = colimit.ι p A j hj ≫ φ₂) : + φ₁ = φ₂ := by + ext + apply h + +noncomputable def colimit.π (A : Subtype (prop h J)) : colimit p A ⟶ X := + colimit.desc _ (Cocone.mk _ + { app a := by exact p.ι.app a + naturality _ _ _ := by simpa using p.ι.naturality _ }) + +@[reassoc (attr := simp)] +lemma colimit.ι_π (A : Subtype (prop h J)) (a : J) (ha : a ∈ A.val) : + colimit.ι p A a ha ≫ colimit.π p A = p.ι.app a := + colimit.ι_desc .. + +@[reassoc (attr := simp)] +lemma colimit.map_π {A₁ A₂ : Subtype (prop h J)} (hA : A₁ ≤ A₂) : + colimit.map p hA ≫ colimit.π p A₂ = colimit.π p A₁ := by + ext + simp + +variable (h) in +@[simps] noncomputable def functor : Subtype (prop h J) ⥤ C where obj A := colimit p A - map {A₁ A₂} f := by - sorry - map_id := sorry - map_comp := sorry + map f := colimit.map p f.le + map_id _ := by ext; simp + map_comp f g := by ext; simp + +variable (h) in +@[simps] +noncomputable def cocone : Cocone (functor h p) where + pt := X + ι.app j := colimit.π p j + +variable (h) in +def isColimit [IsCardinalFiltered J κ₁] : IsColimit (cocone h p) := sorry end isCardinalFilteredGenerator +open isCardinalFilteredGenerator in lemma isCardinalFilteredGenerator : (h.generator C).IsCardinalFilteredGenerator κ₂ where - le_isCardinalPresentable := h.generator_le_sCardinalPresentable C + le_isCardinalPresentable := h.generator_le_isCardinalPresentable C exists_colimitsOfShape X := by - sorry + have hκ₁ := isCardinalFilteredGenerator_isCardinalPresentable C κ₁ + --obtain ⟨J, _, _, ⟨p⟩⟩ := hκ₁.exists_colimitsOfShape X + -- use `Directed.lean` + have J : Type w := sorry + have : PartialOrder J := sorry + have : IsCardinalFiltered J κ₁ := sorry + have p : (isCardinalPresentable C κ₁).ColimitOfShape J X := sorry + refine ⟨Subtype (prop h J), inferInstance, sorry, ⟨{ + diag := _ + ι := _ + isColimit := isColimit h p + prop_diag_obj A := by + have : (h.generator C).IsClosedUnderColimitsOfShape (Subtype A.val) := by + apply ObjectProperty.isClosedUnderColimitsOfShape_colimitsCardinalClosure + have := A.prop.2 + sorry + exact ObjectProperty.prop_colimit _ _ + (fun ⟨a, ha⟩ ↦ ObjectProperty.le_colimitsCardinalClosure _ _ _ + (p.prop_diag_obj a)) + }⟩⟩ end From f2e156125ab56b16ac95d42f0e47b8e35ff941fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Wed, 20 May 2026 22:45:44 +0200 Subject: [PATCH 191/309] wip --- .../CategoryTheory/Presentable/SharplyLT.lean | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT.lean index 3a8b280b4a35a8..767100b3723941 100644 --- a/Mathlib/CategoryTheory/Presentable/SharplyLT.lean +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT.lean @@ -8,6 +8,7 @@ module public import Mathlib.CategoryTheory.ObjectProperty.ColimitsCardinalClosure public import Mathlib.CategoryTheory.Presentable.CardinalDirectedPoset public import Mathlib.CategoryTheory.Presentable.Dense +public import Mathlib.CategoryTheory.Presentable.Directed /-! # Sharply smaller regular cardinals @@ -138,6 +139,9 @@ noncomputable def cocone : Cocone (functor h p) where variable (h) in def isColimit [IsCardinalFiltered J κ₁] : IsColimit (cocone h p) := sorry +instance [IsCardinalFiltered J κ₁] : IsCardinalFiltered (Subtype (prop h J)) κ₂ := by + sorry + end isCardinalFilteredGenerator open isCardinalFilteredGenerator in @@ -146,25 +150,21 @@ lemma isCardinalFilteredGenerator : le_isCardinalPresentable := h.generator_le_isCardinalPresentable C exists_colimitsOfShape X := by have hκ₁ := isCardinalFilteredGenerator_isCardinalPresentable C κ₁ - --obtain ⟨J, _, _, ⟨p⟩⟩ := hκ₁.exists_colimitsOfShape X - -- use `Directed.lean` - have J : Type w := sorry - have : PartialOrder J := sorry - have : IsCardinalFiltered J κ₁ := sorry - have p : (isCardinalPresentable C κ₁).ColimitOfShape J X := sorry - refine ⟨Subtype (prop h J), inferInstance, sorry, ⟨{ - diag := _ - ι := _ - isColimit := isColimit h p - prop_diag_obj A := by - have : (h.generator C).IsClosedUnderColimitsOfShape (Subtype A.val) := by - apply ObjectProperty.isClosedUnderColimitsOfShape_colimitsCardinalClosure - have := A.prop.2 - sorry - exact ObjectProperty.prop_colimit _ _ - (fun ⟨a, ha⟩ ↦ ObjectProperty.le_colimitsCardinalClosure _ _ _ - (p.prop_diag_obj a)) - }⟩⟩ + obtain ⟨J, _, _, ⟨p⟩⟩ : + ∃ (J : Type w) (_ : PartialOrder J) (_ : IsCardinalFiltered J κ₁), + Nonempty ((isCardinalPresentable C κ₁).ColimitOfShape J X) := by + obtain ⟨J₀, _, _, ⟨p₀⟩⟩ := hκ₁.exists_colimitsOfShape X + obtain ⟨J, _, _, F, _⟩ := IsCardinalFiltered.exists_cardinal_directed J₀ κ₁ + exact ⟨_, _, inferInstance, ⟨p₀.reindex F⟩⟩ + refine ⟨Subtype (prop h J), inferInstance, inferInstance, + ⟨{ diag := _, ι := _, isColimit := isColimit h p, prop_diag_obj A := ?_ }⟩⟩ + have : (h.generator C).IsClosedUnderColimitsOfShape (Subtype A.val) := by + apply ObjectProperty.isClosedUnderColimitsOfShape_colimitsCardinalClosure + have := A.prop.2 + sorry + exact ObjectProperty.prop_colimit _ _ + (fun ⟨a, ha⟩ ↦ ObjectProperty.le_colimitsCardinalClosure _ _ _ + (p.prop_diag_obj a)) end From 9d989b7c060bcbaa914d68f637dd44660e48fd47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 21 May 2026 13:02:44 +0200 Subject: [PATCH 192/309] =?UTF-8?q?feat(CategoryTheory):=20the=20=CE=BA-ac?= =?UTF-8?q?cessible=20category=20of=20=CE=BA-directed=20posets?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Mathlib.lean | 1 + .../Presentable/CardinalDirectedPoset.lean | 303 ++++++++++++++++++ Mathlib/Order/Category/PartOrdEmb.lean | 21 ++ 3 files changed, 325 insertions(+) create mode 100644 Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean diff --git a/Mathlib.lean b/Mathlib.lean index 8b73416360a46f..16a42b1c2d17ab 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -3234,6 +3234,7 @@ public import Mathlib.CategoryTheory.Preadditive.Yoneda.Limits public import Mathlib.CategoryTheory.Preadditive.Yoneda.Projective public import Mathlib.CategoryTheory.Presentable.Adjunction public import Mathlib.CategoryTheory.Presentable.Basic +public import Mathlib.CategoryTheory.Presentable.CardinalDirectedPoset public import Mathlib.CategoryTheory.Presentable.CardinalFilteredPresentation public import Mathlib.CategoryTheory.Presentable.ColimitPresentation public import Mathlib.CategoryTheory.Presentable.Dense diff --git a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean new file mode 100644 index 00000000000000..7cd825f760e23e --- /dev/null +++ b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean @@ -0,0 +1,303 @@ +/- +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.Limits.FullSubcategory +public import Mathlib.Order.Category.PartOrdEmb +public import Mathlib.CategoryTheory.Presentable.LocallyPresentable + +/-! +# The κ-accessible category of κ-directed posets + +Given a regular cardinal `κ : Cardinal.{u}`, we define the +category `CardinalFilteredPoset κ` of `κ`-directed partially ordered +types (with order embeddings as morphisms), and we show that it is +a `κ`-accessible category. + +-/ + +@[expose] public section + +universe u + +open CategoryTheory Limits + +namespace PartOrdEmb + +variable (κ : Cardinal.{u}) [Fact κ.IsRegular] + +/-- The property of objects in `PartOrdEmb` that are +satisfied by partially ordered types of cardinality `< κ`. -/ +abbrev isCardinalFiltered : ObjectProperty PartOrdEmb.{u} := + fun X ↦ IsCardinalFiltered X κ + +@[simp] +lemma isCardinalFiltered_iff (X : PartOrdEmb.{u}) : + isCardinalFiltered κ X ↔ IsCardinalFiltered X κ := Iff.rfl + +instance : (isCardinalFiltered κ).IsClosedUnderIsomorphisms where + of_iso e _ := .of_equivalence κ (orderIsoOfIso e).equivalence + +namespace Limits.CoconePt + +variable {κ} {J : Type u} [SmallCategory J] [IsCardinalFiltered J κ] + {F : J ⥤ PartOrdEmb.{u}} {c : Cocone (F ⋙ forget _)} (hc : IsColimit c) + +lemma isCardinalFiltered_pt (hF : ∀ j, IsCardinalFiltered (F.obj j) κ) : + letI := isFiltered_of_isCardinalFiltered J κ + IsCardinalFiltered (CoconePt hc) κ := by + letI := isFiltered_of_isCardinalFiltered J κ + refine isCardinalFiltered_preorder _ _ (fun K f hK ↦ ?_) + rw [← hasCardinalLT_iff_cardinal_mk_lt] at hK + choose j₀ x₀ hx₀ using fun k ↦ Types.jointly_surjective_of_isColimit hc (f k) + let j := IsCardinalFiltered.max j₀ hK + let x₁ (k : K) : F.obj j := F.map (IsCardinalFiltered.toMax j₀ hK k) (x₀ k) + have hx₁ (k : K) : c.ι.app j (x₁ k) = c.ι.app (j₀ k) (x₀ k) := + ConcreteCategory.congr_hom (c.w (IsCardinalFiltered.toMax j₀ hK k)) _ + refine ⟨(cocone hc).ι.app j (IsCardinalFiltered.max x₁ hK), + fun k ↦ ?_⟩ + rw [← hx₀, ← hx₁] + exact ((cocone hc).ι.app j).hom.monotone + (leOfHom (IsCardinalFiltered.toMax x₁ hK k)) + +end Limits.CoconePt + +instance (J : Type u) [SmallCategory J] [IsCardinalFiltered J κ] : + (isCardinalFiltered κ).IsClosedUnderColimitsOfShape J where + colimitsOfShape_le := by + have := isFiltered_of_isCardinalFiltered J κ + rintro X ⟨p⟩ + simp only [(isCardinalFiltered κ).prop_iff_of_iso + (p.isColimit.coconePointUniqueUpToIso + (Limits.isColimitCocone (colimit.isColimit (p.diag ⋙ forget PartOrdEmb)))), + isCardinalFiltered_iff, Limits.cocone_pt_coe] + exact Limits.CoconePt.isCardinalFiltered_pt _ p.prop_diag_obj + +end PartOrdEmb + +namespace CategoryTheory + +variable (κ : Cardinal.{u}) [Fact κ.IsRegular] + +/-- The category of `κ`-filtered partially ordered types, +with morphisms given by order embeddings. -/ +abbrev CardinalFilteredPoset := + (PartOrdEmb.isCardinalFiltered κ).FullSubcategory + +variable {κ} + +/-- The embedding of the category of `κ`-filtered +partially ordered types in the category of partially +ordered types. -/ +abbrev CardinalFilteredPoset.ι : + CardinalFilteredPoset κ ⥤ PartOrdEmb := + ObjectProperty.ι _ + +namespace CardinalFilteredPoset + +/-- Constructor for objects in `CardinalFilteredPoset κ`. -/ +abbrev of (J : PartOrdEmb.{u}) [IsCardinalFiltered J κ] : CardinalFilteredPoset κ where + obj := J + property := inferInstance + +lemma Hom.injective {J₁ J₂ : CardinalFilteredPoset κ} (f : J₁ ⟶ J₂) : + Function.Injective f := f.hom.injective + +lemma Hom.le_iff_le {J₁ J₂ : CardinalFilteredPoset κ} (f : J₁ ⟶ J₂) (x₁ x₂ : J₁.obj) : + f x₁ ≤ f x₂ ↔ x₁ ≤ x₂ := + f.hom.hom.le_iff_le + +instance (J : CardinalFilteredPoset κ) : IsCardinalFiltered J.obj κ := J.property + +instance : HasCardinalFilteredColimits (CardinalFilteredPoset κ) κ where + hasColimitsOfShape J _ _ := by + have := isFiltered_of_isCardinalFiltered J κ + infer_instance + +instance (A : Type u) [SmallCategory A] [IsCardinalFiltered A κ] : + PreservesColimitsOfShape A (forget (CardinalFilteredPoset κ)) := by + have := isFiltered_of_isCardinalFiltered A κ + change PreservesColimitsOfShape A (CardinalFilteredPoset.ι ⋙ forget _) + infer_instance + +variable (κ) in +/-- The property of posets in `CardinalFilteredPoset κ` that are +of cardinality `< κ` and have terminal object. -/ +def hasCardinalLTWithTerminal : ObjectProperty (CardinalFilteredPoset κ) := + fun J ↦ HasCardinalLT J.obj κ ∧ HasTerminal J.obj + +instance : ObjectProperty.EssentiallySmall.{u} (hasCardinalLTWithTerminal κ) where + exists_small_le' := by + obtain ⟨X, hX⟩ : ∃ (X : Type u), Cardinal.mk X = κ := ⟨κ.ord.ToType, by simp⟩ + let α : Type u := Σ (S : Set X) (_ : PartialOrder S), + ULift.{u} (PLift (IsCardinalFiltered S κ)) + let (a : α) : PartialOrder a.1 := a.2.1 + let ι (a : α) : CardinalFilteredPoset κ := + { obj := .of a.1 + property := a.2.2.1.1 } + refine ⟨.ofObj ι, inferInstance, fun J ⟨hJ, _⟩ ↦ ?_⟩ + obtain ⟨f⟩ : Cardinal.mk J.obj ≤ Cardinal.mk X := by + simpa [hX] using ((hasCardinalLT_iff_cardinal_mk_lt _ _).1 hJ).le + let e := Equiv.ofInjective _ f.injective + letI : PartialOrder (Set.range f) := PartialOrder.lift e.symm e.symm.injective + let e' : Set.range f ≃o J.obj := { toEquiv := e.symm, map_rel_iff' := by rfl } + exact ⟨_, ⟨⟨Set.range f, inferInstance, + ⟨⟨IsCardinalFiltered.of_equivalence κ e'.symm.equivalence⟩⟩⟩⟩, + ⟨CardinalFilteredPoset.ι.preimageIso (PartOrdEmb.Iso.mk (by exact e'.symm))⟩⟩ + +namespace cocone + +variable (J : CardinalFilteredPoset κ) + +/-- Given `J : CardinalFilteredPoset κ`, this is hte partially ordered set consisting +of subsets of `J.obj` that are of cardinality `< κ` and have a terminal object. -/ +def indexSet : Set (Set J.obj) := setOf (fun S ↦ HasCardinalLT S κ ∧ HasTerminal S) + +instance (S : indexSet J) : HasTerminal S := S.prop.2 + +instance (S : indexSet J) : IsCardinalFiltered S κ := isCardinalFiltered_of_hasTerminal _ _ + +variable {J} in +lemma singleton_mem_indexSet (j : J.obj) : {j} ∈ indexSet J := + ⟨hasCardinalLT_of_finite _ _ (Cardinal.IsRegular.aleph0_le Fact.out), by + let : OrderTop ({j} : Set J.obj) := { top := ⟨j, rfl⟩, le_top := by simp } + exact isTerminalTop.hasTerminal⟩ + +instance : IsCardinalFiltered (indexSet J) κ := + isCardinalFiltered_preorder _ _ (fun K α hK ↦ by + rw [← hasCardinalLT_iff_cardinal_mk_lt] at hK + let t (k : K) : (α k).val := ⊤_ _ + let m := IsCardinalFiltered.max (fun k ↦ (t k).val) hK + let S : Set J.obj := (⋃ (k : K), α k) ∪ {m} + let : OrderTop S := + { top := ⟨m, by simp [S]⟩ + le_top := by + rintro ⟨s, hs⟩ + simp only [Set.union_singleton, Set.mem_insert_iff, Set.mem_iUnion, S] at hs + obtain rfl | ⟨k, hs⟩ := hs + · simp + · simp only [Subtype.mk_le_mk] + exact leOfHom ((by exact terminal.from (C := (α k).val) ⟨_, hs⟩) ≫ + IsCardinalFiltered.toMax _ hK k) } + refine ⟨⟨S, ?_, isTerminalTop.hasTerminal⟩, fun k ↦ ?_⟩ + · have hκ : Cardinal.aleph0 ≤ κ := Cardinal.IsRegular.aleph0_le Fact.out + exact hasCardinalLT_union hκ (hasCardinalLT_iUnion _ hK (fun k ↦ (α k).2.1)) + (hasCardinalLT_of_finite _ _ hκ) + · simp only [← Subtype.coe_le_coe, Set.le_eq_subset] + exact subset_trans (Set.subset_iUnion_of_subset k (subset_refl _)) Set.subset_union_left ) + +instance : IsFiltered (indexSet J) := isFiltered_of_isCardinalFiltered _ κ + +/-- Given `J : CardinalFilteredPoset κ`, this is the functor which sends +a subset `S` of `J.obj` of cardinality `< κ` with a terminal object to `S` +as an object in `CardinalFilteredPoset κ`. -/ +@[simps] +def functor : indexSet J ⥤ CardinalFilteredPoset κ where + obj S := of (PartOrdEmb.of S.val) + map f := ObjectProperty.homMk (PartOrdEmb.ofHom + { toFun x := ⟨x, leOfHom f x.2⟩ + inj' := by rintro ⟨x, _⟩ ⟨y, _⟩ h; simpa using h + map_rel_iff' := by rfl }) + +end cocone + +/-- The (colimit) cocone which expresses `J : CardinalFilteredPoset κ` as a colimit +of its subsets that are of cardinality `< κ` and have a terminal object. -/ +@[simps] +def cocone (J : CardinalFilteredPoset κ) : Cocone (cocone.functor J) where + pt := J + ι.app _ := ObjectProperty.homMk (PartOrdEmb.ofHom (OrderEmbedding.subtype _)) + +open cocone in +/-- Any object `J : CardinalFilteredPoset κ` is a colimit +of its subsets that are of cardinality `< κ` and have a terminal object. -/ +noncomputable def isColimitCocone (J : CardinalFilteredPoset κ) : + IsColimit (cocone J) := + isColimitOfReflects (CardinalFilteredPoset.ι ⋙ forget PartOrdEmb) (by + refine Types.FilteredColimit.isColimitOf' _ _ (fun x ↦ ?_) (fun j ⟨x, _⟩ ⟨y, _⟩ h ↦ ?_) + · exact ⟨⟨_, singleton_mem_indexSet x⟩, ⟨x, rfl⟩, rfl⟩ + · obtain rfl : x = y := by simpa using h + exact ⟨j, 𝟙 _, rfl⟩) + +set_option backward.isDefEq.respectTransparency false in +lemma isCardinalPresentable_of_hasCardinalLT_of_le (J : CardinalFilteredPoset κ) + {κ' : Cardinal.{u}} [Fact κ'.IsRegular] (hJ : HasCardinalLT J.obj κ') (h : κ ≤ κ') : + IsCardinalPresentable J κ' where + preservesColimitOfShape A _ _ := ⟨fun {F} ↦ ⟨fun {c} hc ↦ ⟨by + · have := isFiltered_of_isCardinalFiltered A κ' + have := IsCardinalFiltered.of_le A h + replace hc := isColimitOfPreserves (forget _) hc + refine Types.FilteredColimit.isColimitOf' _ _ (fun f ↦ ?_) (fun j f g h ↦ ?_) + · dsimp at f + choose j g hg using fun (x : J.obj) ↦ Types.jointly_surjective_of_isColimit hc (f x) + let m := IsCardinalFiltered.max j hJ + let φ (x : J.obj) : (F.obj m).obj := F.map (IsCardinalFiltered.toMax j hJ x) (g x) + have hφ (x : J.obj) : f x = c.ι.app _ (φ x) := by + dsimp [φ] + rw [← hg, ← ConcreteCategory.comp_apply, c.w] + rfl + refine ⟨m, + ObjectProperty.homMk (PartOrdEmb.ofHom + { toFun := φ + inj' x y h := Hom.injective f (by simpa [hφ]) + map_rel_iff' {x y} := ?_ }), ?_⟩ + · simp only [Function.Embedding.coeFn_mk, + ← Hom.le_iff_le f, hφ, Hom.le_iff_le (c.ι.app m)] + · dsimp + ext x + exact (hg x).symm.trans + (ConcreteCategory.congr_hom (c.w (IsCardinalFiltered.toMax j hJ x)).symm (g x)) + · choose k a hk using fun (x : J.obj) ↦ + (Types.FilteredColimit.isColimit_eq_iff' hc _ _).1 (ConcreteCategory.congr_hom h x) + dsimp at f g h k a hk ⊢ + obtain ⟨l, b, c, hl⟩ : ∃ (l : A) (c : j ⟶ l) (b : ∀ x, k x ⟶ l), + ∀ x, a x ≫ b x = c := by + let φ (x : J.obj) : j ⟶ IsCardinalFiltered.max k hJ := + a x ≫ IsCardinalFiltered.toMax k hJ x + exact ⟨IsCardinalFiltered.coeq φ hJ, + IsCardinalFiltered.toCoeq φ hJ, + fun x ↦ IsCardinalFiltered.toMax k hJ x ≫ IsCardinalFiltered.coeqHom φ hJ, + fun x ↦ by simpa [φ] using IsCardinalFiltered.coeq_condition φ hJ x⟩ + refine ⟨l, b, ?_⟩ + ext x + simpa only [← hl x, Functor.map_comp, ObjectProperty.FullSubcategory.comp_hom, + PartOrdEmb.hom_comp, RelEmbedding.coe_trans, Function.comp_apply] + using congr_arg _ (hk x)⟩⟩⟩ + +protected lemma isCardinalPresentable_iff (J : CardinalFilteredPoset κ) : + IsCardinalPresentable J κ ↔ HasCardinalLT J.obj κ := by + refine ⟨fun _ ↦ ?_, fun hJ ↦ isCardinalPresentable_of_hasCardinalLT_of_le _ hJ (le_refl _)⟩ + have : IsCardinalPresentable J.cocone.pt κ := by assumption + obtain ⟨X, f, hf⟩ := IsCardinalPresentable.exists_hom_of_isColimit κ (isColimitCocone J) (𝟙 _) + dsimp at f + have : IsSplitMono f := ⟨_, hf⟩ + have : IsSplitMono ((forget _).map f) := by + -- `infer_instance` fails + apply CategoryTheory.instIsSplitMonoMap + exact X.2.1.of_injective f + ((mono_iff_injective ((forget _).map f)).1 inferInstance) + +variable (κ) in +lemma isCardinalFilteredGenerator_hasCardinalLTWithTerminal : + (hasCardinalLTWithTerminal κ).IsCardinalFilteredGenerator κ where + le_isCardinalPresentable := by + rintro J ⟨_, _⟩ + rwa [isCardinalPresentable_iff, J.isCardinalPresentable_iff] + exists_colimitsOfShape J := + ⟨_, inferInstance, inferInstance, ⟨{ + diag := _ + ι := _ + isColimit := isColimitCocone J + prop_diag_obj j := j.2 }⟩⟩ + +instance : IsCardinalAccessibleCategory (CardinalFilteredPoset κ) κ where + exists_generator := + ⟨hasCardinalLTWithTerminal κ, inferInstance, + isCardinalFilteredGenerator_hasCardinalLTWithTerminal κ⟩ + +end CardinalFilteredPoset + +end CategoryTheory diff --git a/Mathlib/Order/Category/PartOrdEmb.lean b/Mathlib/Order/Category/PartOrdEmb.lean index 7441fbffd968a9..bcaefd84f8220b 100644 --- a/Mathlib/Order/Category/PartOrdEmb.lean +++ b/Mathlib/Order/Category/PartOrdEmb.lean @@ -161,6 +161,24 @@ def Iso.mk {α β : PartOrdEmb.{u}} (e : α ≃o β) : α ≅ β where hom := ofHom e inv := ofHom e.symm +/-- The order isomorphism induced by an isomorphism in `PartOrdEmb`. -/ +@[simps] +def orderIsoOfIso {α β : PartOrdEmb.{u}} (e : α ≅ β) : + α ≃o β where + toFun := e.hom + invFun := e.inv + left_inv := ConcreteCategory.congr_hom e.hom_inv_id + right_inv := ConcreteCategory.congr_hom e.inv_hom_id + map_rel_iff' := Hom.le_iff_le _ _ _ + +instance : (forget PartOrdEmb.{u}).ReflectsIsomorphisms where + reflects {α β} f hf := by + rw [CategoryTheory.isIso_iff_bijective] at hf + let e : α ≃o β := + { toEquiv := Equiv.ofBijective _ hf + map_rel_iff' := by simp } + exact (Iso.mk e).isIso_hom + /-- `OrderDual` as a functor. -/ @[simps map] def dual : PartOrdEmb ⥤ PartOrdEmb where @@ -319,6 +337,9 @@ instance : HasColimitsOfShape J PartOrdEmb.{u} where instance : PreservesColimitsOfShape J (forget PartOrdEmb.{u}) where +instance : ReflectsColimitsOfShape J (forget PartOrdEmb.{u}) := + reflectsColimitsOfShape_of_reflectsIsomorphisms + instance : HasFilteredColimitsOfSize.{u, u} PartOrdEmb.{u} where HasColimitsOfShape _ := inferInstance From b72fcff293f3d90f7defbbee75cdf00256e5c34c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 21 May 2026 13:08:58 +0200 Subject: [PATCH 193/309] whitespace --- .../CategoryTheory/Presentable/CardinalDirectedPoset.lean | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean index 7cd825f760e23e..efab876fbf8b0a 100644 --- a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean +++ b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean @@ -1,5 +1,5 @@ /- -Copyright (c) 2025 Joël Riou. All rights reserved. +Copyright (c) 2026 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ @@ -92,8 +92,7 @@ variable {κ} /-- The embedding of the category of `κ`-filtered partially ordered types in the category of partially ordered types. -/ -abbrev CardinalFilteredPoset.ι : - CardinalFilteredPoset κ ⥤ PartOrdEmb := +abbrev CardinalFilteredPoset.ι : CardinalFilteredPoset κ ⥤ PartOrdEmb := ObjectProperty.ι _ namespace CardinalFilteredPoset @@ -272,11 +271,10 @@ protected lemma isCardinalPresentable_iff (J : CardinalFilteredPoset κ) : refine ⟨fun _ ↦ ?_, fun hJ ↦ isCardinalPresentable_of_hasCardinalLT_of_le _ hJ (le_refl _)⟩ have : IsCardinalPresentable J.cocone.pt κ := by assumption obtain ⟨X, f, hf⟩ := IsCardinalPresentable.exists_hom_of_isColimit κ (isColimitCocone J) (𝟙 _) - dsimp at f have : IsSplitMono f := ⟨_, hf⟩ have : IsSplitMono ((forget _).map f) := by -- `infer_instance` fails - apply CategoryTheory.instIsSplitMonoMap + exact instIsSplitMonoMap _ _ exact X.2.1.of_injective f ((mono_iff_injective ((forget _).map f)).1 inferInstance) From db3987d55e266122b8bdbc556f7bcc093516ae53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 21 May 2026 19:37:45 +0200 Subject: [PATCH 194/309] characterization of presentable objects --- .../Presentable/CardinalDirectedPoset.lean | 221 +++++++++++++----- 1 file changed, 160 insertions(+), 61 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean index efab876fbf8b0a..70e0dda68d2b1d 100644 --- a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean +++ b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean @@ -5,9 +5,9 @@ Authors: Joël Riou -/ module -public import Mathlib.CategoryTheory.Limits.FullSubcategory -public import Mathlib.Order.Category.PartOrdEmb +public import Mathlib.CategoryTheory.Limits.Preorder public import Mathlib.CategoryTheory.Presentable.LocallyPresentable +public import Mathlib.Order.Category.PartOrdEmb /-! # The κ-accessible category of κ-directed posets @@ -17,6 +17,14 @@ category `CardinalFilteredPoset κ` of `κ`-directed partially ordered types (with order embeddings as morphisms), and we show that it is a `κ`-accessible category. +If `κ ≤ κ'` where `κ'` is also a regular cardinal, we characterize +the `κ'`-presentable objects of `CardinalFilteredPoset κ` as +the objects `J` such that the underlying type `J.obj` has +cardinality `< κ'`. + +## References +* [Adámek, J. and Rosický, J., *Locally presentable and accessible categories*][Adamek_Rosicky_1994] + -/ @[expose] public section @@ -111,6 +119,11 @@ lemma Hom.le_iff_le {J₁ J₂ : CardinalFilteredPoset κ} (f : J₁ ⟶ J₂) ( instance (J : CardinalFilteredPoset κ) : IsCardinalFiltered J.obj κ := J.property +instance (J : CardinalFilteredPoset κ) : IsFiltered J.obj := + isFiltered_of_isCardinalFiltered _ κ + +instance (J : CardinalFilteredPoset κ) : Nonempty J.obj := IsFiltered.nonempty + instance : HasCardinalFilteredColimits (CardinalFilteredPoset κ) κ where hasColimitsOfShape J _ _ := by have := isFiltered_of_isCardinalFiltered J κ @@ -136,7 +149,7 @@ instance : ObjectProperty.EssentiallySmall.{u} (hasCardinalLTWithTerminal κ) wh let (a : α) : PartialOrder a.1 := a.2.1 let ι (a : α) : CardinalFilteredPoset κ := { obj := .of a.1 - property := a.2.2.1.1 } + property := a.2.2.down.down } refine ⟨.ofObj ι, inferInstance, fun J ⟨hJ, _⟩ ↦ ?_⟩ obtain ⟨f⟩ : Cardinal.mk J.obj ≤ Cardinal.mk X := by simpa [hX] using ((hasCardinalLT_iff_cardinal_mk_lt _ _).1 hJ).le @@ -147,6 +160,149 @@ instance : ObjectProperty.EssentiallySmall.{u} (hasCardinalLTWithTerminal κ) wh ⟨⟨IsCardinalFiltered.of_equivalence κ e'.symm.equivalence⟩⟩⟩⟩, ⟨CardinalFilteredPoset.ι.preimageIso (PartOrdEmb.Iso.mk (by exact e'.symm))⟩⟩ +set_option backward.isDefEq.respectTransparency false in +lemma isCardinalPresentable_of_hasCardinalLT_of_le (J : CardinalFilteredPoset κ) + {κ' : Cardinal.{u}} [Fact κ'.IsRegular] (hJ : HasCardinalLT J.obj κ') (h : κ ≤ κ') : + IsCardinalPresentable J κ' where + preservesColimitOfShape A _ _ := ⟨fun {F} ↦ ⟨fun {c} hc ↦ ⟨by + · have := isFiltered_of_isCardinalFiltered A κ' + have := IsCardinalFiltered.of_le A h + replace hc := isColimitOfPreserves (forget _) hc + refine Types.FilteredColimit.isColimitOf' _ _ (fun f ↦ ?_) (fun j f g h ↦ ?_) + · dsimp at f + choose j g hg using fun (x : J.obj) ↦ Types.jointly_surjective_of_isColimit hc (f x) + let m := IsCardinalFiltered.max j hJ + let φ (x : J.obj) : (F.obj m).obj := F.map (IsCardinalFiltered.toMax j hJ x) (g x) + have hφ (x : J.obj) : f x = c.ι.app _ (φ x) := by + dsimp [φ] + rw [← hg, ← ConcreteCategory.comp_apply, c.w] + rfl + refine ⟨m, + ObjectProperty.homMk (PartOrdEmb.ofHom + { toFun := φ + inj' x y h := Hom.injective f (by simpa [hφ]) + map_rel_iff' {x y} := ?_ }), ?_⟩ + · simp only [Function.Embedding.coeFn_mk, + ← Hom.le_iff_le f, hφ, Hom.le_iff_le (c.ι.app m)] + · dsimp + ext x + exact (hg x).symm.trans + (ConcreteCategory.congr_hom (c.w (IsCardinalFiltered.toMax j hJ x)).symm (g x)) + · choose k a hk using fun (x : J.obj) ↦ + (Types.FilteredColimit.isColimit_eq_iff' hc _ _).1 (ConcreteCategory.congr_hom h x) + dsimp at f g h k a hk ⊢ + obtain ⟨l, b, c, hl⟩ : ∃ (l : A) (c : j ⟶ l) (b : ∀ x, k x ⟶ l), + ∀ x, a x ≫ b x = c := by + let φ (x : J.obj) : j ⟶ IsCardinalFiltered.max k hJ := + a x ≫ IsCardinalFiltered.toMax k hJ x + exact ⟨IsCardinalFiltered.coeq φ hJ, + IsCardinalFiltered.toCoeq φ hJ, + fun x ↦ IsCardinalFiltered.toMax k hJ x ≫ IsCardinalFiltered.coeqHom φ hJ, + fun x ↦ by simpa [φ] using IsCardinalFiltered.coeq_condition φ hJ x⟩ + refine ⟨l, b, ?_⟩ + ext x + simpa only [← hl x, Functor.map_comp, ObjectProperty.FullSubcategory.comp_hom, + PartOrdEmb.hom_comp, RelEmbedding.coe_trans, Function.comp_apply] + using congr_arg _ (hk x)⟩⟩⟩ + +namespace coconeWithTop + +variable (J : CardinalFilteredPoset κ) + +instance (κ' : Cardinal.{u}) [Fact κ'.IsRegular] : + IsCardinalFiltered (WithTop (J.obj)) κ' := + isCardinalFiltered_of_hasTerminal _ _ + +abbrev withTop : CardinalFilteredPoset κ := .of (.of (WithTop J.obj)) + +@[nolint unusedArguments] +def indexSet {κ' : Cardinal.{u}} [Fact κ'.IsRegular] (_ : κ ≤ κ') : + Set (Set (withTop J).obj) := + setOf (fun S ↦ HasCardinalLT S κ' ∧ ⊤ ∈ S) + +variable {κ' : Cardinal.{u}} [Fact κ'.IsRegular] {h : κ ≤ κ'} + +variable {J} (h) in +lemma pair_mem_indexSet (j : J.obj) : {WithBot.some j, ⊤} ∈ indexSet J h := + ⟨hasCardinalLT_of_finite _ _ (Cardinal.IsRegular.aleph0_le Fact.out), + Set.mem_insert_of_mem _ (by simp)⟩ + +instance (S : indexSet J h) : HasTerminal S := + IsTerminal.hasTerminal (X := ⟨⊤, S.2.2⟩) + (IsTerminal.ofUniqueHom (fun _ ↦ homOfLE (by rw [Subtype.mk_le_mk]; exact le_top)) + (fun _ _ ↦ rfl)) + +instance (S : indexSet J h) : IsCardinalFiltered S κ := isCardinalFiltered_of_hasTerminal _ _ + +instance : IsCardinalFiltered (indexSet J h) κ' := + isCardinalFiltered_preorder _ _ (fun K α hK ↦ by + rw [← hasCardinalLT_iff_cardinal_mk_lt] at hK + have hκ' : Cardinal.aleph0 ≤ κ' := Cardinal.IsRegular.aleph0_le Fact.out + refine ⟨⟨(⋃ (k : K), α k) ∪ {⊤}, + hasCardinalLT_union hκ' (hasCardinalLT_iUnion _ hK (fun k ↦ (α k).property.left)) + (hasCardinalLT_of_finite _ _ hκ'), by simp⟩, fun k ↦ ?_⟩ + rw [Subtype.mk_le_mk] + simp only [Set.le_eq_subset] + exact subset_trans (Set.subset_iUnion (fun i ↦ (α i).1) k) Set.subset_union_left) + +instance : IsFiltered (indexSet J h) := isFiltered_of_isCardinalFiltered _ κ' + +variable (h) +@[simps] +def functor : indexSet J h ⥤ CardinalFilteredPoset κ where + obj S := of (.of S.val) + map f := ObjectProperty.homMk (PartOrdEmb.ofHom + { toFun x := ⟨x, leOfHom f x.2⟩ + inj' := by rintro ⟨x, _⟩ ⟨y, _⟩ h; simpa using h + map_rel_iff' := by rfl }) + +end coconeWithTop + +section + +variable (J : CardinalFilteredPoset κ) {κ' : Cardinal.{u}} [Fact κ'.IsRegular] (h : κ ≤ κ') + +@[simps] +def coconeWithTop : Cocone (coconeWithTop.functor J h) where + pt := .of (.of (WithTop J.obj)) + ι.app _ := ObjectProperty.homMk (PartOrdEmb.ofHom (OrderEmbedding.subtype _)) + +open coconeWithTop in +noncomputable def isColimitCoconeWithTop : + IsColimit (coconeWithTop J h) := + isColimitOfReflects (CardinalFilteredPoset.ι ⋙ forget PartOrdEmb) (by + refine Types.FilteredColimit.isColimitOf' _ _ (fun x ↦ ?_) (fun j ⟨x, _⟩ ⟨y, _⟩ h ↦ ?_) + · induction x with + | some x => + exact ⟨⟨_, pair_mem_indexSet _ x⟩, ⟨x, Set.mem_insert _ _⟩, rfl⟩ + | none => + exact ⟨⟨_, pair_mem_indexSet _ (Classical.arbitrary _)⟩, + ⟨⊤, Set.mem_insert_of_mem _ rfl⟩, rfl⟩ + · obtain rfl : x = y := by simpa using h + exact ⟨j, 𝟙 _, rfl⟩) + +include h in +protected lemma isCardinalPresentable_iff : + IsCardinalPresentable J κ' ↔ HasCardinalLT J.obj κ' := by + refine ⟨fun _ ↦ ?_, fun hJ ↦ isCardinalPresentable_of_hasCardinalLT_of_le _ hJ h⟩ + obtain ⟨X, f, hf⟩ := + IsCardinalPresentable.exists_hom_of_isColimit κ' (isColimitCoconeWithTop J h) + (ObjectProperty.homMk (PartOrdEmb.ofHom WithTop.coeOrderHom)) + replace hf : OrderEmbedding.subtype X.1 ∘ f = WithTop.coeOrderHom := by + ext x + exact ConcreteCategory.congr_hom hf x + refine X.2.1.of_injective f (Function.Injective.of_comp + (f := OrderEmbedding.subtype X.1) ?_) + dsimp at hf ⊢ + rw [hf] + exact WithTop.coe_injective + +end + +protected lemma isCardinalPresentable_iff' (J : CardinalFilteredPoset κ) : + IsCardinalPresentable J κ ↔ HasCardinalLT J.obj κ := + CardinalFilteredPoset.isCardinalPresentable_iff _ (le_refl _) + namespace cocone variable (J : CardinalFilteredPoset κ) @@ -221,69 +377,12 @@ noncomputable def isColimitCocone (J : CardinalFilteredPoset κ) : · obtain rfl : x = y := by simpa using h exact ⟨j, 𝟙 _, rfl⟩) -set_option backward.isDefEq.respectTransparency false in -lemma isCardinalPresentable_of_hasCardinalLT_of_le (J : CardinalFilteredPoset κ) - {κ' : Cardinal.{u}} [Fact κ'.IsRegular] (hJ : HasCardinalLT J.obj κ') (h : κ ≤ κ') : - IsCardinalPresentable J κ' where - preservesColimitOfShape A _ _ := ⟨fun {F} ↦ ⟨fun {c} hc ↦ ⟨by - · have := isFiltered_of_isCardinalFiltered A κ' - have := IsCardinalFiltered.of_le A h - replace hc := isColimitOfPreserves (forget _) hc - refine Types.FilteredColimit.isColimitOf' _ _ (fun f ↦ ?_) (fun j f g h ↦ ?_) - · dsimp at f - choose j g hg using fun (x : J.obj) ↦ Types.jointly_surjective_of_isColimit hc (f x) - let m := IsCardinalFiltered.max j hJ - let φ (x : J.obj) : (F.obj m).obj := F.map (IsCardinalFiltered.toMax j hJ x) (g x) - have hφ (x : J.obj) : f x = c.ι.app _ (φ x) := by - dsimp [φ] - rw [← hg, ← ConcreteCategory.comp_apply, c.w] - rfl - refine ⟨m, - ObjectProperty.homMk (PartOrdEmb.ofHom - { toFun := φ - inj' x y h := Hom.injective f (by simpa [hφ]) - map_rel_iff' {x y} := ?_ }), ?_⟩ - · simp only [Function.Embedding.coeFn_mk, - ← Hom.le_iff_le f, hφ, Hom.le_iff_le (c.ι.app m)] - · dsimp - ext x - exact (hg x).symm.trans - (ConcreteCategory.congr_hom (c.w (IsCardinalFiltered.toMax j hJ x)).symm (g x)) - · choose k a hk using fun (x : J.obj) ↦ - (Types.FilteredColimit.isColimit_eq_iff' hc _ _).1 (ConcreteCategory.congr_hom h x) - dsimp at f g h k a hk ⊢ - obtain ⟨l, b, c, hl⟩ : ∃ (l : A) (c : j ⟶ l) (b : ∀ x, k x ⟶ l), - ∀ x, a x ≫ b x = c := by - let φ (x : J.obj) : j ⟶ IsCardinalFiltered.max k hJ := - a x ≫ IsCardinalFiltered.toMax k hJ x - exact ⟨IsCardinalFiltered.coeq φ hJ, - IsCardinalFiltered.toCoeq φ hJ, - fun x ↦ IsCardinalFiltered.toMax k hJ x ≫ IsCardinalFiltered.coeqHom φ hJ, - fun x ↦ by simpa [φ] using IsCardinalFiltered.coeq_condition φ hJ x⟩ - refine ⟨l, b, ?_⟩ - ext x - simpa only [← hl x, Functor.map_comp, ObjectProperty.FullSubcategory.comp_hom, - PartOrdEmb.hom_comp, RelEmbedding.coe_trans, Function.comp_apply] - using congr_arg _ (hk x)⟩⟩⟩ - -protected lemma isCardinalPresentable_iff (J : CardinalFilteredPoset κ) : - IsCardinalPresentable J κ ↔ HasCardinalLT J.obj κ := by - refine ⟨fun _ ↦ ?_, fun hJ ↦ isCardinalPresentable_of_hasCardinalLT_of_le _ hJ (le_refl _)⟩ - have : IsCardinalPresentable J.cocone.pt κ := by assumption - obtain ⟨X, f, hf⟩ := IsCardinalPresentable.exists_hom_of_isColimit κ (isColimitCocone J) (𝟙 _) - have : IsSplitMono f := ⟨_, hf⟩ - have : IsSplitMono ((forget _).map f) := by - -- `infer_instance` fails - exact instIsSplitMonoMap _ _ - exact X.2.1.of_injective f - ((mono_iff_injective ((forget _).map f)).1 inferInstance) - variable (κ) in lemma isCardinalFilteredGenerator_hasCardinalLTWithTerminal : (hasCardinalLTWithTerminal κ).IsCardinalFilteredGenerator κ where le_isCardinalPresentable := by rintro J ⟨_, _⟩ - rwa [isCardinalPresentable_iff, J.isCardinalPresentable_iff] + rwa [isCardinalPresentable_iff, J.isCardinalPresentable_iff'] exists_colimitsOfShape J := ⟨_, inferInstance, inferInstance, ⟨{ diag := _ From bde3f62a8022812a075026ec2ecb20f371814d41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 21 May 2026 21:04:55 +0200 Subject: [PATCH 195/309] wip --- .../Presentable/CardinalDirectedPoset.lean | 50 +++++++++++++------ 1 file changed, 34 insertions(+), 16 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean index 70e0dda68d2b1d..0516855d654446 100644 --- a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean +++ b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean @@ -135,6 +135,15 @@ instance (A : Type u) [SmallCategory A] [IsCardinalFiltered A κ] : change PreservesColimitsOfShape A (CardinalFilteredPoset.ι ⋙ forget _) infer_instance +instance (J : CardinalFilteredPoset κ) (κ' : Cardinal.{u}) [Fact κ'.IsRegular] : + IsCardinalFiltered (WithTop (J.obj)) κ' := + isCardinalFiltered_of_hasTerminal _ _ + +/-- The map `CardinalFilteredPoset κ → CardinalFilteredPoset κ` which sends +a partially ordered `κ`-filtered type `J` to `WithTop J`. -/ +abbrev withTop (J : CardinalFilteredPoset κ) : CardinalFilteredPoset κ := + .of (.of (WithTop J.obj)) + variable (κ) in /-- The property of posets in `CardinalFilteredPoset κ` that are of cardinality `< κ` and have terminal object. -/ @@ -209,21 +218,20 @@ namespace coconeWithTop variable (J : CardinalFilteredPoset κ) -instance (κ' : Cardinal.{u}) [Fact κ'.IsRegular] : - IsCardinalFiltered (WithTop (J.obj)) κ' := - isCardinalFiltered_of_hasTerminal _ _ - -abbrev withTop : CardinalFilteredPoset κ := .of (.of (WithTop J.obj)) - +/-- Given two regular cardinals `κ ≤ κ'` and `J : CardinalFilteredPoset κ`, +this is the partially ordered set consisting of subsets `S` of `J.withTop` +that are of cardinality `< κ'` and contain `⊤`. +See `CardinalFilteredPoset.isColimitCoconeWithTop` for the fact that `withTop J` +identifies to the colimit of such `S`. -/ @[nolint unusedArguments] def indexSet {κ' : Cardinal.{u}} [Fact κ'.IsRegular] (_ : κ ≤ κ') : - Set (Set (withTop J).obj) := + Set (Set J.withTop.obj) := setOf (fun S ↦ HasCardinalLT S κ' ∧ ⊤ ∈ S) variable {κ' : Cardinal.{u}} [Fact κ'.IsRegular] {h : κ ≤ κ'} variable {J} (h) in -lemma pair_mem_indexSet (j : J.obj) : {WithBot.some j, ⊤} ∈ indexSet J h := +lemma pair_mem_indexSet (j : J.obj) : {WithTop.some j, ⊤} ∈ indexSet J h := ⟨hasCardinalLT_of_finite _ _ (Cardinal.IsRegular.aleph0_le Fact.out), Set.mem_insert_of_mem _ (by simp)⟩ @@ -247,7 +255,11 @@ instance : IsCardinalFiltered (indexSet J h) κ' := instance : IsFiltered (indexSet J h) := isFiltered_of_isCardinalFiltered _ κ' -variable (h) +variable (h) in +/-- Given `J : CardinalFilteredPoset κ` and an inequality `κ ≤ κ'` +where `κ'` is a regular cardinal, this is the functor which sends +a subset `S` of `J.obj` of cardinality `< κ'` and containing `⊤` to `S` +as an object in `CardinalFilteredPoset κ`. -/ @[simps] def functor : indexSet J h ⥤ CardinalFilteredPoset κ where obj S := of (.of S.val) @@ -262,14 +274,20 @@ section variable (J : CardinalFilteredPoset κ) {κ' : Cardinal.{u}} [Fact κ'.IsRegular] (h : κ ≤ κ') +/-- If `κ ≤ κ'` is an inequality between regular cardinals, and +`J : CardinalFilteredPoset κ`, this is the (colimit) cocone which +expresses `J.withTop` as a colimit of its subsets that are of +cardinality `< κ'` and contain `⊤`. -/ @[simps] def coconeWithTop : Cocone (coconeWithTop.functor J h) where - pt := .of (.of (WithTop J.obj)) + pt := J.withTop ι.app _ := ObjectProperty.homMk (PartOrdEmb.ofHom (OrderEmbedding.subtype _)) open coconeWithTop in -noncomputable def isColimitCoconeWithTop : - IsColimit (coconeWithTop J h) := +/-- If `κ ≤ κ'` is an inequality between regular cardinals, and +`J : CardinalFilteredPoset κ`, then `J.withTop` is the colimit of +its subsets that are of cardinality `< κ'` and contain `⊤`. -/ +noncomputable def isColimitCoconeWithTop : IsColimit (coconeWithTop J h) := isColimitOfReflects (CardinalFilteredPoset.ι ⋙ forget PartOrdEmb) (by refine Types.FilteredColimit.isColimitOf' _ _ (fun x ↦ ?_) (fun j ⟨x, _⟩ ⟨y, _⟩ h ↦ ?_) · induction x with @@ -278,7 +296,7 @@ noncomputable def isColimitCoconeWithTop : | none => exact ⟨⟨_, pair_mem_indexSet _ (Classical.arbitrary _)⟩, ⟨⊤, Set.mem_insert_of_mem _ rfl⟩, rfl⟩ - · obtain rfl : x = y := by simpa using h + · obtain rfl : x = y := h exact ⟨j, 𝟙 _, rfl⟩) include h in @@ -307,7 +325,7 @@ namespace cocone variable (J : CardinalFilteredPoset κ) -/-- Given `J : CardinalFilteredPoset κ`, this is hte partially ordered set consisting +/-- Given `J : CardinalFilteredPoset κ`, this is the partially ordered set consisting of subsets of `J.obj` that are of cardinality `< κ` and have a terminal object. -/ def indexSet : Set (Set J.obj) := setOf (fun S ↦ HasCardinalLT S κ ∧ HasTerminal S) @@ -351,7 +369,7 @@ a subset `S` of `J.obj` of cardinality `< κ` with a terminal object to `S` as an object in `CardinalFilteredPoset κ`. -/ @[simps] def functor : indexSet J ⥤ CardinalFilteredPoset κ where - obj S := of (PartOrdEmb.of S.val) + obj S := of (.of S.val) map f := ObjectProperty.homMk (PartOrdEmb.ofHom { toFun x := ⟨x, leOfHom f x.2⟩ inj' := by rintro ⟨x, _⟩ ⟨y, _⟩ h; simpa using h @@ -388,7 +406,7 @@ lemma isCardinalFilteredGenerator_hasCardinalLTWithTerminal : diag := _ ι := _ isColimit := isColimitCocone J - prop_diag_obj j := j.2 }⟩⟩ + prop_diag_obj j := j.prop }⟩⟩ instance : IsCardinalAccessibleCategory (CardinalFilteredPoset κ) κ where exists_generator := From 882d14b4187acdd15009272ab022180b48bb1cf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 21 May 2026 21:21:09 +0200 Subject: [PATCH 196/309] =?UTF-8?q?feat(CategoryTheory):=20the=20category?= =?UTF-8?q?=20of=20=CE=BA-directed=20posets?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Mathlib.lean | 1 + .../Presentable/CardinalDirectedPoset.lean | 254 ++++++++++++++++++ Mathlib/Order/Category/PartOrdEmb.lean | 21 ++ 3 files changed, 276 insertions(+) create mode 100644 Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean diff --git a/Mathlib.lean b/Mathlib.lean index 2e6f05fb7e70c2..d789df0c3b3a8a 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -3234,6 +3234,7 @@ public import Mathlib.CategoryTheory.Preadditive.Yoneda.Limits public import Mathlib.CategoryTheory.Preadditive.Yoneda.Projective public import Mathlib.CategoryTheory.Presentable.Adjunction public import Mathlib.CategoryTheory.Presentable.Basic +public import Mathlib.CategoryTheory.Presentable.CardinalDirectedPoset public import Mathlib.CategoryTheory.Presentable.CardinalFilteredPresentation public import Mathlib.CategoryTheory.Presentable.ColimitPresentation public import Mathlib.CategoryTheory.Presentable.Dense diff --git a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean new file mode 100644 index 00000000000000..e72c887e4e4b9e --- /dev/null +++ b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean @@ -0,0 +1,254 @@ +/- +Copyright (c) 2026 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.Limits.Preorder +public import Mathlib.CategoryTheory.Presentable.LocallyPresentable +public import Mathlib.Order.Category.PartOrdEmb + +/-! +# The κ-accessible category of κ-directed posets + +Given a regular cardinal `κ : Cardinal.{u}`, we define the +category `CardinalFilteredPoset κ` of `κ`-directed partially ordered +types (with order embeddings as morphisms), and we show that it is +a `κ`-accessible category. + +If `κ ≤ κ'` where `κ'` is also a regular cardinal, we characterize +the `κ'`-presentable objects of `CardinalFilteredPoset κ` as +the objects `J` such that the underlying type `J.obj` has +cardinality `< κ'`. + +## References +* [Adámek, J. and Rosický, J., *Locally presentable and accessible categories*][Adamek_Rosicky_1994] + +-/ + +@[expose] public section + +universe u + +open CategoryTheory Limits + +namespace PartOrdEmb + +variable (κ : Cardinal.{u}) [Fact κ.IsRegular] + +/-- The property of objects in `PartOrdEmb` that are +satisfied by partially ordered types of cardinality `< κ`. -/ +abbrev isCardinalFiltered : ObjectProperty PartOrdEmb.{u} := + fun X ↦ IsCardinalFiltered X κ + +@[simp] +lemma isCardinalFiltered_iff (X : PartOrdEmb.{u}) : + isCardinalFiltered κ X ↔ IsCardinalFiltered X κ := Iff.rfl + +instance : (isCardinalFiltered κ).IsClosedUnderIsomorphisms where + of_iso e _ := .of_equivalence κ (orderIsoOfIso e).equivalence + +namespace Limits.CoconePt + +variable {κ} {J : Type u} [SmallCategory J] [IsCardinalFiltered J κ] + {F : J ⥤ PartOrdEmb.{u}} {c : Cocone (F ⋙ forget _)} (hc : IsColimit c) + +lemma isCardinalFiltered_pt (hF : ∀ j, IsCardinalFiltered (F.obj j) κ) : + letI := isFiltered_of_isCardinalFiltered J κ + IsCardinalFiltered (CoconePt hc) κ := by + letI := isFiltered_of_isCardinalFiltered J κ + refine isCardinalFiltered_preorder _ _ (fun K f hK ↦ ?_) + rw [← hasCardinalLT_iff_cardinal_mk_lt] at hK + choose j₀ x₀ hx₀ using fun k ↦ Types.jointly_surjective_of_isColimit hc (f k) + let j := IsCardinalFiltered.max j₀ hK + let x₁ (k : K) : F.obj j := F.map (IsCardinalFiltered.toMax j₀ hK k) (x₀ k) + have hx₁ (k : K) : c.ι.app j (x₁ k) = c.ι.app (j₀ k) (x₀ k) := + ConcreteCategory.congr_hom (c.w (IsCardinalFiltered.toMax j₀ hK k)) _ + refine ⟨(cocone hc).ι.app j (IsCardinalFiltered.max x₁ hK), + fun k ↦ ?_⟩ + rw [← hx₀, ← hx₁] + exact ((cocone hc).ι.app j).hom.monotone + (leOfHom (IsCardinalFiltered.toMax x₁ hK k)) + +end Limits.CoconePt + +instance (J : Type u) [SmallCategory J] [IsCardinalFiltered J κ] : + (isCardinalFiltered κ).IsClosedUnderColimitsOfShape J where + colimitsOfShape_le := by + have := isFiltered_of_isCardinalFiltered J κ + rintro X ⟨p⟩ + simp only [(isCardinalFiltered κ).prop_iff_of_iso + (p.isColimit.coconePointUniqueUpToIso + (Limits.isColimitCocone (colimit.isColimit (p.diag ⋙ forget PartOrdEmb)))), + isCardinalFiltered_iff, Limits.cocone_pt_coe] + exact Limits.CoconePt.isCardinalFiltered_pt _ p.prop_diag_obj + +end PartOrdEmb + +namespace CategoryTheory + +variable (κ : Cardinal.{u}) [Fact κ.IsRegular] + +/-- The category of `κ`-filtered partially ordered types, +with morphisms given by order embeddings. -/ +abbrev CardinalFilteredPoset := + (PartOrdEmb.isCardinalFiltered κ).FullSubcategory + +variable {κ} + +/-- The embedding of the category of `κ`-filtered +partially ordered types in the category of partially +ordered types. -/ +abbrev CardinalFilteredPoset.ι : CardinalFilteredPoset κ ⥤ PartOrdEmb := + ObjectProperty.ι _ + +namespace CardinalFilteredPoset + +/-- Constructor for objects in `CardinalFilteredPoset κ`. -/ +abbrev of (J : PartOrdEmb.{u}) [IsCardinalFiltered J κ] : CardinalFilteredPoset κ where + obj := J + property := inferInstance + +instance (J : CardinalFilteredPoset κ) : IsCardinalFiltered J.obj κ := J.property + +instance (J : CardinalFilteredPoset κ) : IsFiltered J.obj := + isFiltered_of_isCardinalFiltered _ κ + +instance (J : CardinalFilteredPoset κ) : Nonempty J.obj := IsFiltered.nonempty + +instance : HasCardinalFilteredColimits (CardinalFilteredPoset κ) κ where + hasColimitsOfShape J _ _ := by + have := isFiltered_of_isCardinalFiltered J κ + infer_instance + +instance (A : Type u) [SmallCategory A] [IsCardinalFiltered A κ] : + PreservesColimitsOfShape A (forget (CardinalFilteredPoset κ)) := by + have := isFiltered_of_isCardinalFiltered A κ + change PreservesColimitsOfShape A (CardinalFilteredPoset.ι ⋙ forget _) + infer_instance + +instance (J : CardinalFilteredPoset κ) (κ' : Cardinal.{u}) [Fact κ'.IsRegular] : + IsCardinalFiltered (WithTop (J.obj)) κ' := + isCardinalFiltered_of_hasTerminal _ _ + +/-- The map `CardinalFilteredPoset κ → CardinalFilteredPoset κ` which sends +a partially ordered `κ`-filtered type `J` to `WithTop J`. -/ +abbrev withTop (J : CardinalFilteredPoset κ) : CardinalFilteredPoset κ := + .of (.of (WithTop J.obj)) + +variable (κ) in +/-- The property of posets in `CardinalFilteredPoset κ` that are +of cardinality `< κ` and have terminal object. -/ +def hasCardinalLTWithTerminal : ObjectProperty (CardinalFilteredPoset κ) := + fun J ↦ HasCardinalLT J.obj κ ∧ HasTerminal J.obj + +instance : ObjectProperty.EssentiallySmall.{u} (hasCardinalLTWithTerminal κ) where + exists_small_le' := by + obtain ⟨X, hX⟩ : ∃ (X : Type u), Cardinal.mk X = κ := ⟨κ.ord.ToType, by simp⟩ + let α : Type u := Σ (S : Set X) (_ : PartialOrder S), + ULift.{u} (PLift (IsCardinalFiltered S κ)) + let (a : α) : PartialOrder a.1 := a.2.1 + let ι (a : α) : CardinalFilteredPoset κ := + { obj := .of a.1 + property := a.2.2.down.down } + refine ⟨.ofObj ι, inferInstance, fun J ⟨hJ, _⟩ ↦ ?_⟩ + obtain ⟨f⟩ : Cardinal.mk J.obj ≤ Cardinal.mk X := by + simpa [hX] using ((hasCardinalLT_iff_cardinal_mk_lt _ _).1 hJ).le + let e := Equiv.ofInjective _ f.injective + letI : PartialOrder (Set.range f) := PartialOrder.lift e.symm e.symm.injective + let e' : Set.range f ≃o J.obj := { toEquiv := e.symm, map_rel_iff' := by rfl } + exact ⟨_, ⟨⟨Set.range f, inferInstance, + ⟨⟨IsCardinalFiltered.of_equivalence κ e'.symm.equivalence⟩⟩⟩⟩, + ⟨CardinalFilteredPoset.ι.preimageIso (PartOrdEmb.Iso.mk (by exact e'.symm))⟩⟩ + +namespace coconeWithTop + +variable (J : CardinalFilteredPoset κ) + +/-- Given two regular cardinals `κ ≤ κ'` and `J : CardinalFilteredPoset κ`, +this is the partially ordered set consisting of subsets `S` of `J.withTop` +that are of cardinality `< κ'` and contain `⊤`. +See `CardinalFilteredPoset.isColimitCoconeWithTop` for the fact that `withTop J` +identifies to the colimit of such `S`. -/ +@[nolint unusedArguments] +def indexSet {κ' : Cardinal.{u}} [Fact κ'.IsRegular] (_ : κ ≤ κ') : + Set (Set J.withTop.obj) := + setOf (fun S ↦ HasCardinalLT S κ' ∧ ⊤ ∈ S) + +variable {κ' : Cardinal.{u}} [Fact κ'.IsRegular] {h : κ ≤ κ'} + +variable {J} (h) in +lemma pair_mem_indexSet (j : J.obj) : {WithTop.some j, ⊤} ∈ indexSet J h := + ⟨hasCardinalLT_of_finite _ _ (Cardinal.IsRegular.aleph0_le Fact.out), + Set.mem_insert_of_mem _ (by simp)⟩ + +instance (S : indexSet J h) : HasTerminal S := + IsTerminal.hasTerminal (X := ⟨⊤, S.2.2⟩) + (IsTerminal.ofUniqueHom (fun _ ↦ homOfLE (by rw [Subtype.mk_le_mk]; exact le_top)) + (fun _ _ ↦ rfl)) + +instance (S : indexSet J h) : IsCardinalFiltered S κ := isCardinalFiltered_of_hasTerminal _ _ + +instance : IsCardinalFiltered (indexSet J h) κ' := + isCardinalFiltered_preorder _ _ (fun K α hK ↦ by + rw [← hasCardinalLT_iff_cardinal_mk_lt] at hK + have hκ' : Cardinal.aleph0 ≤ κ' := Cardinal.IsRegular.aleph0_le Fact.out + refine ⟨⟨(⋃ (k : K), α k) ∪ {⊤}, + hasCardinalLT_union hκ' (hasCardinalLT_iUnion _ hK (fun k ↦ (α k).property.left)) + (hasCardinalLT_of_finite _ _ hκ'), by simp⟩, fun k ↦ ?_⟩ + rw [Subtype.mk_le_mk] + simp only [Set.le_eq_subset] + exact subset_trans (Set.subset_iUnion (fun i ↦ (α i).1) k) Set.subset_union_left) + +instance : IsFiltered (indexSet J h) := isFiltered_of_isCardinalFiltered _ κ' + +variable (h) in +/-- Given `J : CardinalFilteredPoset κ` and an inequality `κ ≤ κ'` +where `κ'` is a regular cardinal, this is the functor which sends +a subset `S` of `J.obj` of cardinality `< κ'` and containing `⊤` to `S` +as an object in `CardinalFilteredPoset κ`. -/ +@[simps] +def functor : indexSet J h ⥤ CardinalFilteredPoset κ where + obj S := of (.of S.val) + map f := ObjectProperty.homMk (PartOrdEmb.ofHom + { toFun x := ⟨x, leOfHom f x.2⟩ + inj' := by rintro ⟨x, _⟩ ⟨y, _⟩ h; simpa using h + map_rel_iff' := by rfl }) + +end coconeWithTop + +section + +variable (J : CardinalFilteredPoset κ) {κ' : Cardinal.{u}} [Fact κ'.IsRegular] (h : κ ≤ κ') + +/-- If `κ ≤ κ'` is an inequality between regular cardinals, and +`J : CardinalFilteredPoset κ`, this is the (colimit) cocone which +expresses `J.withTop` as a colimit of its subsets that are of +cardinality `< κ'` and contain `⊤`. -/ +@[simps] +def coconeWithTop : Cocone (coconeWithTop.functor J h) where + pt := J.withTop + ι.app _ := ObjectProperty.homMk (PartOrdEmb.ofHom (OrderEmbedding.subtype _)) + +open coconeWithTop in +/-- If `κ ≤ κ'` is an inequality between regular cardinals, and +`J : CardinalFilteredPoset κ`, then `J.withTop` is the colimit of +its subsets that are of cardinality `< κ'` and contain `⊤`. -/ +noncomputable def isColimitCoconeWithTop : IsColimit (coconeWithTop J h) := + isColimitOfReflects (CardinalFilteredPoset.ι ⋙ forget PartOrdEmb) (by + refine Types.FilteredColimit.isColimitOf' _ _ (fun x ↦ ?_) (fun j ⟨x, _⟩ ⟨y, _⟩ h ↦ ?_) + · induction x with + | some x => + exact ⟨⟨_, pair_mem_indexSet _ x⟩, ⟨x, Set.mem_insert _ _⟩, rfl⟩ + | none => + exact ⟨⟨_, pair_mem_indexSet _ (Classical.arbitrary _)⟩, + ⟨⊤, Set.mem_insert_of_mem _ rfl⟩, rfl⟩ + · obtain rfl : x = y := h + exact ⟨j, 𝟙 _, rfl⟩) + +end + +end CardinalFilteredPoset + +end CategoryTheory diff --git a/Mathlib/Order/Category/PartOrdEmb.lean b/Mathlib/Order/Category/PartOrdEmb.lean index 7441fbffd968a9..c1244941685b10 100644 --- a/Mathlib/Order/Category/PartOrdEmb.lean +++ b/Mathlib/Order/Category/PartOrdEmb.lean @@ -161,6 +161,24 @@ def Iso.mk {α β : PartOrdEmb.{u}} (e : α ≃o β) : α ≅ β where hom := ofHom e inv := ofHom e.symm +/-- The order isomorphism corresponding to an isomorphism in `PartOrdEmb`. -/ +@[simps] +def orderIsoOfIso {α β : PartOrdEmb.{u}} (e : α ≅ β) : + α ≃o β where + toFun := e.hom + invFun := e.inv + left_inv := ConcreteCategory.congr_hom e.hom_inv_id + right_inv := ConcreteCategory.congr_hom e.inv_hom_id + map_rel_iff' := Hom.le_iff_le _ _ _ + +instance : (forget PartOrdEmb.{u}).ReflectsIsomorphisms where + reflects {α β} f hf := by + rw [CategoryTheory.isIso_iff_bijective] at hf + let e : α ≃o β := + { toEquiv := Equiv.ofBijective _ hf + map_rel_iff' := by simp } + exact (Iso.mk e).isIso_hom + /-- `OrderDual` as a functor. -/ @[simps map] def dual : PartOrdEmb ⥤ PartOrdEmb where @@ -319,6 +337,9 @@ instance : HasColimitsOfShape J PartOrdEmb.{u} where instance : PreservesColimitsOfShape J (forget PartOrdEmb.{u}) where +instance : ReflectsColimitsOfShape J (forget PartOrdEmb.{u}) := + reflectsColimitsOfShape_of_reflectsIsomorphisms + instance : HasFilteredColimitsOfSize.{u, u} PartOrdEmb.{u} where HasColimitsOfShape _ := inferInstance From a5a1782292c3c91d50157504dbc9258a48a61c87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 21 May 2026 21:22:03 +0200 Subject: [PATCH 197/309] fix --- .../Presentable/CardinalDirectedPoset.lean | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean index e72c887e4e4b9e..414337b977df97 100644 --- a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean +++ b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean @@ -14,13 +14,8 @@ public import Mathlib.Order.Category.PartOrdEmb Given a regular cardinal `κ : Cardinal.{u}`, we define the category `CardinalFilteredPoset κ` of `κ`-directed partially ordered -types (with order embeddings as morphisms), and we show that it is -a `κ`-accessible category. - -If `κ ≤ κ'` where `κ'` is also a regular cardinal, we characterize -the `κ'`-presentable objects of `CardinalFilteredPoset κ` as -the objects `J` such that the underlying type `J.obj` has -cardinality `< κ'`. +types (with order embeddings as morphisms). We shall show that it is +a `κ`-accessible category (TODO @joelriou). ## References * [Adámek, J. and Rosický, J., *Locally presentable and accessible categories*][Adamek_Rosicky_1994] From 96346f663197ceae2d0f5c8ecb9c374057fd2f30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 21 May 2026 21:25:19 +0200 Subject: [PATCH 198/309] leaving out some code here --- .../Presentable/CardinalDirectedPoset.lean | 25 ------------------- 1 file changed, 25 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean index 414337b977df97..27fd5d94dc811e 100644 --- a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean +++ b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean @@ -132,31 +132,6 @@ a partially ordered `κ`-filtered type `J` to `WithTop J`. -/ abbrev withTop (J : CardinalFilteredPoset κ) : CardinalFilteredPoset κ := .of (.of (WithTop J.obj)) -variable (κ) in -/-- The property of posets in `CardinalFilteredPoset κ` that are -of cardinality `< κ` and have terminal object. -/ -def hasCardinalLTWithTerminal : ObjectProperty (CardinalFilteredPoset κ) := - fun J ↦ HasCardinalLT J.obj κ ∧ HasTerminal J.obj - -instance : ObjectProperty.EssentiallySmall.{u} (hasCardinalLTWithTerminal κ) where - exists_small_le' := by - obtain ⟨X, hX⟩ : ∃ (X : Type u), Cardinal.mk X = κ := ⟨κ.ord.ToType, by simp⟩ - let α : Type u := Σ (S : Set X) (_ : PartialOrder S), - ULift.{u} (PLift (IsCardinalFiltered S κ)) - let (a : α) : PartialOrder a.1 := a.2.1 - let ι (a : α) : CardinalFilteredPoset κ := - { obj := .of a.1 - property := a.2.2.down.down } - refine ⟨.ofObj ι, inferInstance, fun J ⟨hJ, _⟩ ↦ ?_⟩ - obtain ⟨f⟩ : Cardinal.mk J.obj ≤ Cardinal.mk X := by - simpa [hX] using ((hasCardinalLT_iff_cardinal_mk_lt _ _).1 hJ).le - let e := Equiv.ofInjective _ f.injective - letI : PartialOrder (Set.range f) := PartialOrder.lift e.symm e.symm.injective - let e' : Set.range f ≃o J.obj := { toEquiv := e.symm, map_rel_iff' := by rfl } - exact ⟨_, ⟨⟨Set.range f, inferInstance, - ⟨⟨IsCardinalFiltered.of_equivalence κ e'.symm.equivalence⟩⟩⟩⟩, - ⟨CardinalFilteredPoset.ι.preimageIso (PartOrdEmb.Iso.mk (by exact e'.symm))⟩⟩ - namespace coconeWithTop variable (J : CardinalFilteredPoset κ) From 69d6fc5c86494af80dac3797d2a42840469e9097 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= <37772949+joelriou@users.noreply.github.com> Date: Thu, 21 May 2026 22:50:23 +0200 Subject: [PATCH 199/309] Update Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean Co-authored-by: Dagur Asgeirsson --- Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean index 27fd5d94dc811e..34ea4ae983b0c0 100644 --- a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean +++ b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean @@ -35,7 +35,7 @@ variable (κ : Cardinal.{u}) [Fact κ.IsRegular] /-- The property of objects in `PartOrdEmb` that are satisfied by partially ordered types of cardinality `< κ`. -/ abbrev isCardinalFiltered : ObjectProperty PartOrdEmb.{u} := - fun X ↦ IsCardinalFiltered X κ + fun X ↦ IsCardinalFiltered X κ @[simp] lemma isCardinalFiltered_iff (X : PartOrdEmb.{u}) : From 7ce5d15f807c92444300b44202bb3b38cc50ca30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= <37772949+joelriou@users.noreply.github.com> Date: Thu, 21 May 2026 22:50:32 +0200 Subject: [PATCH 200/309] Update Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean Co-authored-by: Dagur Asgeirsson --- Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean index 34ea4ae983b0c0..cb0f76df78a710 100644 --- a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean +++ b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean @@ -50,9 +50,9 @@ variable {κ} {J : Type u} [SmallCategory J] [IsCardinalFiltered J κ] {F : J ⥤ PartOrdEmb.{u}} {c : Cocone (F ⋙ forget _)} (hc : IsColimit c) lemma isCardinalFiltered_pt (hF : ∀ j, IsCardinalFiltered (F.obj j) κ) : - letI := isFiltered_of_isCardinalFiltered J κ + haveI := isFiltered_of_isCardinalFiltered J κ IsCardinalFiltered (CoconePt hc) κ := by - letI := isFiltered_of_isCardinalFiltered J κ + haveI := isFiltered_of_isCardinalFiltered J κ refine isCardinalFiltered_preorder _ _ (fun K f hK ↦ ?_) rw [← hasCardinalLT_iff_cardinal_mk_lt] at hK choose j₀ x₀ hx₀ using fun k ↦ Types.jointly_surjective_of_isColimit hc (f k) From 8702bdc64b3cda012baa0428936005d76bd0a981 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= <37772949+joelriou@users.noreply.github.com> Date: Thu, 21 May 2026 22:50:41 +0200 Subject: [PATCH 201/309] Update Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean Co-authored-by: Dagur Asgeirsson --- Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean index cb0f76df78a710..6b916063b07cde 100644 --- a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean +++ b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean @@ -214,7 +214,7 @@ noncomputable def isColimitCoconeWithTop : IsColimit (coconeWithTop J h) := | none => exact ⟨⟨_, pair_mem_indexSet _ (Classical.arbitrary _)⟩, ⟨⊤, Set.mem_insert_of_mem _ rfl⟩, rfl⟩ - · obtain rfl : x = y := h + · subst h exact ⟨j, 𝟙 _, rfl⟩) end From 0ca1ff49d478efe3ab3ec63c3df69e9ab55a0c1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 21 May 2026 22:51:49 +0200 Subject: [PATCH 202/309] wip --- .../Presentable/CardinalDirectedPoset.lean | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean index 0516855d654446..6c9bffe772a334 100644 --- a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean +++ b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean @@ -413,6 +413,20 @@ instance : IsCardinalAccessibleCategory (CardinalFilteredPoset κ) κ where ⟨hasCardinalLTWithTerminal κ, inferInstance, isCardinalFilteredGenerator_hasCardinalLTWithTerminal κ⟩ +variable (κ) (X : Type u) + +abbrev SetCardinalLT := Subtype (fun (S : Set X) ↦ HasCardinalLT S κ) + +instance : IsCardinalFiltered (SetCardinalLT κ X) κ := + isCardinalFiltered_preorder _ _ + (fun K f hK ↦ + ⟨⟨⋃ (k : K), (f k).val, hasCardinalLT_iUnion _ + (by rwa [hasCardinalLT_iff_cardinal_mk_lt]) (fun k ↦ (f k).prop)⟩, + Set.subset_iUnion (fun k ↦ (f k).val)⟩) + +abbrev setCardinalLT : CardinalFilteredPoset κ := + .of (PartOrdEmb.of (SetCardinalLT κ X)) + end CardinalFilteredPoset end CategoryTheory From 4981f8b8d8eb8071c0e23c7e5995154f8656df5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 22 May 2026 09:38:22 +0200 Subject: [PATCH 203/309] suggestions by @dagurtomas --- .../CategoryTheory/Presentable/CardinalDirectedPoset.lean | 3 +++ Mathlib/Order/Category/PartOrdEmb.lean | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean index 6b916063b07cde..c8d51f8dfe263f 100644 --- a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean +++ b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean @@ -136,6 +136,9 @@ namespace coconeWithTop variable (J : CardinalFilteredPoset κ) +-- The `@[nolint unusedArguments]` facilitates the definitions below towards +-- `isColimitCoconeWithTop`: in particlar, it allows to setup `IsCardinalFiltered` +-- instances on `indexSet J h` assuming `h : κ ≤ κ'`. /-- Given two regular cardinals `κ ≤ κ'` and `J : CardinalFilteredPoset κ`, this is the partially ordered set consisting of subsets `S` of `J.withTop` that are of cardinality `< κ'` and contain `⊤`. diff --git a/Mathlib/Order/Category/PartOrdEmb.lean b/Mathlib/Order/Category/PartOrdEmb.lean index c1244941685b10..96ebf343cfd545 100644 --- a/Mathlib/Order/Category/PartOrdEmb.lean +++ b/Mathlib/Order/Category/PartOrdEmb.lean @@ -171,6 +171,13 @@ def orderIsoOfIso {α β : PartOrdEmb.{u}} (e : α ≅ β) : right_inv := ConcreteCategory.congr_hom e.inv_hom_id map_rel_iff' := Hom.le_iff_le _ _ _ +/-- Isomorphisms in `PartOrdEmb` correspond to order isomorphisms. -/ +@[simps] +def orderIsoEquivIso {α β : PartOrdEmb.{u}} : + (α ≅ β) ≃ (α ≃o β) where + toFun := orderIsoOfIso + invFun := Iso.mk + instance : (forget PartOrdEmb.{u}).ReflectsIsomorphisms where reflects {α β} f hf := by rw [CategoryTheory.isIso_iff_bijective] at hf From f69a6cc4ec6c1939ad349c4b21a64b4e68f5a18a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 22 May 2026 11:11:13 +0200 Subject: [PATCH 204/309] wip --- .../Presentable/CardinalDirectedPoset.lean | 198 +++++++++--------- Mathlib/Order/Category/PartOrdEmb.lean | 43 +++- 2 files changed, 138 insertions(+), 103 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean index 62faf09c72d7cf..384b452125bdd8 100644 --- a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean +++ b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean @@ -144,6 +144,44 @@ a partially ordered `κ`-filtered type `J` to `WithTop J`. -/ abbrev withTop (J : CardinalFilteredPoset κ) : CardinalFilteredPoset κ := .of (.of (WithTop J.obj)) +section + +variable {J : CardinalFilteredPoset κ} (P : Set J.obj → Prop) + [IsDirectedOrder (Subtype P)] [Nonempty (Subtype P)] + [∀ (S : Subtype P), IsCardinalFiltered S.val κ] + +/-- Given a predicate `P : Set J.obj → Prop` on the underlying type +of `J : CardinalFilteredPoset κ` such that all the subsets satisfying `P` +are `κ`-filtered, this is the functor `Subtype P ⥤ CardinalFilteredPoset κ` +which sends a subset `S` of `J` satisfying `P` to the induced +partially ordered type `J`, as an object in `CardinalFilteredPoset κ`. -/ +@[simps!] +def functorOfPredicateSet : Subtype P ⥤ CardinalFilteredPoset κ := + ObjectProperty.lift _ (PartOrdEmb.functorOfPredicateSet P) + (fun S ↦ inferInstanceAs (IsCardinalFiltered S.val κ)) + +/-- Given a predicate `P : Set J.obj → Prop` on the underlying type +of `J : CardinalFilteredPoset κ` such that all the subsets satisfying `P` +are `κ`-filtered, this is the cocone with point `J` given +by all the inclusions of the substs satisfying `P`. -/ +@[simps] +def coconeOfPredicateSet : Cocone (functorOfPredicateSet P) where + pt := J + ι.app j := ObjectProperty.homMk ((PartOrdEmb.coconeOfPredicateSet P).ι.app j) + +/-- Let `P` be a predicate on `Set J.obj` where `J : CardinalFilteredPoset κ`. +We assume that `Subtype P` is directed and nonempty, and that any `a : J.obj` +belongs to some `S : Set J.obj` satisfying `P`. Then, `J` is the colimit in the +category `CardinalFilteredPoset κ` of these subsets. -/ +noncomputable def isColimitCoconeOfPredicateSet + [IsDirectedOrder (Subtype P)] [Nonempty (Subtype P)] + (hP : ∀ (a : J.obj), ∃ (S : Set J.obj), P S ∧ a ∈ S) : + IsColimit (coconeOfPredicateSet P) := + isColimitOfReflects (CardinalFilteredPoset.ι) + (PartOrdEmb.isColimitOfPredicateSet P hP) + +end + variable (κ) in /-- The property of posets in `CardinalFilteredPoset κ` that are of cardinality `< κ` and have terminal object. -/ @@ -214,38 +252,27 @@ lemma isCardinalPresentable_of_hasCardinalLT_of_le (J : CardinalFilteredPoset κ PartOrdEmb.hom_comp, RelEmbedding.coe_trans, Function.comp_apply] using congr_arg _ (hk x)⟩⟩⟩ -namespace coconeWithTop +section variable (J : CardinalFilteredPoset κ) --- The `@[nolint unusedArguments]` facilitates the definitions below towards --- `isColimitCoconeWithTop`: in particlar, it allows to setup `IsCardinalFiltered` --- instances on `indexSet J h` assuming `h : κ ≤ κ'`. -/-- Given two regular cardinals `κ ≤ κ'` and `J : CardinalFilteredPoset κ`, -this is the partially ordered set consisting of subsets `S` of `J.withTop` -that are of cardinality `< κ'` and contain `⊤`. -See `CardinalFilteredPoset.isColimitCoconeWithTop` for the fact that `withTop J` -identifies to the colimit of such `S`. -/ -@[nolint unusedArguments] -def indexSet {κ' : Cardinal.{u}} [Fact κ'.IsRegular] (_ : κ ≤ κ') : - Set (Set J.withTop.obj) := - setOf (fun S ↦ HasCardinalLT S κ' ∧ ⊤ ∈ S) - -variable {κ' : Cardinal.{u}} [Fact κ'.IsRegular] {h : κ ≤ κ'} - -variable {J} (h) in -lemma pair_mem_indexSet (j : J.obj) : {WithTop.some j, ⊤} ∈ indexSet J h := - ⟨hasCardinalLT_of_finite _ _ (Cardinal.IsRegular.aleph0_le Fact.out), - Set.mem_insert_of_mem _ (by simp)⟩ +-- `@[nolint unusedArguments]` allows to setup some instances which uses +-- the fact that `κ'` is regular. +def PropSetWithTop (κ' : Cardinal.{u}) [Fact κ'.IsRegular] + (S : Set J.withTop.obj) : Prop := + HasCardinalLT S κ' ∧ ⊤ ∈ S + +variable (κ' : Cardinal.{u}) [Fact κ'.IsRegular] -instance (S : indexSet J h) : HasTerminal S := +instance (S : Subtype (J.PropSetWithTop κ')) : HasTerminal S := IsTerminal.hasTerminal (X := ⟨⊤, S.2.2⟩) (IsTerminal.ofUniqueHom (fun _ ↦ homOfLE (by rw [Subtype.mk_le_mk]; exact le_top)) (fun _ _ ↦ rfl)) -instance (S : indexSet J h) : IsCardinalFiltered S κ := isCardinalFiltered_of_hasTerminal _ _ +instance (S : Subtype (J.PropSetWithTop κ')) : IsCardinalFiltered S κ := + isCardinalFiltered_of_hasTerminal _ _ -instance : IsCardinalFiltered (indexSet J h) κ' := +instance : IsCardinalFiltered (Subtype (J.PropSetWithTop κ')) κ' := isCardinalFiltered_preorder _ _ (fun K α hK ↦ by rw [← hasCardinalLT_iff_cardinal_mk_lt] at hK have hκ' : Cardinal.aleph0 ≤ κ' := Cardinal.IsRegular.aleph0_le Fact.out @@ -256,58 +283,43 @@ instance : IsCardinalFiltered (indexSet J h) κ' := simp only [Set.le_eq_subset] exact subset_trans (Set.subset_iUnion (fun i ↦ (α i).1) k) Set.subset_union_left) -instance : IsFiltered (indexSet J h) := isFiltered_of_isCardinalFiltered _ κ' +instance : IsFiltered (Subtype (J.PropSetWithTop κ')) := + isFiltered_of_isCardinalFiltered _ κ' -variable (h) in -/-- Given `J : CardinalFilteredPoset κ` and an inequality `κ ≤ κ'` -where `κ'` is a regular cardinal, this is the functor which sends -a subset `S` of `J.obj` of cardinality `< κ'` and containing `⊤` to `S` -as an object in `CardinalFilteredPoset κ`. -/ -@[simps] -def functor : indexSet J h ⥤ CardinalFilteredPoset κ where - obj S := of (.of S.val) - map f := ObjectProperty.homMk (PartOrdEmb.ofHom - { toFun x := ⟨x, leOfHom f x.2⟩ - inj' := by rintro ⟨x, _⟩ ⟨y, _⟩ h; simpa using h - map_rel_iff' := by rfl }) +instance : IsDirectedOrder (Subtype (J.PropSetWithTop κ')) := + IsFiltered.isDirectedOrder _ -end coconeWithTop +instance : Nonempty (Subtype (J.PropSetWithTop κ')) := + IsFiltered.nonempty -section - -variable (J : CardinalFilteredPoset κ) {κ' : Cardinal.{u}} [Fact κ'.IsRegular] (h : κ ≤ κ') +variable {J} in +lemma propSetWithTop_pair (j : J.obj) : J.PropSetWithTop κ' {WithTop.some j, ⊤} := + ⟨hasCardinalLT_of_finite _ _ (Cardinal.IsRegular.aleph0_le Fact.out), + Set.mem_insert_of_mem _ (by simp)⟩ -/-- If `κ ≤ κ'` is an inequality between regular cardinals, and -`J : CardinalFilteredPoset κ`, this is the (colimit) cocone which -expresses `J.withTop` as a colimit of its subsets that are of -cardinality `< κ'` and contain `⊤`. -/ -@[simps] -def coconeWithTop : Cocone (coconeWithTop.functor J h) where - pt := J.withTop - ι.app _ := ObjectProperty.homMk (PartOrdEmb.ofHom (OrderEmbedding.subtype _)) - -open coconeWithTop in -/-- If `κ ≤ κ'` is an inequality between regular cardinals, and -`J : CardinalFilteredPoset κ`, then `J.withTop` is the colimit of -its subsets that are of cardinality `< κ'` and contain `⊤`. -/ -noncomputable def isColimitCoconeWithTop : IsColimit (coconeWithTop J h) := - isColimitOfReflects (CardinalFilteredPoset.ι ⋙ forget PartOrdEmb) (by - refine Types.FilteredColimit.isColimitOf' _ _ (fun x ↦ ?_) (fun j ⟨x, _⟩ ⟨y, _⟩ h ↦ ?_) - · induction x with - | some x => - exact ⟨⟨_, pair_mem_indexSet _ x⟩, ⟨x, Set.mem_insert _ _⟩, rfl⟩ - | none => - exact ⟨⟨_, pair_mem_indexSet _ (Classical.arbitrary _)⟩, - ⟨⊤, Set.mem_insert_of_mem _ rfl⟩, rfl⟩ - · subst h - exact ⟨j, 𝟙 _, rfl⟩) - -include h in -protected lemma isCardinalPresentable_iff : +lemma exists_mem_propSetWithTop (a : J.withTop.obj) : + ∃ S, J.PropSetWithTop κ' S ∧ a ∈ S := by + induction a with + | some a => exact ⟨_, propSetWithTop_pair _ a, by aesop⟩ + | none => exact ⟨_, propSetWithTop_pair _ (Classical.arbitrary _), by aesop⟩ + +abbrev coconeWithTop : Cocone (functorOfPredicateSet (J.PropSetWithTop κ')) := + coconeOfPredicateSet (PropSetWithTop J κ') + +/-- If `J : CardinalFilteredPoset κ` and `κ'` is any regular cardinal, +then `J.withTop` is the colimit of its subsets that are of cardinality `< κ'` and contain `⊤`. -/ +noncomputable def isColimitCoconeWithTop : IsColimit (coconeWithTop J κ') := + isColimitCoconeOfPredicateSet _ (fun a ↦ by + induction a with + | some a => exact ⟨_, propSetWithTop_pair _ a, by aesop⟩ + | none => exact ⟨_, propSetWithTop_pair _ (Classical.arbitrary _), by aesop⟩) + +variable {κ'} in +protected lemma isCardinalPresentable_iff (h : κ ≤ κ') : IsCardinalPresentable J κ' ↔ HasCardinalLT J.obj κ' := by refine ⟨fun _ ↦ ?_, fun hJ ↦ isCardinalPresentable_of_hasCardinalLT_of_le _ hJ h⟩ obtain ⟨X, f, hf⟩ := - IsCardinalPresentable.exists_hom_of_isColimit κ' (isColimitCoconeWithTop J h) + IsCardinalPresentable.exists_hom_of_isColimit κ' (isColimitCoconeWithTop J κ') (ObjectProperty.homMk (PartOrdEmb.ofHom WithTop.coeOrderHom)) replace hf : OrderEmbedding.subtype X.1 ∘ f = WithTop.coeOrderHom := by ext x @@ -324,25 +336,25 @@ protected lemma isCardinalPresentable_iff' (J : CardinalFilteredPoset κ) : IsCardinalPresentable J κ ↔ HasCardinalLT J.obj κ := CardinalFilteredPoset.isCardinalPresentable_iff _ (le_refl _) -namespace cocone +section variable (J : CardinalFilteredPoset κ) -/-- Given `J : CardinalFilteredPoset κ`, this is the partially ordered set consisting -of subsets of `J.obj` that are of cardinality `< κ` and have a terminal object. -/ -def indexSet : Set (Set J.obj) := setOf (fun S ↦ HasCardinalLT S κ ∧ HasTerminal S) +def PropSet (S : Set J.obj) : Prop := + HasCardinalLT S κ ∧ HasTerminal S -instance (S : indexSet J) : HasTerminal S := S.prop.2 +instance (S : Subtype J.PropSet) : HasTerminal S := S.prop.2 -instance (S : indexSet J) : IsCardinalFiltered S κ := isCardinalFiltered_of_hasTerminal _ _ +instance (S : Subtype J.PropSet) : IsCardinalFiltered S κ := + isCardinalFiltered_of_hasTerminal _ _ variable {J} in -lemma singleton_mem_indexSet (j : J.obj) : {j} ∈ indexSet J := +lemma propSetWithTop_singleton (j : J.obj) : J.PropSet {j} := ⟨hasCardinalLT_of_finite _ _ (Cardinal.IsRegular.aleph0_le Fact.out), by let : OrderTop ({j} : Set J.obj) := { top := ⟨j, rfl⟩, le_top := by simp } exact isTerminalTop.hasTerminal⟩ -instance : IsCardinalFiltered (indexSet J) κ := +instance : IsCardinalFiltered (Subtype J.PropSet) κ := isCardinalFiltered_preorder _ _ (fun K α hK ↦ by rw [← hasCardinalLT_iff_cardinal_mk_lt] at hK let t (k : K) : (α k).val := ⊤_ _ @@ -365,38 +377,24 @@ instance : IsCardinalFiltered (indexSet J) κ := · simp only [← Subtype.coe_le_coe, Set.le_eq_subset] exact subset_trans (Set.subset_iUnion_of_subset k (subset_refl _)) Set.subset_union_left ) -instance : IsFiltered (indexSet J) := isFiltered_of_isCardinalFiltered _ κ +instance : IsFiltered (Subtype J.PropSet) := isFiltered_of_isCardinalFiltered _ κ -/-- Given `J : CardinalFilteredPoset κ`, this is the functor which sends -a subset `S` of `J.obj` of cardinality `< κ` with a terminal object to `S` -as an object in `CardinalFilteredPoset κ`. -/ -@[simps] -def functor : indexSet J ⥤ CardinalFilteredPoset κ where - obj S := of (.of S.val) - map f := ObjectProperty.homMk (PartOrdEmb.ofHom - { toFun x := ⟨x, leOfHom f x.2⟩ - inj' := by rintro ⟨x, _⟩ ⟨y, _⟩ h; simpa using h - map_rel_iff' := by rfl }) +instance : IsDirectedOrder (Subtype J.PropSet) := + IsFiltered.isDirectedOrder _ -end cocone +instance : Nonempty (Subtype J.PropSet) := + IsFiltered.nonempty -/-- The (colimit) cocone which expresses `J : CardinalFilteredPoset κ` as a colimit -of its subsets that are of cardinality `< κ` and have a terminal object. -/ -@[simps] -def cocone (J : CardinalFilteredPoset κ) : Cocone (cocone.functor J) where - pt := J - ι.app _ := ObjectProperty.homMk (PartOrdEmb.ofHom (OrderEmbedding.subtype _)) +abbrev cocone : Cocone (functorOfPredicateSet J.PropSet) := + coconeOfPredicateSet J.PropSet -open cocone in /-- Any object `J : CardinalFilteredPoset κ` is a colimit of its subsets that are of cardinality `< κ` and have a terminal object. -/ noncomputable def isColimitCocone (J : CardinalFilteredPoset κ) : IsColimit (cocone J) := - isColimitOfReflects (CardinalFilteredPoset.ι ⋙ forget PartOrdEmb) (by - refine Types.FilteredColimit.isColimitOf' _ _ (fun x ↦ ?_) (fun j ⟨x, _⟩ ⟨y, _⟩ h ↦ ?_) - · exact ⟨⟨_, singleton_mem_indexSet x⟩, ⟨x, rfl⟩, rfl⟩ - · obtain rfl : x = y := by simpa using h - exact ⟨j, 𝟙 _, rfl⟩) + isColimitCoconeOfPredicateSet _ (fun a ↦ ⟨_, propSetWithTop_singleton a, by simp⟩) + +end variable (κ) in lemma isCardinalFilteredGenerator_hasCardinalLTWithTerminal : diff --git a/Mathlib/Order/Category/PartOrdEmb.lean b/Mathlib/Order/Category/PartOrdEmb.lean index 96ebf343cfd545..7e893f7a0b827d 100644 --- a/Mathlib/Order/Category/PartOrdEmb.lean +++ b/Mathlib/Order/Category/PartOrdEmb.lean @@ -209,11 +209,10 @@ theorem partOrdEmb_dual_comp_forget_to_pardOrd : namespace PartOrdEmb -variable {J : Type u} [SmallCategory J] [IsFiltered J] {F : J ⥤ PartOrdEmb.{u}} - namespace Limits -variable {c : Cocone (F ⋙ forget _)} (hc : IsColimit c) +variable {J : Type u} [SmallCategory J] [IsFiltered J] {F : J ⥤ PartOrdEmb.{u}} + {c : Cocone (F ⋙ forget _)} (hc : IsColimit c) /-- Given a functor `F : J ⥤ PartOrdEmb` and a colimit cocone `c` for `F ⋙ forget _`, this is the type `c.pt` on which we define a partial order @@ -355,4 +354,42 @@ instance : PreservesFilteredColimitsOfSize.{u, u} (forget PartOrdEmb.{u}) where end Limits +variable {α : PartOrdEmb.{u}} (P : Set α → Prop) + +/-- Given a predicate `P : Set α → Prop` on the underlying type of `α : PartOrdEmb.{u}`, +this is the functor `Subtype P ⥤ PartOrdEmb.{u}` which sends a subset `J` of `α` +satisfying `P` to the induced partially ordered type `J`. -/ +@[simps] +def functorOfPredicateSet : Subtype P ⥤ PartOrdEmb.{u} where + obj J := .of J.val + map f := + ofHom { + toFun x := ⟨x, leOfHom f x.prop⟩ + inj' _ _ _ := by aesop + map_rel_iff' := by rfl } + +/-- Given a predicate `P : Set α → Prop` on the underlying type of `α : PartOrdEmb.{u}`, +this is the cocone with point `α` given by all the inclusions of the subsets +satisfying `P`. -/ +@[simps] +def coconeOfPredicateSet : Cocone (functorOfPredicateSet P) where + pt := α + ι.app J := ofHom (OrderEmbedding.subtype _) + +variable [IsDirectedOrder (Subtype P)] [Nonempty (Subtype P)] + +/-- Let `P` be a predicate on `Set α` where `α : PartOrdEmb`. We assume +that `Subtype P` is directed and nonempty, and that any `a : α` belongs +to some `J : Set α` satisfying `P`. Then, `α` is the colimit in the +category `PartOrdEmb` of these subsets. -/ +noncomputable def isColimitOfPredicateSet + [IsDirectedOrder (Subtype P)] [Nonempty (Subtype P)] + (hP : ∀ (a : α), ∃ (J : Set α), P J ∧ a ∈ J) : + IsColimit (coconeOfPredicateSet P) := + isColimitOfReflects (forget PartOrdEmb.{u}) (by + refine Types.FilteredColimit.isColimitOf' _ _ (fun a ↦ ?_) + (fun J x y h ↦ ⟨J, 𝟙 _, Subtype.ext h⟩) + obtain ⟨J, hJ, ha⟩ := hP a + exact ⟨⟨J, hJ⟩, ⟨a, ha⟩, rfl⟩) + end PartOrdEmb From a4c0062efe1b4eea98e2d9ef770a69e920b6207b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 22 May 2026 11:17:15 +0200 Subject: [PATCH 205/309] fix --- Mathlib/Order/Category/PartOrdEmb.lean | 2 -- 1 file changed, 2 deletions(-) diff --git a/Mathlib/Order/Category/PartOrdEmb.lean b/Mathlib/Order/Category/PartOrdEmb.lean index 7e893f7a0b827d..72f44fadeddfe6 100644 --- a/Mathlib/Order/Category/PartOrdEmb.lean +++ b/Mathlib/Order/Category/PartOrdEmb.lean @@ -376,8 +376,6 @@ def coconeOfPredicateSet : Cocone (functorOfPredicateSet P) where pt := α ι.app J := ofHom (OrderEmbedding.subtype _) -variable [IsDirectedOrder (Subtype P)] [Nonempty (Subtype P)] - /-- Let `P` be a predicate on `Set α` where `α : PartOrdEmb`. We assume that `Subtype P` is directed and nonempty, and that any `a : α` belongs to some `J : Set α` satisfying `P`. Then, `α` is the colimit in the From 8dcfbf05194f3a6813d7834fa1e233b9134f8545 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 22 May 2026 22:42:43 +0200 Subject: [PATCH 206/309] wip --- .../Presentable/CardinalDirectedPoset.lean | 4 ++ .../CategoryTheory/Presentable/SharplyLT.lean | 61 +++++++++++++------ 2 files changed, 46 insertions(+), 19 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean index 94b657440dc151..98431190e04dd5 100644 --- a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean +++ b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean @@ -418,6 +418,10 @@ variable (κ) (X : Type u) abbrev SetCardinalLT := Subtype (fun (S : Set X) ↦ HasCardinalLT S κ) +variable {X} in +abbrev SetCardinalLT.singleton (x : X) : SetCardinalLT κ X := + ⟨{x}, hasCardinalLT_of_finite _ _ (Cardinal.IsRegular.aleph0_le Fact.out)⟩ + instance : IsCardinalFiltered (SetCardinalLT κ X) κ := isCardinalFiltered_preorder _ _ (fun K f hK ↦ diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT.lean index 767100b3723941..85ad5bf92f2af2 100644 --- a/Mathlib/CategoryTheory/Presentable/SharplyLT.lean +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT.lean @@ -26,14 +26,42 @@ namespace Cardinal variable {κ₁ κ₂ : Cardinal.{w}} [Fact κ₁.IsRegular] [Fact κ₂.IsRegular] variable (κ₁ κ₂) in -structure SharplyLT : Prop where - lt : κ₁ < κ₂ +structure SharplyLE : Prop where + le : κ₁ ≤ κ₂ isCardinalAccessible_cardinalDirectedPoset : IsCardinalAccessibleCategory (CardinalFilteredPoset κ₁) κ₂ -namespace SharplyLT - -lemma le (h : SharplyLT κ₁ κ₂) : κ₁ ≤ κ₂ := h.lt.le +open CardinalFilteredPoset in +lemma exists_cofinal_of_isCardinalAccessibleCategory_cardinalFilteredPoset + (h : κ₁ ≤ κ₂) [IsCardinalAccessibleCategory (CardinalFilteredPoset κ₁) κ₂] + {X : Type w} (hX : HasCardinalLT X κ₂) : + ∃ (A : Set (SetCardinalLT κ₁ X)), HasCardinalLT A κ₂ ∧ IsCofinal A := by + obtain ⟨J, _, _, ⟨p⟩⟩ := (isCardinalFilteredGenerator_isCardinalPresentable + (CardinalFilteredPoset κ₁) κ₂).exists_colimitsOfShape (setCardinalLT κ₁ X) + have : IsCardinalFiltered J κ₁ := .of_le _ h + have hp (j : J) : HasCardinalLT (p.diag.obj j).obj κ₂ := by + rw [← CardinalFilteredPoset.isCardinalPresentable_iff _ h] + exact p.prop_diag_obj j + choose j y hy using fun x ↦ Types.jointly_surjective_of_isColimit + (isColimitOfPreserves (forget (CardinalFilteredPoset κ₁)) p.isColimit) + (SetCardinalLT.singleton κ₁ x) + dsimp at y hy + let j' := IsCardinalFiltered.max j hX + let y' (x : X) : (p.diag.obj j').obj := + p.diag.map (IsCardinalFiltered.toMax j hX x) (y x) + have hy' (x : X) : p.ι.app j' (y' x) = SetCardinalLT.singleton κ₁ x := by + rw [← hy, ← p.w (IsCardinalFiltered.toMax j hX x)] + rfl + refine ⟨Set.range (p.ι.app j'), (hp j').of_surjective _ + (Set.rangeFactorization_surjective (f := p.ι.app j')), fun ⟨B, hB⟩ ↦ ?_⟩ + let j'' := IsCardinalFiltered.max (fun b ↦ y' b.val) hB + refine ⟨_, ⟨j'', rfl⟩, fun b hb ↦ ?_⟩ + have : y' b ≤ j'' := (leOfHom (IsCardinalFiltered.toMax (fun b ↦ y' b.val) hB ⟨b, hb⟩) :) + refine (p.ι.app j').hom.hom.monotone this ?_ + convert Set.mem_singleton b + exact Subtype.ext_iff.1 (hy' b) + +namespace SharplyLE section @@ -41,11 +69,11 @@ section is a property of objects which allows to show that `C` is a `κ₂`-accessible category. This property is defined as the closure of `κ₁`-presentable objects under colimits of shape `J` for categories `J` such that `Arrow J` is of cardinality `< κ₂`. -/ -def generator (_ : SharplyLT κ₁ κ₂) (C : Type u) [Category.{v} C] : +abbrev generator (_ : SharplyLE κ₁ κ₂) (C : Type u) [Category.{v} C] : ObjectProperty C := (isCardinalPresentable C κ₁).colimitsCardinalClosure κ₂ -variable (h : SharplyLT κ₁ κ₂) (C : Type u) [Category.{v} C] +variable (h : SharplyLE κ₁ κ₂) (C : Type u) [Category.{v} C] lemma generator_le_isCardinalPresentable [LocallySmall.{w} C] : h.generator C ≤ isCardinalPresentable C κ₂ := @@ -53,16 +81,11 @@ lemma generator_le_isCardinalPresentable [LocallySmall.{w} C] : (fun _ _ hJ ↦ isClosedUnderColimitsOfShape_isCardinalPresentable C hJ) (isCardinalPresentable_monotone _ h.le) -instance [IsCardinalAccessibleCategory C κ₁] : - ObjectProperty.EssentiallySmall.{w} (h.generator C) := by - dsimp [generator] - infer_instance - variable [IsCardinalAccessibleCategory C κ₁] namespace isCardinalFilteredGenerator -def prop (_ : SharplyLT κ₁ κ₂) (J : Type w) [PartialOrder J] (A : Set J) : Prop := +def prop (_ : SharplyLE κ₁ κ₂) (J : Type w) [PartialOrder J] (A : Set J) : Prop := IsCardinalFiltered (Subtype A) κ₁ ∧ HasCardinalLT (Subtype A) κ₂ variable {h} {C} {X : C} {J : Type w} [PartialOrder J] @@ -168,21 +191,21 @@ lemma isCardinalFilteredGenerator : end -lemma isCardinalAccessible (h : SharplyLT κ₁ κ₂) +lemma isCardinalAccessible (h : SharplyLE κ₁ κ₂) (C : Type u) [Category.{v} C] [IsCardinalAccessibleCategory C κ₁] : IsCardinalAccessibleCategory C κ₂ where toHasCardinalFilteredColimits := .of_le C h.le exists_generator := ⟨_, inferInstance, h.isCardinalFilteredGenerator C⟩ -lemma trans (h₁₂ : SharplyLT κ₁ κ₂) {κ₃ : Cardinal.{w}} [Fact κ₃.IsRegular] - (h₂₃ : SharplyLT κ₂ κ₃) : - SharplyLT κ₁ κ₃ where - lt := h₁₂.lt.trans h₂₃.lt +lemma trans (h₁₂ : SharplyLE κ₁ κ₂) {κ₃ : Cardinal.{w}} [Fact κ₃.IsRegular] + (h₂₃ : SharplyLE κ₂ κ₃) : + SharplyLE κ₁ κ₃ where + le := h₁₂.le.trans h₂₃.le isCardinalAccessible_cardinalDirectedPoset := by have := h₁₂.isCardinalAccessible_cardinalDirectedPoset exact h₂₃.isCardinalAccessible _ -end SharplyLT +end SharplyLE end Cardinal From b97923365290690d92167c146b6923f59a6cea8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sat, 23 May 2026 10:54:09 +0200 Subject: [PATCH 207/309] wip --- Mathlib/CategoryTheory/Presentable/SharplyLT.lean | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT.lean index 85ad5bf92f2af2..48f7cd75927ed1 100644 --- a/Mathlib/CategoryTheory/Presentable/SharplyLT.lean +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT.lean @@ -61,6 +61,15 @@ lemma exists_cofinal_of_isCardinalAccessibleCategory_cardinalFilteredPoset convert Set.mem_singleton b exact Subtype.ext_iff.1 (hy' b) +open CardinalFilteredPoset in +lemma exists_isCardinalFiltered_set_of_exists_cofinal (h₀ : κ₁ ≤ κ₂) + (h : ∀ (X : Type w) (hX : HasCardinalLT X κ₂), + ∃ (A : Set (SetCardinalLT κ₁ X)), HasCardinalLT A κ₂ ∧ IsCofinal A) + {X : Type w} [PartialOrder X] [IsCardinalFiltered X κ₁] + (A : Set X) (hA : HasCardinalLT A κ₂) : + ∃ (B : Set X), A ⊆ B ∧ IsCardinalFiltered B κ₁ ∧ HasCardinalLT B κ₂ := by + sorry + namespace SharplyLE section From 0980c2d3c69e633d5cf9ce7ba3a6251bbe5533a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sat, 23 May 2026 15:34:35 +0200 Subject: [PATCH 208/309] wip --- .../CategoryTheory/Presentable/SharplyLT.lean | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT.lean index 48f7cd75927ed1..48f3c5ebd47dc1 100644 --- a/Mathlib/CategoryTheory/Presentable/SharplyLT.lean +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT.lean @@ -26,8 +26,8 @@ namespace Cardinal variable {κ₁ κ₂ : Cardinal.{w}} [Fact κ₁.IsRegular] [Fact κ₂.IsRegular] variable (κ₁ κ₂) in -structure SharplyLE : Prop where - le : κ₁ ≤ κ₂ +structure SharplyLT : Prop where + lt : κ₁ < κ₂ isCardinalAccessible_cardinalDirectedPoset : IsCardinalAccessibleCategory (CardinalFilteredPoset κ₁) κ₂ @@ -62,7 +62,7 @@ lemma exists_cofinal_of_isCardinalAccessibleCategory_cardinalFilteredPoset exact Subtype.ext_iff.1 (hy' b) open CardinalFilteredPoset in -lemma exists_isCardinalFiltered_set_of_exists_cofinal (h₀ : κ₁ ≤ κ₂) +lemma exists_isCardinalFiltered_set_of_exists_cofinal (h₀ : κ₁ < κ₂) (h : ∀ (X : Type w) (hX : HasCardinalLT X κ₂), ∃ (A : Set (SetCardinalLT κ₁ X)), HasCardinalLT A κ₂ ∧ IsCofinal A) {X : Type w} [PartialOrder X] [IsCardinalFiltered X κ₁] @@ -70,7 +70,9 @@ lemma exists_isCardinalFiltered_set_of_exists_cofinal (h₀ : κ₁ ≤ κ₂) ∃ (B : Set X), A ⊆ B ∧ IsCardinalFiltered B κ₁ ∧ HasCardinalLT B κ₂ := by sorry -namespace SharplyLE +namespace SharplyLT + +lemma le (h : SharplyLT κ₁ κ₂) : κ₁ ≤ κ₂ := h.lt.le section @@ -78,11 +80,11 @@ section is a property of objects which allows to show that `C` is a `κ₂`-accessible category. This property is defined as the closure of `κ₁`-presentable objects under colimits of shape `J` for categories `J` such that `Arrow J` is of cardinality `< κ₂`. -/ -abbrev generator (_ : SharplyLE κ₁ κ₂) (C : Type u) [Category.{v} C] : +abbrev generator (_ : SharplyLT κ₁ κ₂) (C : Type u) [Category.{v} C] : ObjectProperty C := (isCardinalPresentable C κ₁).colimitsCardinalClosure κ₂ -variable (h : SharplyLE κ₁ κ₂) (C : Type u) [Category.{v} C] +variable (h : SharplyLT κ₁ κ₂) (C : Type u) [Category.{v} C] lemma generator_le_isCardinalPresentable [LocallySmall.{w} C] : h.generator C ≤ isCardinalPresentable C κ₂ := @@ -94,7 +96,7 @@ variable [IsCardinalAccessibleCategory C κ₁] namespace isCardinalFilteredGenerator -def prop (_ : SharplyLE κ₁ κ₂) (J : Type w) [PartialOrder J] (A : Set J) : Prop := +def prop (_ : SharplyLT κ₁ κ₂) (J : Type w) [PartialOrder J] (A : Set J) : Prop := IsCardinalFiltered (Subtype A) κ₁ ∧ HasCardinalLT (Subtype A) κ₂ variable {h} {C} {X : C} {J : Type w} [PartialOrder J] @@ -200,21 +202,21 @@ lemma isCardinalFilteredGenerator : end -lemma isCardinalAccessible (h : SharplyLE κ₁ κ₂) +lemma isCardinalAccessible (h : SharplyLT κ₁ κ₂) (C : Type u) [Category.{v} C] [IsCardinalAccessibleCategory C κ₁] : IsCardinalAccessibleCategory C κ₂ where toHasCardinalFilteredColimits := .of_le C h.le exists_generator := ⟨_, inferInstance, h.isCardinalFilteredGenerator C⟩ -lemma trans (h₁₂ : SharplyLE κ₁ κ₂) {κ₃ : Cardinal.{w}} [Fact κ₃.IsRegular] - (h₂₃ : SharplyLE κ₂ κ₃) : - SharplyLE κ₁ κ₃ where - le := h₁₂.le.trans h₂₃.le +lemma trans (h₁₂ : SharplyLT κ₁ κ₂) {κ₃ : Cardinal.{w}} [Fact κ₃.IsRegular] + (h₂₃ : SharplyLT κ₂ κ₃) : + SharplyLT κ₁ κ₃ where + lt := h₁₂.lt.trans h₂₃.lt isCardinalAccessible_cardinalDirectedPoset := by have := h₁₂.isCardinalAccessible_cardinalDirectedPoset exact h₂₃.isCardinalAccessible _ -end SharplyLE +end SharplyLT end Cardinal From 031610c9f08bd714de16a759b0b28693a0932f79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Mon, 25 May 2026 16:39:33 +0200 Subject: [PATCH 209/309] wip --- .../CategoryTheory/Presentable/SharplyLT.lean | 78 ++++++++++++++++++- 1 file changed, 76 insertions(+), 2 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT.lean index 48f3c5ebd47dc1..faaa7cb8705dbc 100644 --- a/Mathlib/CategoryTheory/Presentable/SharplyLT.lean +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT.lean @@ -9,6 +9,7 @@ public import Mathlib.CategoryTheory.ObjectProperty.ColimitsCardinalClosure public import Mathlib.CategoryTheory.Presentable.CardinalDirectedPoset public import Mathlib.CategoryTheory.Presentable.Dense public import Mathlib.CategoryTheory.Presentable.Directed +public import Mathlib.Order.TransfiniteIteration /-! # Sharply smaller regular cardinals @@ -61,14 +62,87 @@ lemma exists_cofinal_of_isCardinalAccessibleCategory_cardinalFilteredPoset convert Set.mem_singleton b exact Subtype.ext_iff.1 (hy' b) -open CardinalFilteredPoset in +open CardinalFilteredPoset Classical in lemma exists_isCardinalFiltered_set_of_exists_cofinal (h₀ : κ₁ < κ₂) (h : ∀ (X : Type w) (hX : HasCardinalLT X κ₂), ∃ (A : Set (SetCardinalLT κ₁ X)), HasCardinalLT A κ₂ ∧ IsCofinal A) {X : Type w} [PartialOrder X] [IsCardinalFiltered X κ₁] (A : Set X) (hA : HasCardinalLT A κ₂) : ∃ (B : Set X), A ⊆ B ∧ IsCardinalFiltered B κ₁ ∧ HasCardinalLT B κ₂ := by - sorry + have hκ₁ : κ₁.IsRegular := Fact.out + have hκ₂ : κ₂.IsRegular := Fact.out + have : NoMaxOrder κ₁.ord.ToType := noMaxOrder (hκ₁.aleph0_le) + choose Y hY hY' using fun (B : Set X) hB ↦ h B hB + have hY'' (B : Set X) (hB : HasCardinalLT B κ₂) + (C : SetCardinalLT κ₁ B) (hC : C ∈ Y B hB) : + ∃ (m : X), ∀ (b : B), b ∈ C.val → b ≤ m := + ⟨IsCardinalFiltered.max (fun (c : C.val) ↦ c.val.val) C.prop, + fun b hb ↦ leOfHom (IsCardinalFiltered.toMax + (fun (c : C.val) ↦ c.val.val) C.prop ⟨_, hb⟩)⟩ + choose m hm using hY'' + let φ₀ (B : Set X) (hB : HasCardinalLT B κ₂) : Set X := + ⋃ (C : Y B hB), Subtype.val '' C.val.val ∪ {m B hB _ C.prop} + have hφ₀ (B : Set X) (hB : HasCardinalLT B κ₂) {T : Type w} (f : T → B) + (hT : HasCardinalLT T κ₁) : + ∃ (m : φ₀ B hB), ∀ (t : T), f t ≤ m.val := sorry + let φ (B : Set X) : Set X := + if hB : HasCardinalLT B κ₂ then φ₀ B hB else B + have φ_eq (B : Set X) (hB : HasCardinalLT B κ₂) : φ B = φ₀ B hB := dif_pos hB + have hφ (B : Set X) : B ≤ φ B := by + dsimp [φ] + split_ifs with hB + · intro b hb + obtain ⟨C, hC, hC'⟩ := hY' B hB ⟨{⟨b, hb⟩}, hasCardinalLT_of_finite _ _ hκ₁.aleph0_le⟩ + refine Set.subset_iUnion _ ⟨C, hC⟩ (Or.inl ?_) + simp only [Set.mem_image, Subtype.exists, exists_and_right, exists_eq_right] + refine ⟨hb, @hC' ⟨b, hb⟩ (by simp)⟩ + · simp + let : Nonempty κ₁.ord.ToType := by + rw [Ordinal.nonempty_toType_iff, ne_eq, ord_eq_zero] + exact IsRegular.ne_zero Fact.out + let : OrderBot κ₁.ord.ToType := WellFoundedLT.toOrderBot _ + let s (j : κ₁.ord.ToType) : Set X := transfiniteIterate φ j A + have hs : Monotone s := monotone_transfiniteIterate _ _ hφ + have hs' (j) : HasCardinalLT (s j) κ₂ := by + induction j using SuccOrder.limitRecOn with + | isMin j hj => simpa [hj.eq_bot, s] + | succ j hj hj' => + dsimp [s] + rw [transfiniteIterate_succ _ _ _ hj, φ_eq _ hj'] + refine hasCardinalLT_iUnion _ (hY _ _) + (fun ⟨C, hC⟩ ↦ hasCardinalLT_union hκ₂.aleph0_le ?_ + (hasCardinalLT_of_finite _ _ hκ₂.aleph0_le)) + refine (C.prop.of_le h₀.le).of_injective (fun ⟨c, hc⟩ ↦ ⟨⟨c, ?_⟩, ?_⟩) + (fun c₁ c₂ hc ↦ ?_) + · simp only [Set.mem_image, Subtype.exists, exists_and_right, exists_eq_right] at hc + exact hc.choose + · simp only [Set.mem_image, Subtype.exists, exists_and_right, exists_eq_right] at hc + exact hc.choose_spec + · simpa only [Subtype.ext_iff] using hc + | isSuccLimit j hj hj' => + dsimp [s] + rw [transfiniteIterate_limit _ _ _ hj, Set.iSup_eq_iUnion] + refine hasCardinalLT_iUnion _ + (HasCardinalLT.of_injective ?_ _ Subtype.val_injective) (fun ⟨k, hk⟩ ↦ hj' _ hk) + simpa [hasCardinalLT_iff_cardinal_mk_lt] + refine ⟨⋃ j, s j, ?_, ?_, ?_⟩ + · exact subset_trans (by simp [s]) (Set.subset_iUnion _ ⊥) + · suffices ∀ ⦃K : Type w⦄ (j : κ₁.ord.ToType) (f : K → s j) (hK : HasCardinalLT K κ₁), + ∃ (x : s (Order.succ j)), ∀ (k : K), (f k).val ≤ x.val by + refine isCardinalFiltered_preorder _ _ (fun K f hK ↦ ?_) + rw [← hasCardinalLT_iff_cardinal_mk_lt] at hK + have (k : K) : ∃ (j : κ₁.ord.ToType), (f k).val ∈ s j := by + simpa only [Set.mem_iUnion] using (f k).prop + choose a ha using this + obtain ⟨⟨z, hz⟩, hz'⟩ := this (IsCardinalFiltered.max a hK) (fun k ↦ + ⟨(f k).val, hs (leOfHom (IsCardinalFiltered.toMax a hK k)) (ha k)⟩) hK + exact ⟨⟨z, Set.subset_iUnion _ _ hz⟩, hz'⟩ + intro K j f hK + obtain ⟨⟨x, hx⟩, hx'⟩ := hφ₀ _ (hs' _) f hK + refine ⟨⟨x, ?_⟩, hx'⟩ + dsimp [s] + rwa [transfiniteIterate_succ _ _ _ (not_isMax j), φ_eq _ (hs' _)] + · exact hasCardinalLT_iUnion _ (by simpa [hasCardinalLT_iff_cardinal_mk_lt]) hs' namespace SharplyLT From 211cae6c23fe2f459655d9fcc2dd0f11532b4bdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Mon, 25 May 2026 16:48:16 +0200 Subject: [PATCH 210/309] wip --- Mathlib/CategoryTheory/Presentable/SharplyLT.lean | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT.lean index faaa7cb8705dbc..318132c0f710d3 100644 --- a/Mathlib/CategoryTheory/Presentable/SharplyLT.lean +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT.lean @@ -64,7 +64,7 @@ lemma exists_cofinal_of_isCardinalAccessibleCategory_cardinalFilteredPoset open CardinalFilteredPoset Classical in lemma exists_isCardinalFiltered_set_of_exists_cofinal (h₀ : κ₁ < κ₂) - (h : ∀ (X : Type w) (hX : HasCardinalLT X κ₂), + (h : ∀ (X : Type w) (_ : HasCardinalLT X κ₂), ∃ (A : Set (SetCardinalLT κ₁ X)), HasCardinalLT A κ₂ ∧ IsCofinal A) {X : Type w} [PartialOrder X] [IsCardinalFiltered X κ₁] (A : Set X) (hA : HasCardinalLT A κ₂) : @@ -84,7 +84,12 @@ lemma exists_isCardinalFiltered_set_of_exists_cofinal (h₀ : κ₁ < κ₂) ⋃ (C : Y B hB), Subtype.val '' C.val.val ∪ {m B hB _ C.prop} have hφ₀ (B : Set X) (hB : HasCardinalLT B κ₂) {T : Type w} (f : T → B) (hT : HasCardinalLT T κ₁) : - ∃ (m : φ₀ B hB), ∀ (t : T), f t ≤ m.val := sorry + ∃ (m : φ₀ B hB), ∀ (t : T), f t ≤ m.val := by + let C₀ : SetCardinalLT κ₁ B := + ⟨Set.range f, hT.of_surjective _ Set.rangeFactorization_surjective⟩ + obtain ⟨C, hC, hC'⟩ := hY' B hB C₀ + exact ⟨⟨m B hB C hC, Set.subset_iUnion _ ⟨C, hC⟩ (Or.inr (by simp))⟩, + fun t ↦ hm B hB C hC (f t) (hC' (by simp [C₀]))⟩ let φ (B : Set X) : Set X := if hB : HasCardinalLT B κ₂ then φ₀ B hB else B have φ_eq (B : Set X) (hB : HasCardinalLT B κ₂) : φ B = φ₀ B hB := dif_pos hB From b5cfa6cd73424727863ff8406e57846c5be34f56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Mon, 25 May 2026 17:21:20 +0200 Subject: [PATCH 211/309] wip --- Mathlib/CategoryTheory/Presentable/SharplyLT.lean | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT.lean index 318132c0f710d3..d729ac7afa0477 100644 --- a/Mathlib/CategoryTheory/Presentable/SharplyLT.lean +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT.lean @@ -32,6 +32,10 @@ structure SharplyLT : Prop where isCardinalAccessible_cardinalDirectedPoset : IsCardinalAccessibleCategory (CardinalFilteredPoset κ₁) κ₂ +namespace SharplyLT + +lemma le (h : SharplyLT κ₁ κ₂) : κ₁ ≤ κ₂ := h.lt.le + open CardinalFilteredPoset in lemma exists_cofinal_of_isCardinalAccessibleCategory_cardinalFilteredPoset (h : κ₁ ≤ κ₂) [IsCardinalAccessibleCategory (CardinalFilteredPoset κ₁) κ₂] @@ -149,10 +153,6 @@ lemma exists_isCardinalFiltered_set_of_exists_cofinal (h₀ : κ₁ < κ₂) rwa [transfiniteIterate_succ _ _ _ (not_isMax j), φ_eq _ (hs' _)] · exact hasCardinalLT_iUnion _ (by simpa [hasCardinalLT_iff_cardinal_mk_lt]) hs' -namespace SharplyLT - -lemma le (h : SharplyLT κ₁ κ₂) : κ₁ ≤ κ₂ := h.lt.le - section /-- Whan `k₁` is sharply smaller than `κ₂`, and `C` is a `κ₁`-accessible category, this From 5ed6624fc632f5fe199e801e554951075fd28404 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Mon, 25 May 2026 18:46:41 +0200 Subject: [PATCH 212/309] wip --- .../CategoryTheory/Presentable/SharplyLT.lean | 133 ++++++++++++------ 1 file changed, 92 insertions(+), 41 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT.lean index d729ac7afa0477..f5fd0a60417add 100644 --- a/Mathlib/CategoryTheory/Presentable/SharplyLT.lean +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT.lean @@ -155,112 +155,119 @@ lemma exists_isCardinalFiltered_set_of_exists_cofinal (h₀ : κ₁ < κ₂) section -/-- Whan `k₁` is sharply smaller than `κ₂`, and `C` is a `κ₁`-accessible category, this -is a property of objects which allows to show that `C` is a `κ₂`-accessible category. -This property is defined as the closure of `κ₁`-presentable objects under -colimits of shape `J` for categories `J` such that `Arrow J` is of cardinality `< κ₂`. -/ -abbrev generator (_ : SharplyLT κ₁ κ₂) (C : Type u) [Category.{v} C] : +variable (hκ : κ₁ < κ₂) + (hκ' : ∀ {X : Type w} [PartialOrder X] [IsCardinalFiltered X κ₁] + (A : Set X) (_ : HasCardinalLT A κ₂), + ∃ (B : Set X), A ⊆ B ∧ IsCardinalFiltered B κ₁ ∧ HasCardinalLT B κ₂) + +namespace isCardinalAccessible + +variable (κ₁ κ₂) in +abbrev generator (C : Type u) [Category.{v} C] : ObjectProperty C := (isCardinalPresentable C κ₁).colimitsCardinalClosure κ₂ -variable (h : SharplyLT κ₁ κ₂) (C : Type u) [Category.{v} C] +variable (C : Type u) [Category.{v} C] +include hκ in lemma generator_le_isCardinalPresentable [LocallySmall.{w} C] : - h.generator C ≤ isCardinalPresentable C κ₂ := + generator κ₁ κ₂ C ≤ isCardinalPresentable C κ₂ := ObjectProperty.colimitsCardinalClosure_le _ _ (fun _ _ hJ ↦ isClosedUnderColimitsOfShape_isCardinalPresentable C hJ) - (isCardinalPresentable_monotone _ h.le) + (isCardinalPresentable_monotone _ hκ.le) variable [IsCardinalAccessibleCategory C κ₁] -namespace isCardinalFilteredGenerator - -def prop (_ : SharplyLT κ₁ κ₂) (J : Type w) [PartialOrder J] (A : Set J) : Prop := +def prop (_ : κ₁ < κ₂) (J : Type w) [PartialOrder J] (A : Set J) : Prop := IsCardinalFiltered (Subtype A) κ₁ ∧ HasCardinalLT (Subtype A) κ₂ -variable {h} {C} {X : C} {J : Type w} [PartialOrder J] +variable {C} {X : C} {J : Type w} [PartialOrder J] (p : (isCardinalPresentable C κ₁).ColimitOfShape J X) -instance (A : Subtype (prop h J)) : +instance (A : Subtype (prop hκ J)) : HasColimit ((Subtype.mono_coe A.val).functor ⋙ p.diag) := by have := A.prop.1 infer_instance -noncomputable abbrev colimit (A : Subtype (prop h J)) : C := +variable {hκ} +noncomputable abbrev colimit (A : Subtype (prop hκ J)) : C := Limits.colimit ((Subtype.mono_coe A.val).functor ⋙ p.diag) -noncomputable abbrev colimit.ι (A : Subtype (prop h J)) (a : J) (ha : a ∈ A.val) : +noncomputable abbrev colimit.ι (A : Subtype (prop hκ J)) (a : J) (ha : a ∈ A.val) : p.diag.obj a ⟶ colimit p A := Limits.colimit.ι ((Subtype.mono_coe A.val).functor ⋙ p.diag) ⟨a, ha⟩ +omit [Fact κ₂.IsRegular] in @[reassoc (attr := simp)] -lemma colimit.w (A : Subtype (prop h J)) {a b : J} (hab : a ≤ b) (ha : a ∈ A.val) +lemma colimit.w (A : Subtype (prop hκ J)) {a b : J} (hab : a ≤ b) (ha : a ∈ A.val) (hb : b ∈ A.val) : p.diag.map (homOfLE hab) ≫ colimit.ι p A b hb = colimit.ι p A a ha := Limits.colimit.w ((Subtype.mono_coe A.val).functor ⋙ p.diag) (j := ⟨a, ha⟩) (j' := ⟨b, hb⟩) (homOfLE hab) -noncomputable def colimit.map {A₁ A₂ : Subtype (prop h J)} (hA : A₁ ≤ A₂) : +noncomputable def colimit.map {A₁ A₂ : Subtype (prop hκ J)} (hA : A₁ ≤ A₂) : colimit p A₁ ⟶ colimit p A₂ := colimit.desc _ (Cocone.mk _ { app j := colimit.ι p A₂ j.val (hA j.prop) naturality j₁ j₂ f := by simpa using colimit.w p A₂ (leOfHom f) (hA j₁.prop) (hA j₂.prop) }) +omit [Fact κ₂.IsRegular] in @[reassoc (attr := simp)] -lemma colimit.ι_map {A₁ A₂ : Subtype (prop h J)} (hA : A₁ ≤ A₂) (j : J) (hj : j ∈ A₁.val) : +lemma colimit.ι_map {A₁ A₂ : Subtype (prop hκ J)} (hA : A₁ ≤ A₂) (j : J) (hj : j ∈ A₁.val) : colimit.ι p A₁ j hj ≫ colimit.map p hA = colimit.ι p A₂ j (hA hj) := colimit.ι_desc .. +omit [Fact κ₂.IsRegular] in @[ext high] -lemma colimit.hom_ext {A : Subtype (prop h J)} {T : C} {φ₁ φ₂ : colimit p A ⟶ T} +lemma colimit.hom_ext {A : Subtype (prop hκ J)} {T : C} {φ₁ φ₂ : colimit p A ⟶ T} (h : ∀ (j : J) (hj : j ∈ A.val), colimit.ι p A j hj ≫ φ₁ = colimit.ι p A j hj ≫ φ₂) : φ₁ = φ₂ := by ext apply h -noncomputable def colimit.π (A : Subtype (prop h J)) : colimit p A ⟶ X := +noncomputable def colimit.π (A : Subtype (prop hκ J)) : colimit p A ⟶ X := colimit.desc _ (Cocone.mk _ { app a := by exact p.ι.app a naturality _ _ _ := by simpa using p.ι.naturality _ }) +omit [Fact κ₂.IsRegular] in @[reassoc (attr := simp)] -lemma colimit.ι_π (A : Subtype (prop h J)) (a : J) (ha : a ∈ A.val) : +lemma colimit.ι_π (A : Subtype (prop hκ J)) (a : J) (ha : a ∈ A.val) : colimit.ι p A a ha ≫ colimit.π p A = p.ι.app a := colimit.ι_desc .. +omit [Fact κ₂.IsRegular] in @[reassoc (attr := simp)] -lemma colimit.map_π {A₁ A₂ : Subtype (prop h J)} (hA : A₁ ≤ A₂) : +lemma colimit.map_π {A₁ A₂ : Subtype (prop hκ J)} (hA : A₁ ≤ A₂) : colimit.map p hA ≫ colimit.π p A₂ = colimit.π p A₁ := by ext simp -variable (h) in +variable (hκ) + @[simps] -noncomputable def functor : Subtype (prop h J) ⥤ C where +noncomputable def functor : Subtype (prop hκ J) ⥤ C where obj A := colimit p A map f := colimit.map p f.le map_id _ := by ext; simp map_comp f g := by ext; simp -variable (h) in @[simps] -noncomputable def cocone : Cocone (functor h p) where +noncomputable def cocone : Cocone (functor hκ p) where pt := X ι.app j := colimit.π p j -variable (h) in -def isColimit [IsCardinalFiltered J κ₁] : IsColimit (cocone h p) := sorry +def isColimit [IsCardinalFiltered J κ₁] : IsColimit (cocone hκ p) := sorry -instance [IsCardinalFiltered J κ₁] : IsCardinalFiltered (Subtype (prop h J)) κ₂ := by +instance [IsCardinalFiltered J κ₁] : IsCardinalFiltered (Subtype (prop hκ J)) κ₂ := by sorry -end isCardinalFilteredGenerator - -open isCardinalFilteredGenerator in +variable (C) in +include hκ hκ' in lemma isCardinalFilteredGenerator : - (h.generator C).IsCardinalFilteredGenerator κ₂ where - le_isCardinalPresentable := h.generator_le_isCardinalPresentable C + (generator κ₁ κ₂ C).IsCardinalFilteredGenerator κ₂ where + le_isCardinalPresentable := generator_le_isCardinalPresentable hκ C exists_colimitsOfShape X := by have hκ₁ := isCardinalFilteredGenerator_isCardinalPresentable C κ₁ obtain ⟨J, _, _, ⟨p⟩⟩ : @@ -269,24 +276,68 @@ lemma isCardinalFilteredGenerator : obtain ⟨J₀, _, _, ⟨p₀⟩⟩ := hκ₁.exists_colimitsOfShape X obtain ⟨J, _, _, F, _⟩ := IsCardinalFiltered.exists_cardinal_directed J₀ κ₁ exact ⟨_, _, inferInstance, ⟨p₀.reindex F⟩⟩ - refine ⟨Subtype (prop h J), inferInstance, inferInstance, - ⟨{ diag := _, ι := _, isColimit := isColimit h p, prop_diag_obj A := ?_ }⟩⟩ - have : (h.generator C).IsClosedUnderColimitsOfShape (Subtype A.val) := by + refine ⟨Subtype (prop hκ J), inferInstance, inferInstance, + ⟨{ diag := _, ι := _, isColimit := isColimit hκ p, prop_diag_obj A := ?_ }⟩⟩ + have : (generator κ₁ κ₂ C).IsClosedUnderColimitsOfShape (Subtype A.val) := by apply ObjectProperty.isClosedUnderColimitsOfShape_colimitsCardinalClosure have := A.prop.2 + have := @hκ' sorry exact ObjectProperty.prop_colimit _ _ (fun ⟨a, ha⟩ ↦ ObjectProperty.le_colimitsCardinalClosure _ _ _ (p.prop_diag_obj a)) + +end isCardinalAccessible + +include hκ hκ' in +open isCardinalAccessible in +lemma isCardinalAccessible' + (C : Type u) [Category.{v} C] [IsCardinalAccessibleCategory C κ₁] : + IsCardinalAccessibleCategory C κ₂ where + toHasCardinalFilteredColimits := .of_le C hκ.le + exists_generator := ⟨_, inferInstance, isCardinalFilteredGenerator hκ hκ' C⟩ + end +lemma tfae (h : κ₁ < κ₂) : + List.TFAE [SharplyLT κ₁ κ₂, + IsCardinalAccessibleCategory (CardinalFilteredPoset κ₁) κ₂, + ∀ (C : Type (w + 1)) [Category.{w} C] [IsCardinalAccessibleCategory C κ₁], + IsCardinalAccessibleCategory C κ₂, + ∀ (X : Type w) (_ : HasCardinalLT X κ₂), + ∃ (A : Set (CardinalFilteredPoset.SetCardinalLT κ₁ X)), HasCardinalLT A κ₂ ∧ IsCofinal A, + ∀ ⦃X : Type w⦄ [PartialOrder X] [IsCardinalFiltered X κ₁] (A : Set X) + (_ : HasCardinalLT A κ₂), + ∃ (B : Set X), A ⊆ B ∧ IsCardinalFiltered B κ₁ ∧ HasCardinalLT B κ₂] := by + tfae_have 1 ↔ 2 := + ⟨fun h ↦ h.isCardinalAccessible_cardinalDirectedPoset, fun _ ↦ ⟨h, inferInstance⟩⟩ + tfae_have 3 → 2 := fun h' ↦ h' _ + tfae_have 2 → 4 := fun _ X hX ↦ + exists_cofinal_of_isCardinalAccessibleCategory_cardinalFilteredPoset h.le hX + tfae_have 4 → 5 := fun h' X _ _ A hA ↦ + exists_isCardinalFiltered_set_of_exists_cofinal h h' _ hA + tfae_have 5 → 3 := fun h' C _ _ ↦ isCardinalAccessible' h (fun A hA ↦ h' A hA) C + tfae_finish + +lemma exists_cofinal (h : SharplyLT κ₁ κ₂) + {X : Type w} (hX : HasCardinalLT X κ₂) : + ∃ (A : Set (CardinalFilteredPoset.SetCardinalLT κ₁ X)), + HasCardinalLT A κ₂ ∧ IsCofinal A := by + have := (tfae h.lt).out 1 3 + exact this.1 h.isCardinalAccessible_cardinalDirectedPoset X hX + +lemma exists_isCardinalFiltered_set (h : SharplyLT κ₁ κ₂) + {X : Type w} [PartialOrder X] [IsCardinalFiltered X κ₁] + (A : Set X) (hA : HasCardinalLT A κ₂) : + ∃ (B : Set X), A ⊆ B ∧ IsCardinalFiltered B κ₁ ∧ HasCardinalLT B κ₂ := by + have := (tfae h.lt).out 1 4 + exact this.1 h.isCardinalAccessible_cardinalDirectedPoset A hA + lemma isCardinalAccessible (h : SharplyLT κ₁ κ₂) (C : Type u) [Category.{v} C] [IsCardinalAccessibleCategory C κ₁] : - IsCardinalAccessibleCategory C κ₂ where - toHasCardinalFilteredColimits := .of_le C h.le - exists_generator := - ⟨_, inferInstance, h.isCardinalFilteredGenerator C⟩ + IsCardinalAccessibleCategory C κ₂ := + isCardinalAccessible' h.lt h.exists_isCardinalFiltered_set C lemma trans (h₁₂ : SharplyLT κ₁ κ₂) {κ₃ : Cardinal.{w}} [Fact κ₃.IsRegular] (h₂₃ : SharplyLT κ₂ κ₃) : From 72ad7a209427f6410c26a6d5047b3179f8ca9485 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Mon, 25 May 2026 20:33:22 +0200 Subject: [PATCH 213/309] wip --- .../CategoryTheory/Comma/CardinalArrow.lean | 9 ++++++ .../CategoryTheory/Presentable/SharplyLT.lean | 29 ++++++++++++------- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/Mathlib/CategoryTheory/Comma/CardinalArrow.lean b/Mathlib/CategoryTheory/Comma/CardinalArrow.lean index e3f7f3cfac935e..18d8f6934c78cf 100644 --- a/Mathlib/CategoryTheory/Comma/CardinalArrow.lean +++ b/Mathlib/CategoryTheory/Comma/CardinalArrow.lean @@ -112,4 +112,13 @@ lemma hasCardinalLT_of_hasCardinalLT_arrow HasCardinalLT C κ := h.of_injective (fun X ↦ Arrow.mk (𝟙 X)) (fun _ _ h ↦ congr_arg Comma.left h) +lemma hasCardinalLT_arrow_iff_of_isThin (C : Type u) [Category.{v} C] + [Quiver.IsThin C] (κ : Cardinal.{w}) (hκ : Cardinal.aleph0 ≤ κ) : + HasCardinalLT (Arrow C) κ ↔ HasCardinalLT C κ := + ⟨hasCardinalLT_of_hasCardinalLT_arrow, fun h ↦ + (hasCardinalLT_prod hκ h h).of_injective (fun f ↦ (f.left, f.right)) + (fun f g h ↦ + Arrow.ext (congr_arg _root_.Prod.fst h) (congr_arg _root_.Prod.snd h) + (by subsingleton))⟩ + end CategoryTheory diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT.lean index f5fd0a60417add..c0c1d29d0b2de1 100644 --- a/Mathlib/CategoryTheory/Presentable/SharplyLT.lean +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT.lean @@ -179,14 +179,14 @@ lemma generator_le_isCardinalPresentable [LocallySmall.{w} C] : variable [IsCardinalAccessibleCategory C κ₁] def prop (_ : κ₁ < κ₂) (J : Type w) [PartialOrder J] (A : Set J) : Prop := - IsCardinalFiltered (Subtype A) κ₁ ∧ HasCardinalLT (Subtype A) κ₂ + IsCardinalFiltered A κ₁ ∧ HasCardinalLT A κ₂ variable {C} {X : C} {J : Type w} [PartialOrder J] (p : (isCardinalPresentable C κ₁).ColimitOfShape J X) instance (A : Subtype (prop hκ J)) : HasColimit ((Subtype.mono_coe A.val).functor ⋙ p.diag) := by - have := A.prop.1 + have : IsCardinalFiltered (Subtype A.val) κ₁ := A.prop.1 infer_instance variable {hκ} @@ -219,7 +219,7 @@ lemma colimit.ι_map {A₁ A₂ : Subtype (prop hκ J)} (hA : A₁ ≤ A₂) (j colimit.ι_desc .. omit [Fact κ₂.IsRegular] in -@[ext high] +@[ext] lemma colimit.hom_ext {A : Subtype (prop hκ J)} {T : C} {φ₁ φ₂ : colimit p A ⟶ T} (h : ∀ (j : J) (hj : j ∈ A.val), colimit.ι p A j hj ≫ φ₁ = colimit.ι p A j hj ≫ φ₂) : φ₁ = φ₂ := by @@ -258,10 +258,19 @@ noncomputable def cocone : Cocone (functor hκ p) where pt := X ι.app j := colimit.π p j -def isColimit [IsCardinalFiltered J κ₁] : IsColimit (cocone hκ p) := sorry +def isColimit [IsCardinalFiltered J κ₁] : IsColimit (cocone hκ p) where + desc := sorry + fac := sorry + uniq := sorry -instance [IsCardinalFiltered J κ₁] : IsCardinalFiltered (Subtype (prop hκ J)) κ₂ := by - sorry +include hκ' in +lemma isCardinalFiltered_subtype_prop [IsCardinalFiltered J κ₁] : + IsCardinalFiltered (Subtype (prop hκ J)) κ₂ := + isCardinalFiltered_preorder _ _ (fun K f hK ↦ by + rw [← hasCardinalLT_iff_cardinal_mk_lt] at hK + obtain ⟨B, hB₁, hB₂, hB₃⟩ := hκ' (⋃ (k : K), (f k).val) + (hasCardinalLT_iUnion _ hK (fun k ↦ (f k).prop.2)) + exact ⟨⟨B, hB₂, hB₃⟩, fun k ↦ (Set.subset_iUnion _ k).trans hB₁⟩) variable (C) in include hκ hκ' in @@ -276,18 +285,16 @@ lemma isCardinalFilteredGenerator : obtain ⟨J₀, _, _, ⟨p₀⟩⟩ := hκ₁.exists_colimitsOfShape X obtain ⟨J, _, _, F, _⟩ := IsCardinalFiltered.exists_cardinal_directed J₀ κ₁ exact ⟨_, _, inferInstance, ⟨p₀.reindex F⟩⟩ - refine ⟨Subtype (prop hκ J), inferInstance, inferInstance, + refine ⟨Subtype (prop hκ J), inferInstance, isCardinalFiltered_subtype_prop _ hκ', ⟨{ diag := _, ι := _, isColimit := isColimit hκ p, prop_diag_obj A := ?_ }⟩⟩ have : (generator κ₁ κ₂ C).IsClosedUnderColimitsOfShape (Subtype A.val) := by apply ObjectProperty.isClosedUnderColimitsOfShape_colimitsCardinalClosure - have := A.prop.2 - have := @hκ' - sorry + rw [hasCardinalLT_arrow_iff_of_isThin _ _ (IsRegular.aleph0_le Fact.out)] + exact A.prop.2 exact ObjectProperty.prop_colimit _ _ (fun ⟨a, ha⟩ ↦ ObjectProperty.le_colimitsCardinalClosure _ _ _ (p.prop_diag_obj a)) - end isCardinalAccessible include hκ hκ' in From 9803a55b94ad16dd9508ab5edff7c95b91668035 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Mon, 25 May 2026 22:05:14 +0200 Subject: [PATCH 214/309] wip --- Mathlib/CategoryTheory/Presentable/SharplyLT.lean | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT.lean index c0c1d29d0b2de1..7dc004b623b40c 100644 --- a/Mathlib/CategoryTheory/Presentable/SharplyLT.lean +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT.lean @@ -121,12 +121,10 @@ lemma exists_isCardinalFiltered_set_of_exists_cofinal (h₀ : κ₁ < κ₂) refine hasCardinalLT_iUnion _ (hY _ _) (fun ⟨C, hC⟩ ↦ hasCardinalLT_union hκ₂.aleph0_le ?_ (hasCardinalLT_of_finite _ _ hκ₂.aleph0_le)) - refine (C.prop.of_le h₀.le).of_injective (fun ⟨c, hc⟩ ↦ ⟨⟨c, ?_⟩, ?_⟩) + refine (C.prop.of_le h₀.le).of_injective (fun ⟨c, hc⟩ ↦ ?_) (fun c₁ c₂ hc ↦ ?_) · simp only [Set.mem_image, Subtype.exists, exists_and_right, exists_eq_right] at hc - exact hc.choose - · simp only [Set.mem_image, Subtype.exists, exists_and_right, exists_eq_right] at hc - exact hc.choose_spec + exact ⟨⟨c, hc.choose⟩, hc.choose_spec⟩ · simpa only [Subtype.ext_iff] using hc | isSuccLimit j hj hj' => dsimp [s] From 49218cf53b0eadc4a173ccc3a02cc956aa512e78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 26 May 2026 09:32:43 +0200 Subject: [PATCH 215/309] wip --- .../CategoryTheory/Presentable/SharplyLT.lean | 51 +++++++++++++++++-- 1 file changed, 47 insertions(+), 4 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT.lean index 7dc004b623b40c..5937526b0cee7e 100644 --- a/Mathlib/CategoryTheory/Presentable/SharplyLT.lean +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT.lean @@ -22,6 +22,9 @@ universe w v u open CategoryTheory Limits +instance {J : Type*} [PartialOrder J] (j : J) : + HasTerminal ({j} : Set J) := sorry + namespace Cardinal variable {κ₁ κ₂ : Cardinal.{w}} [Fact κ₁.IsRegular] [Fact κ₂.IsRegular] @@ -187,6 +190,10 @@ instance (A : Subtype (prop hκ J)) : have : IsCardinalFiltered (Subtype A.val) κ₁ := A.prop.1 infer_instance +abbrev singleton (j : J) : Subtype (prop hκ J) := + ⟨{j}, isCardinalFiltered_of_hasTerminal _ _, + hasCardinalLT_of_finite _ _ (IsRegular.aleph0_le Fact.out)⟩ + variable {hκ} noncomputable abbrev colimit (A : Subtype (prop hκ J)) : C := Limits.colimit ((Subtype.mono_coe A.val).functor ⋙ p.diag) @@ -256,10 +263,46 @@ noncomputable def cocone : Cocone (functor hκ p) where pt := X ι.app j := colimit.π p j -def isColimit [IsCardinalFiltered J κ₁] : IsColimit (cocone hκ p) where - desc := sorry - fac := sorry - uniq := sorry +section + +variable [IsCardinalFiltered J κ₁] + +namespace isColimit + +variable (s : Cocone (functor hκ p)) + +@[simps] +noncomputable def coconeDesc : Cocone p.diag where + pt := s.pt + ι.app j := colimit.ι _ _ _ (by simp) ≫ s.ι.app (singleton hκ j) + ι.naturality := sorry + +variable {hκ p} + +noncomputable def desc : X ⟶ s.pt := p.isColimit.desc (coconeDesc hκ p s) + +omit [IsCardinalFiltered J κ₁] in +@[reassoc (attr := simp)] +lemma fac (j : J) : + p.ι.app j ≫ desc s = colimit.ι _ _ _ (by simp) ≫ s.ι.app (singleton hκ j) := + p.isColimit.fac (coconeDesc hκ p s) j + +end isColimit + +open isColimit in +noncomputable def isColimit : IsColimit (cocone hκ p) where + desc s := desc s + fac s A := by + dsimp + ext j hj + have := p.isColimit.fac (coconeDesc hκ p s) j + dsimp at this + sorry + uniq s m hm := + p.isColimit.hom_ext (fun j ↦ by + sorry) + +end include hκ' in lemma isCardinalFiltered_subtype_prop [IsCardinalFiltered J κ₁] : From f2abedbbca4b644d00f4c8dbda5eaecf3dfd9661 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 26 May 2026 11:57:23 +0200 Subject: [PATCH 216/309] wip --- .../CategoryTheory/Presentable/SharplyLT.lean | 37 +++++++++++++------ 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT.lean index 5937526b0cee7e..9ec56ab8888c74 100644 --- a/Mathlib/CategoryTheory/Presentable/SharplyLT.lean +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT.lean @@ -22,8 +22,19 @@ universe w v u open CategoryTheory Limits -instance {J : Type*} [PartialOrder J] (j : J) : - HasTerminal ({j} : Set J) := sorry +section + +-- this should be generalized to `Quiver.IsThin` +def Preorder.isTerminalOfUnique (J : Type*) [Preorder J] [Unique J] : + IsTerminal (default : J) := + IsTerminal.ofUniqueHom (fun k ↦ homOfLE (by rw [Subsingleton.elim k default])) + (fun _ _ ↦ by subsingleton) + +instance (J : Type*) [Preorder J] [Unique J] : + HasTerminal J := + (Preorder.isTerminalOfUnique J).hasTerminal + +end namespace Cardinal @@ -284,23 +295,27 @@ noncomputable def desc : X ⟶ s.pt := p.isColimit.desc (coconeDesc hκ p s) omit [IsCardinalFiltered J κ₁] in @[reassoc (attr := simp)] lemma fac (j : J) : - p.ι.app j ≫ desc s = colimit.ι _ _ _ (by simp) ≫ s.ι.app (singleton hκ j) := + dsimp% p.ι.app j ≫ desc s = colimit.ι _ _ _ (by simp) ≫ s.ι.app (singleton hκ j) := p.isColimit.fac (coconeDesc hκ p s) j +omit [IsCardinalFiltered J κ₁] in +@[reassoc] +lemma fac' (A : Subtype (prop hκ J)) : + colimit.π p A ≫ desc s = s.ι.app A := by + ext j hj + let φ : singleton hκ j ⟶ A := homOfLE (by + rw [Subtype.mk_le_mk] + simpa) + simp [colimit.ι_π_assoc, fac, ← s.w φ] + end isColimit open isColimit in noncomputable def isColimit : IsColimit (cocone hκ p) where desc s := desc s - fac s A := by - dsimp - ext j hj - have := p.isColimit.fac (coconeDesc hκ p s) j - dsimp at this - sorry + fac s A := fac' s A uniq s m hm := - p.isColimit.hom_ext (fun j ↦ by - sorry) + p.isColimit.hom_ext (fun j ↦ by simp [fac s j, ← hm]) end From c611e903cb9cdfe60932e13af15ecb7534cd66ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 26 May 2026 12:16:38 +0200 Subject: [PATCH 217/309] wip --- .../CategoryTheory/Presentable/SharplyLT.lean | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT.lean index 9ec56ab8888c74..3aa158bf359d6a 100644 --- a/Mathlib/CategoryTheory/Presentable/SharplyLT.lean +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT.lean @@ -205,6 +205,24 @@ abbrev singleton (j : J) : Subtype (prop hκ J) := ⟨{j}, isCardinalFiltered_of_hasTerminal _ _, hasCardinalLT_of_finite _ _ (IsRegular.aleph0_le Fact.out)⟩ +abbrev pair {j j' : J} (h : j ≤ j') : Subtype (prop hκ J) := + ⟨{j, j'}, by + have : OrderTop ({j, j'} : Set J) := + { top := ⟨j', by simp⟩ + le_top := by aesop } + apply isCardinalFiltered_of_hasTerminal, + hasCardinalLT_of_finite _ _ (IsRegular.aleph0_le Fact.out)⟩ + +lemma le_pair {j j' : J} (h : j ≤ j') : + singleton hκ j ≤ pair hκ h := by + rw [Subtype.mk_le_mk] + simp + +lemma le_pair' {j j' : J} (h : j ≤ j') : + singleton hκ j' ≤ pair hκ h := by + rw [Subtype.mk_le_mk] + simp + variable {hκ} noncomputable abbrev colimit (A : Subtype (prop hκ J)) : C := Limits.colimit ((Subtype.mono_coe A.val).functor ⋙ p.diag) @@ -286,7 +304,10 @@ variable (s : Cocone (functor hκ p)) noncomputable def coconeDesc : Cocone p.diag where pt := s.pt ι.app j := colimit.ι _ _ _ (by simp) ≫ s.ι.app (singleton hκ j) - ι.naturality := sorry + ι.naturality j j' f := by + simpa [← s.w (homOfLE (le_pair hκ (leOfHom f))), + ← s.w (homOfLE (le_pair' hκ (leOfHom f)))] + using colimit.w_assoc .. variable {hκ p} From 8d5ed967f60d62478911583e02db3d9ada622d2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 26 May 2026 13:56:58 +0200 Subject: [PATCH 218/309] wip --- .../CategoryTheory/Presentable/SharplyLT.lean | 126 ++++++++---------- 1 file changed, 56 insertions(+), 70 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT.lean index 3aa158bf359d6a..ad5e3c4c9cbf3a 100644 --- a/Mathlib/CategoryTheory/Presentable/SharplyLT.lean +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT.lean @@ -22,20 +22,6 @@ universe w v u open CategoryTheory Limits -section - --- this should be generalized to `Quiver.IsThin` -def Preorder.isTerminalOfUnique (J : Type*) [Preorder J] [Unique J] : - IsTerminal (default : J) := - IsTerminal.ofUniqueHom (fun k ↦ homOfLE (by rw [Subsingleton.elim k default])) - (fun _ _ ↦ by subsingleton) - -instance (J : Type*) [Preorder J] [Unique J] : - HasTerminal J := - (Preorder.isTerminalOfUnique J).hasTerminal - -end - namespace Cardinal variable {κ₁ κ₂ : Cardinal.{w}} [Fact κ₁.IsRegular] [Fact κ₂.IsRegular] @@ -174,13 +160,15 @@ variable (hκ : κ₁ < κ₂) namespace isCardinalAccessible -variable (κ₁ κ₂) in +variable (κ₁ κ₂) + abbrev generator (C : Type u) [Category.{v} C] : ObjectProperty C := (isCardinalPresentable C κ₁).colimitsCardinalClosure κ₂ variable (C : Type u) [Category.{v} C] +variable {κ₁ κ₂} in include hκ in lemma generator_le_isCardinalPresentable [LocallySmall.{w} C] : generator κ₁ κ₂ C ≤ isCardinalPresentable C κ₂ := @@ -190,141 +178,138 @@ lemma generator_le_isCardinalPresentable [LocallySmall.{w} C] : variable [IsCardinalAccessibleCategory C κ₁] -def prop (_ : κ₁ < κ₂) (J : Type w) [PartialOrder J] (A : Set J) : Prop := +def prop (J : Type w) [PartialOrder J] (A : Set J) : Prop := IsCardinalFiltered A κ₁ ∧ HasCardinalLT A κ₂ variable {C} {X : C} {J : Type w} [PartialOrder J] (p : (isCardinalPresentable C κ₁).ColimitOfShape J X) -instance (A : Subtype (prop hκ J)) : +instance (A : Subtype (prop κ₁ κ₂ J)) : HasColimit ((Subtype.mono_coe A.val).functor ⋙ p.diag) := by have : IsCardinalFiltered (Subtype A.val) κ₁ := A.prop.1 infer_instance -abbrev singleton (j : J) : Subtype (prop hκ J) := - ⟨{j}, isCardinalFiltered_of_hasTerminal _ _, +abbrev singleton (j : J) : Subtype (prop κ₁ κ₂ J) := + ⟨{j}, by + letI : OrderTop ({j} : Set J) := + { top := ⟨j, by simp⟩ + le_top := by simp } + exact isCardinalFiltered_of_hasTerminal _ _, hasCardinalLT_of_finite _ _ (IsRegular.aleph0_le Fact.out)⟩ -abbrev pair {j j' : J} (h : j ≤ j') : Subtype (prop hκ J) := +abbrev pair {j j' : J} (h : j ≤ j') : Subtype (prop κ₁ κ₂ J) := ⟨{j, j'}, by - have : OrderTop ({j, j'} : Set J) := + letI : OrderTop ({j, j'} : Set J) := { top := ⟨j', by simp⟩ le_top := by aesop } apply isCardinalFiltered_of_hasTerminal, hasCardinalLT_of_finite _ _ (IsRegular.aleph0_le Fact.out)⟩ lemma le_pair {j j' : J} (h : j ≤ j') : - singleton hκ j ≤ pair hκ h := by + singleton κ₁ κ₂ j ≤ pair κ₁ κ₂ h := by rw [Subtype.mk_le_mk] simp lemma le_pair' {j j' : J} (h : j ≤ j') : - singleton hκ j' ≤ pair hκ h := by + singleton κ₁ κ₂ j' ≤ pair κ₁ κ₂ h := by rw [Subtype.mk_le_mk] simp -variable {hκ} -noncomputable abbrev colimit (A : Subtype (prop hκ J)) : C := +noncomputable abbrev colimit (A : Subtype (prop κ₁ κ₂ J)) : C := Limits.colimit ((Subtype.mono_coe A.val).functor ⋙ p.diag) -noncomputable abbrev colimit.ι (A : Subtype (prop hκ J)) (a : J) (ha : a ∈ A.val) : - p.diag.obj a ⟶ colimit p A := +noncomputable abbrev colimit.ι (A : Subtype (prop κ₁ κ₂ J)) (a : J) (ha : a ∈ A.val) : + p.diag.obj a ⟶ colimit κ₁ κ₂ p A := Limits.colimit.ι ((Subtype.mono_coe A.val).functor ⋙ p.diag) ⟨a, ha⟩ omit [Fact κ₂.IsRegular] in @[reassoc (attr := simp)] -lemma colimit.w (A : Subtype (prop hκ J)) {a b : J} (hab : a ≤ b) (ha : a ∈ A.val) +lemma colimit.w (A : Subtype (prop κ₁ κ₂ J)) {a b : J} (hab : a ≤ b) (ha : a ∈ A.val) (hb : b ∈ A.val) : - p.diag.map (homOfLE hab) ≫ colimit.ι p A b hb = colimit.ι p A a ha := + p.diag.map (homOfLE hab) ≫ colimit.ι κ₁ κ₂ p A b hb = colimit.ι κ₁ κ₂ p A a ha := Limits.colimit.w ((Subtype.mono_coe A.val).functor ⋙ p.diag) (j := ⟨a, ha⟩) (j' := ⟨b, hb⟩) (homOfLE hab) -noncomputable def colimit.map {A₁ A₂ : Subtype (prop hκ J)} (hA : A₁ ≤ A₂) : - colimit p A₁ ⟶ colimit p A₂ := +noncomputable def colimit.map {A₁ A₂ : Subtype (prop κ₁ κ₂ J)} (hA : A₁ ≤ A₂) : + colimit κ₁ κ₂ p A₁ ⟶ colimit κ₁ κ₂ p A₂ := colimit.desc _ (Cocone.mk _ - { app j := colimit.ι p A₂ j.val (hA j.prop) + { app j := colimit.ι κ₁ κ₂ p A₂ j.val (hA j.prop) naturality j₁ j₂ f := by - simpa using colimit.w p A₂ (leOfHom f) (hA j₁.prop) (hA j₂.prop) }) + simpa using colimit.w κ₁ κ₂ p A₂ (leOfHom f) (hA j₁.prop) (hA j₂.prop) }) omit [Fact κ₂.IsRegular] in @[reassoc (attr := simp)] -lemma colimit.ι_map {A₁ A₂ : Subtype (prop hκ J)} (hA : A₁ ≤ A₂) (j : J) (hj : j ∈ A₁.val) : - colimit.ι p A₁ j hj ≫ colimit.map p hA = colimit.ι p A₂ j (hA hj) := +lemma colimit.ι_map {A₁ A₂ : Subtype (prop κ₁ κ₂ J)} (hA : A₁ ≤ A₂) (j : J) (hj : j ∈ A₁.val) : + colimit.ι κ₁ κ₂ p A₁ j hj ≫ colimit.map κ₁ κ₂ p hA = colimit.ι κ₁ κ₂ p A₂ j (hA hj) := colimit.ι_desc .. omit [Fact κ₂.IsRegular] in @[ext] -lemma colimit.hom_ext {A : Subtype (prop hκ J)} {T : C} {φ₁ φ₂ : colimit p A ⟶ T} - (h : ∀ (j : J) (hj : j ∈ A.val), colimit.ι p A j hj ≫ φ₁ = colimit.ι p A j hj ≫ φ₂) : +lemma colimit.hom_ext {A : Subtype (prop κ₁ κ₂ J)} {T : C} {φ₁ φ₂ : colimit κ₁ κ₂ p A ⟶ T} + (h : ∀ (j : J) (hj : j ∈ A.val), colimit.ι κ₁ κ₂ p A j hj ≫ φ₁ = + colimit.ι κ₁ κ₂ p A j hj ≫ φ₂) : φ₁ = φ₂ := by ext apply h -noncomputable def colimit.π (A : Subtype (prop hκ J)) : colimit p A ⟶ X := +noncomputable def colimit.π (A : Subtype (prop κ₁ κ₂ J)) : colimit κ₁ κ₂ p A ⟶ X := colimit.desc _ (Cocone.mk _ { app a := by exact p.ι.app a naturality _ _ _ := by simpa using p.ι.naturality _ }) omit [Fact κ₂.IsRegular] in @[reassoc (attr := simp)] -lemma colimit.ι_π (A : Subtype (prop hκ J)) (a : J) (ha : a ∈ A.val) : - colimit.ι p A a ha ≫ colimit.π p A = p.ι.app a := +lemma colimit.ι_π (A : Subtype (prop κ₁ κ₂ J)) (a : J) (ha : a ∈ A.val) : + colimit.ι κ₁ κ₂ p A a ha ≫ colimit.π κ₁ κ₂ p A = p.ι.app a := colimit.ι_desc .. omit [Fact κ₂.IsRegular] in @[reassoc (attr := simp)] -lemma colimit.map_π {A₁ A₂ : Subtype (prop hκ J)} (hA : A₁ ≤ A₂) : - colimit.map p hA ≫ colimit.π p A₂ = colimit.π p A₁ := by +lemma colimit.map_π {A₁ A₂ : Subtype (prop κ₁ κ₂ J)} (hA : A₁ ≤ A₂) : + colimit.map κ₁ κ₂ p hA ≫ colimit.π κ₁ κ₂ p A₂ = colimit.π κ₁ κ₂ p A₁ := by ext simp -variable (hκ) - @[simps] -noncomputable def functor : Subtype (prop hκ J) ⥤ C where - obj A := colimit p A - map f := colimit.map p f.le +noncomputable def functor : Subtype (prop κ₁ κ₂ J) ⥤ C where + obj A := colimit κ₁ κ₂ p A + map f := colimit.map κ₁ κ₂ p f.le map_id _ := by ext; simp map_comp f g := by ext; simp @[simps] -noncomputable def cocone : Cocone (functor hκ p) where +noncomputable def cocone : Cocone (functor κ₁ κ₂ p) where pt := X - ι.app j := colimit.π p j + ι.app j := colimit.π κ₁ κ₂ p j section -variable [IsCardinalFiltered J κ₁] - namespace isColimit -variable (s : Cocone (functor hκ p)) +variable {κ₁ κ₂ p} (s : Cocone (functor κ₁ κ₂ p)) @[simps] noncomputable def coconeDesc : Cocone p.diag where pt := s.pt - ι.app j := colimit.ι _ _ _ (by simp) ≫ s.ι.app (singleton hκ j) + ι.app j := colimit.ι _ _ _ _ _ (by simp) ≫ s.ι.app (singleton κ₁ κ₂ j) ι.naturality j j' f := by - simpa [← s.w (homOfLE (le_pair hκ (leOfHom f))), - ← s.w (homOfLE (le_pair' hκ (leOfHom f)))] + simpa [← s.w (homOfLE (le_pair κ₁ κ₂ (leOfHom f))), + ← s.w (homOfLE (le_pair' κ₁ κ₂ (leOfHom f)))] using colimit.w_assoc .. -variable {hκ p} - -noncomputable def desc : X ⟶ s.pt := p.isColimit.desc (coconeDesc hκ p s) +noncomputable def desc : X ⟶ s.pt := p.isColimit.desc (coconeDesc s) -omit [IsCardinalFiltered J κ₁] in @[reassoc (attr := simp)] lemma fac (j : J) : - dsimp% p.ι.app j ≫ desc s = colimit.ι _ _ _ (by simp) ≫ s.ι.app (singleton hκ j) := - p.isColimit.fac (coconeDesc hκ p s) j + dsimp% p.ι.app j ≫ desc s = + colimit.ι _ _ _ _ _ (by simp) ≫ s.ι.app (singleton κ₁ κ₂ j) := + p.isColimit.fac (coconeDesc s) j -omit [IsCardinalFiltered J κ₁] in @[reassoc] -lemma fac' (A : Subtype (prop hκ J)) : - colimit.π p A ≫ desc s = s.ι.app A := by +lemma fac' (A : Subtype (prop κ₁ κ₂ J)) : + colimit.π κ₁ κ₂ p A ≫ desc s = s.ι.app A := by ext j hj - let φ : singleton hκ j ⟶ A := homOfLE (by + let φ : singleton κ₁ κ₂ j ⟶ A := homOfLE (by rw [Subtype.mk_le_mk] simpa) simp [colimit.ι_π_assoc, fac, ← s.w φ] @@ -332,7 +317,7 @@ lemma fac' (A : Subtype (prop hκ J)) : end isColimit open isColimit in -noncomputable def isColimit : IsColimit (cocone hκ p) where +noncomputable def isColimit : IsColimit (cocone κ₁ κ₂ p) where desc s := desc s fac s A := fac' s A uniq s m hm := @@ -340,16 +325,17 @@ noncomputable def isColimit : IsColimit (cocone hκ p) where end +variable {κ₁ κ₂} in include hκ' in lemma isCardinalFiltered_subtype_prop [IsCardinalFiltered J κ₁] : - IsCardinalFiltered (Subtype (prop hκ J)) κ₂ := + IsCardinalFiltered (Subtype (prop κ₁ κ₂ J)) κ₂ := isCardinalFiltered_preorder _ _ (fun K f hK ↦ by rw [← hasCardinalLT_iff_cardinal_mk_lt] at hK obtain ⟨B, hB₁, hB₂, hB₃⟩ := hκ' (⋃ (k : K), (f k).val) (hasCardinalLT_iUnion _ hK (fun k ↦ (f k).prop.2)) exact ⟨⟨B, hB₂, hB₃⟩, fun k ↦ (Set.subset_iUnion _ k).trans hB₁⟩) -variable (C) in +variable {κ₁ κ₂} (C) in include hκ hκ' in lemma isCardinalFilteredGenerator : (generator κ₁ κ₂ C).IsCardinalFilteredGenerator κ₂ where @@ -362,8 +348,8 @@ lemma isCardinalFilteredGenerator : obtain ⟨J₀, _, _, ⟨p₀⟩⟩ := hκ₁.exists_colimitsOfShape X obtain ⟨J, _, _, F, _⟩ := IsCardinalFiltered.exists_cardinal_directed J₀ κ₁ exact ⟨_, _, inferInstance, ⟨p₀.reindex F⟩⟩ - refine ⟨Subtype (prop hκ J), inferInstance, isCardinalFiltered_subtype_prop _ hκ', - ⟨{ diag := _, ι := _, isColimit := isColimit hκ p, prop_diag_obj A := ?_ }⟩⟩ + refine ⟨Subtype (prop κ₁ κ₂ J), inferInstance, isCardinalFiltered_subtype_prop hκ', + ⟨{ diag := _, ι := _, isColimit := isColimit κ₁ κ₂ p, prop_diag_obj A := ?_ }⟩⟩ have : (generator κ₁ κ₂ C).IsClosedUnderColimitsOfShape (Subtype A.val) := by apply ObjectProperty.isClosedUnderColimitsOfShape_colimitsCardinalClosure rw [hasCardinalLT_arrow_iff_of_isThin _ _ (IsRegular.aleph0_le Fact.out)] From 5e9a0193114f927200e4e648504078f2dd7bbb4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 26 May 2026 20:35:39 +0200 Subject: [PATCH 219/309] wip --- Mathlib.lean | 1 + Mathlib/CategoryTheory/Presentable/Basic.lean | 2 +- .../Presentable/Uniformization.lean | 55 +++++++++++++++++++ 3 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 Mathlib/CategoryTheory/Presentable/Uniformization.lean diff --git a/Mathlib.lean b/Mathlib.lean index 8bf811cb0b8742..259fc70b80a625 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -3251,6 +3251,7 @@ public import Mathlib.CategoryTheory.Presentable.Retracts public import Mathlib.CategoryTheory.Presentable.SharplyLT public import Mathlib.CategoryTheory.Presentable.StrongGenerator public import Mathlib.CategoryTheory.Presentable.Type +public import Mathlib.CategoryTheory.Presentable.Uniformization public import Mathlib.CategoryTheory.Products.Associator public import Mathlib.CategoryTheory.Products.Basic public import Mathlib.CategoryTheory.Products.Bifunctor diff --git a/Mathlib/CategoryTheory/Presentable/Basic.lean b/Mathlib/CategoryTheory/Presentable/Basic.lean index 9ca1a77355e4a7..9bcd1b33093614 100644 --- a/Mathlib/CategoryTheory/Presentable/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/Basic.lean @@ -149,7 +149,7 @@ abbrev IsCardinalPresentable : Prop := (coyoneda.obj (op X)).IsCardinalAccessibl variable (C) in /-- The property of objects that are `κ`-presentable. -/ -def isCardinalPresentable : ObjectProperty C := fun X ↦ IsCardinalPresentable X κ +abbrev isCardinalPresentable : ObjectProperty C := fun X ↦ IsCardinalPresentable X κ instance (X : (isCardinalPresentable C κ).FullSubcategory) : IsCardinalPresentable X.obj κ := diff --git a/Mathlib/CategoryTheory/Presentable/Uniformization.lean b/Mathlib/CategoryTheory/Presentable/Uniformization.lean new file mode 100644 index 00000000000000..8da60efc8e615a --- /dev/null +++ b/Mathlib/CategoryTheory/Presentable/Uniformization.lean @@ -0,0 +1,55 @@ +/- +Copyright (c) 2026 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.Presentable.SharplyLT + +/-! +# The uniformization theorem + +-/ + +@[expose] public section + +universe w v v' u u' + +open CategoryTheory in +lemma Cardinal.SharplyLT.exists_retract_of_isCardinalPresentable + {κ₁ κ₂ : Cardinal.{w}} [Fact κ₁.IsRegular] [Fact κ₂.IsRegular] + (hκ : κ₁.SharplyLT κ₂) {C : Type u} [Category.{v} C] + [IsCardinalAccessibleCategory C κ₁] (X : C) [IsCardinalPresentable X κ₂] : + ∃ (Y : C) (r : Retract X Y) (J : Type w) (_ : PartialOrder J), + IsCardinalFiltered J κ₁ ∧ HasCardinalLT J κ₂ ∧ + Nonempty ((isCardinalPresentable C κ₁).ColimitOfShape J Y) := by + sorry + +namespace CategoryTheory + +open Limits + +namespace IsCardinalAccessibleCategory + +variable {C : Type u} [Category.{v} C] {D : Type u'} [Category.{v'} D] + (F : C ⥤ D) {κ₁ κ₂ : Cardinal.{w}} [Fact κ₁.IsRegular] [Fact κ₂.IsRegular] + [IsCardinalAccessibleCategory C κ₁] [IsCardinalAccessibleCategory D κ₁] + [F.IsCardinalAccessible κ₁] (hκ : κ₁.SharplyLT κ₂) + +include hκ in +lemma uniformization + (hF : isCardinalPresentable C κ₁ ≤ (isCardinalPresentable D κ₂).inverseImage F) : + isCardinalPresentable C κ₂ ≤ (isCardinalPresentable D κ₂).inverseImage F := by + intro X hX + simp only [isCardinalPresentable_iff] at hX + obtain ⟨Y, r, J, _, _, hJ, ⟨p⟩⟩ := hκ.exists_retract_of_isCardinalPresentable X + refine (isCardinalPresentable D κ₂).prop_of_retract (r.map F) ?_ + have := F.preservesColimitsOfShape_of_isCardinalAccessible κ₁ + have (j : J) : IsCardinalPresentable ((p.diag ⋙ F).obj j) κ₂ := hF _ (p.prop_diag_obj j) + exact isCardinalPresentable_of_isColimit _ (isColimitOfPreserves F p.isColimit) _ + ((hasCardinalLT_arrow_iff_of_isThin _ _ (Cardinal.IsRegular.aleph0_le Fact.out)).2 hJ) + +end IsCardinalAccessibleCategory + +end CategoryTheory From 9d3b4599a52b02d3b6b6e0aedfd2d4f66880791d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Wed, 27 May 2026 09:47:56 +0200 Subject: [PATCH 220/309] wip --- .../Presentable/Uniformization.lean | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/Uniformization.lean b/Mathlib/CategoryTheory/Presentable/Uniformization.lean index 8da60efc8e615a..770f7f4253b2dd 100644 --- a/Mathlib/CategoryTheory/Presentable/Uniformization.lean +++ b/Mathlib/CategoryTheory/Presentable/Uniformization.lean @@ -16,15 +16,28 @@ public import Mathlib.CategoryTheory.Presentable.SharplyLT universe w v v' u u' -open CategoryTheory in +open CategoryTheory Limits in lemma Cardinal.SharplyLT.exists_retract_of_isCardinalPresentable {κ₁ κ₂ : Cardinal.{w}} [Fact κ₁.IsRegular] [Fact κ₂.IsRegular] (hκ : κ₁.SharplyLT κ₂) {C : Type u} [Category.{v} C] [IsCardinalAccessibleCategory C κ₁] (X : C) [IsCardinalPresentable X κ₂] : - ∃ (Y : C) (r : Retract X Y) (J : Type w) (_ : PartialOrder J), + ∃ (Y : C) (_ : Retract X Y) (J : Type w) (_ : PartialOrder J), IsCardinalFiltered J κ₁ ∧ HasCardinalLT J κ₂ ∧ Nonempty ((isCardinalPresentable C κ₁).ColimitOfShape J Y) := by - sorry + have hκ₁ := isCardinalFilteredGenerator_isCardinalPresentable C κ₁ + obtain ⟨J, _, _, ⟨p⟩⟩ : + ∃ (J : Type w) (_ : PartialOrder J) (_ : IsCardinalFiltered J κ₁), + Nonempty ((isCardinalPresentable C κ₁).ColimitOfShape J X) := by + obtain ⟨J₀, _, _, ⟨p₀⟩⟩ := hκ₁.exists_colimitsOfShape X + obtain ⟨J, _, _, F, _⟩ := IsCardinalFiltered.exists_cardinal_directed J₀ κ₁ + exact ⟨_, _, inferInstance, ⟨p₀.reindex F⟩⟩ + have : IsCardinalFiltered (Subtype (isCardinalAccessible.prop κ₁ κ₂ J)) κ₂ := + isCardinalAccessible.isCardinalFiltered_subtype_prop hκ.exists_isCardinalFiltered_set + obtain ⟨K, i, hi⟩ := IsCardinalPresentable.exists_hom_of_isColimit κ₂ + (isCardinalAccessible.isColimit κ₁ κ₂ p) (𝟙 X) + exact ⟨isCardinalAccessible.colimit κ₁ κ₂ p K, + { i := i, r := isCardinalAccessible.colimit.π κ₁ κ₂ p K }, Subtype K.val, + inferInstance, K.prop.1, K.prop.2, ⟨.colimit _ (fun k ↦ p.prop_diag_obj _)⟩⟩ namespace CategoryTheory From bd192f28d7d1b5b8d050f36e5e555a699b3a90a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Wed, 27 May 2026 18:38:49 +0200 Subject: [PATCH 221/309] wip --- .../CategoryTheory/Presentable/SharplyLT.lean | 200 ++++++++++++------ 1 file changed, 130 insertions(+), 70 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT.lean index ad5e3c4c9cbf3a..81d447196f101b 100644 --- a/Mathlib/CategoryTheory/Presentable/SharplyLT.lean +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT.lean @@ -66,16 +66,136 @@ lemma exists_cofinal_of_isCardinalAccessibleCategory_cardinalFilteredPoset convert Set.mem_singleton b exact Subtype.ext_iff.1 (hy' b) -open CardinalFilteredPoset Classical in +section + +open CardinalFilteredPoset + +namespace existsIsCardinalFilteredSetOfExistsCofinal + +variable (h₀ : κ₁ < κ₂) + {X : Type w} [PartialOrder X] + (Y : ∀ (B : Set X) (_ : HasCardinalLT B κ₂), Set (SetCardinalLT κ₁ B)) + (hY : ∀ (B : Set X) (hB : HasCardinalLT B κ₂), HasCardinalLT (Y B hB) κ₂) + (hY' : ∀ (B : Set X) (hB : HasCardinalLT B κ₂), IsCofinal (Y B hB)) + (m : ∀ (B : Set X) (hB : HasCardinalLT B κ₂) (C : SetCardinalLT κ₁ B), + C ∈ Y B hB → X) + (hm : ∀ (B : Set X) (hB : HasCardinalLT B κ₂) (C : SetCardinalLT κ₁ B) + (hC : C ∈ Y B hB) (b : B), b ∈ C.val → b ≤ m B hB C hC) + (A : Set X) (hA : HasCardinalLT A κ₂) + +def φ₀ (B : Set X) (hB : HasCardinalLT B κ₂) : Set X := + ⋃ (C : Y B hB), Subtype.val '' C.val.val ∪ {m B hB _ C.prop} + +omit [Fact κ₁.IsRegular] [Fact κ₂.IsRegular] in +include hY' hm in +lemma hφ₀ (B : Set X) (hB : HasCardinalLT B κ₂) {T : Type w} (f : T → B) + (hT : HasCardinalLT T κ₁) : + ∃ (a : φ₀ Y m B hB), ∀ (t : T), f t ≤ a.val := by + let C₀ : SetCardinalLT κ₁ B := + ⟨Set.range f, hT.of_surjective _ Set.rangeFactorization_surjective⟩ + obtain ⟨C, hC, hC'⟩ := hY' B hB C₀ + exact ⟨⟨m B hB C hC, Set.subset_iUnion _ ⟨C, hC⟩ (Or.inr (by simp))⟩, + fun t ↦ hm B hB C hC (f t) (hC' (by simp [C₀]))⟩ + +open Classical in +def φ (B : Set X) : Set X := + if hB : HasCardinalLT B κ₂ then φ₀ Y m B hB else B + +omit [Fact κ₁.IsRegular] [Fact κ₂.IsRegular] [PartialOrder X] in +lemma φ_eq (B : Set X) (hB : HasCardinalLT B κ₂) : + φ Y m B = φ₀ Y m B hB := dif_pos hB + +include hY' in +omit [Fact κ₂.IsRegular] [PartialOrder X] in +lemma le_φ (B : Set X) : B ≤ φ Y m B := by + dsimp [φ] + split_ifs with hB + · intro b hb + obtain ⟨C, hC, hC'⟩ := hY' B hB ⟨{⟨b, hb⟩}, + hasCardinalLT_of_finite _ _ (IsRegular.aleph0_le Fact.out)⟩ + refine Set.subset_iUnion _ ⟨C, hC⟩ (Or.inl ?_) + simp only [Set.mem_image, Subtype.exists, exists_and_right, exists_eq_right] + refine ⟨hb, @hC' ⟨b, hb⟩ (by simp)⟩ + · simp + +variable (κ₁) in +noncomputable abbrev orderBot : OrderBot κ₁.ord.ToType := + have : Nonempty κ₁.ord.ToType := by + rw [Ordinal.nonempty_toType_iff, ne_eq, ord_eq_zero] + exact IsRegular.ne_zero Fact.out + WellFoundedLT.toOrderBot _ + +include h₀ hA hY in +omit [PartialOrder X] in +lemma hasCardinalLT_transfiniteIterate_φ (j : κ₁.ord.ToType) : + HasCardinalLT (transfiniteIterate (φ Y m) j A :) κ₂ := by + induction j using SuccOrder.limitRecOn with + | isMin j hj => + letI := orderBot κ₁ + simpa [hj.eq_bot] + | succ j hj hj' => + have hκ₂ : κ₂.IsRegular := Fact.out + rw [transfiniteIterate_succ _ _ _ hj, φ_eq _ _ _ hj'] + refine hasCardinalLT_iUnion _ (hY _ _) + (fun ⟨C, hC⟩ ↦ hasCardinalLT_union hκ₂.aleph0_le ?_ + (hasCardinalLT_of_finite _ _ hκ₂.aleph0_le)) + refine (C.prop.of_le h₀.le).of_injective (fun ⟨c, hc⟩ ↦ ?_) + (fun c₁ c₂ hc ↦ ?_) + · simp only [Set.mem_image, Subtype.exists, exists_and_right, exists_eq_right] at hc + exact ⟨⟨c, hc.choose⟩, hc.choose_spec⟩ + · simpa only [Subtype.ext_iff] using hc + | isSuccLimit j hj hj' => + rw [transfiniteIterate_limit _ _ _ hj, Set.iSup_eq_iUnion] + refine hasCardinalLT_iUnion _ + (HasCardinalLT.of_injective ?_ _ Subtype.val_injective) (fun ⟨k, hk⟩ ↦ hj' _ hk) + simpa [hasCardinalLT_iff_cardinal_mk_lt] + +include hY' in +omit [Fact κ₂.IsRegular] [PartialOrder X] in +lemma monotone_transfiniteIterate_φ : + Monotone (fun (j : κ₁.ord.ToType) ↦ transfiniteIterate (φ Y m) j A) := + letI := orderBot κ₁ + monotone_transfiniteIterate _ _ (le_φ _ hY' _) + +omit [PartialOrder X] [Fact κ₂.IsRegular] in +lemma subset_iUnion : A ⊆ ⋃ (j : κ₁.ord.ToType), transfiniteIterate (φ Y m) j A := by + letI := orderBot κ₁ + exact subset_trans (by simp) (Set.subset_iUnion _ ⊥) + +include h₀ hY hY' hm hA in +lemma isCardinalFiltered_iUnion : + IsCardinalFiltered (⋃ (j : κ₁.ord.ToType), transfiniteIterate (φ Y m) j A) κ₁ := by + suffices ∀ ⦃K : Type w⦄ (j : κ₁.ord.ToType) (f : K → (transfiniteIterate (φ Y m) j A : Set _)) + (hK : HasCardinalLT K κ₁), + ∃ (x : (transfiniteIterate (φ Y m) (Order.succ j) A : Set _)), + ∀ (k : K), (f k).val ≤ x.val by + refine isCardinalFiltered_preorder _ _ (fun K f hK ↦ ?_) + rw [← hasCardinalLT_iff_cardinal_mk_lt] at hK + have (k : K) : ∃ (j : κ₁.ord.ToType), (f k).val ∈ transfiniteIterate (φ Y m) j A := by + simpa only [Set.mem_iUnion] using (f k).prop + choose a ha using this + obtain ⟨⟨z, hz⟩, hz'⟩ := this (IsCardinalFiltered.max a hK) (fun k ↦ + ⟨(f k).val, monotone_transfiniteIterate_φ Y hY' m A + (leOfHom (IsCardinalFiltered.toMax a hK k)) (ha k)⟩) hK + exact ⟨⟨z, Set.subset_iUnion _ _ hz⟩, hz'⟩ + intro K j f hK + have := hasCardinalLT_transfiniteIterate_φ h₀ Y hY m A + obtain ⟨⟨x, hx⟩, hx'⟩ := hφ₀ Y hY' m hm _ + (hasCardinalLT_transfiniteIterate_φ h₀ Y hY m A hA _) f hK + refine ⟨⟨x, ?_⟩, hx'⟩ + have : NoMaxOrder κ₁.ord.ToType := noMaxOrder (IsRegular.aleph0_le Fact.out) + rwa [transfiniteIterate_succ _ _ _ (not_isMax j), + φ_eq _ _ _ (hasCardinalLT_transfiniteIterate_φ h₀ Y hY m A hA _)] + +end existsIsCardinalFilteredSetOfExistsCofinal + +open existsIsCardinalFilteredSetOfExistsCofinal in lemma exists_isCardinalFiltered_set_of_exists_cofinal (h₀ : κ₁ < κ₂) (h : ∀ (X : Type w) (_ : HasCardinalLT X κ₂), ∃ (A : Set (SetCardinalLT κ₁ X)), HasCardinalLT A κ₂ ∧ IsCofinal A) {X : Type w} [PartialOrder X] [IsCardinalFiltered X κ₁] (A : Set X) (hA : HasCardinalLT A κ₂) : ∃ (B : Set X), A ⊆ B ∧ IsCardinalFiltered B κ₁ ∧ HasCardinalLT B κ₂ := by - have hκ₁ : κ₁.IsRegular := Fact.out - have hκ₂ : κ₂.IsRegular := Fact.out - have : NoMaxOrder κ₁.ord.ToType := noMaxOrder (hκ₁.aleph0_le) choose Y hY hY' using fun (B : Set X) hB ↦ h B hB have hY'' (B : Set X) (hB : HasCardinalLT B κ₂) (C : SetCardinalLT κ₁ B) (hC : C ∈ Y B hB) : @@ -84,72 +204,12 @@ lemma exists_isCardinalFiltered_set_of_exists_cofinal (h₀ : κ₁ < κ₂) fun b hb ↦ leOfHom (IsCardinalFiltered.toMax (fun (c : C.val) ↦ c.val.val) C.prop ⟨_, hb⟩)⟩ choose m hm using hY'' - let φ₀ (B : Set X) (hB : HasCardinalLT B κ₂) : Set X := - ⋃ (C : Y B hB), Subtype.val '' C.val.val ∪ {m B hB _ C.prop} - have hφ₀ (B : Set X) (hB : HasCardinalLT B κ₂) {T : Type w} (f : T → B) - (hT : HasCardinalLT T κ₁) : - ∃ (m : φ₀ B hB), ∀ (t : T), f t ≤ m.val := by - let C₀ : SetCardinalLT κ₁ B := - ⟨Set.range f, hT.of_surjective _ Set.rangeFactorization_surjective⟩ - obtain ⟨C, hC, hC'⟩ := hY' B hB C₀ - exact ⟨⟨m B hB C hC, Set.subset_iUnion _ ⟨C, hC⟩ (Or.inr (by simp))⟩, - fun t ↦ hm B hB C hC (f t) (hC' (by simp [C₀]))⟩ - let φ (B : Set X) : Set X := - if hB : HasCardinalLT B κ₂ then φ₀ B hB else B - have φ_eq (B : Set X) (hB : HasCardinalLT B κ₂) : φ B = φ₀ B hB := dif_pos hB - have hφ (B : Set X) : B ≤ φ B := by - dsimp [φ] - split_ifs with hB - · intro b hb - obtain ⟨C, hC, hC'⟩ := hY' B hB ⟨{⟨b, hb⟩}, hasCardinalLT_of_finite _ _ hκ₁.aleph0_le⟩ - refine Set.subset_iUnion _ ⟨C, hC⟩ (Or.inl ?_) - simp only [Set.mem_image, Subtype.exists, exists_and_right, exists_eq_right] - refine ⟨hb, @hC' ⟨b, hb⟩ (by simp)⟩ - · simp - let : Nonempty κ₁.ord.ToType := by - rw [Ordinal.nonempty_toType_iff, ne_eq, ord_eq_zero] - exact IsRegular.ne_zero Fact.out - let : OrderBot κ₁.ord.ToType := WellFoundedLT.toOrderBot _ - let s (j : κ₁.ord.ToType) : Set X := transfiniteIterate φ j A - have hs : Monotone s := monotone_transfiniteIterate _ _ hφ - have hs' (j) : HasCardinalLT (s j) κ₂ := by - induction j using SuccOrder.limitRecOn with - | isMin j hj => simpa [hj.eq_bot, s] - | succ j hj hj' => - dsimp [s] - rw [transfiniteIterate_succ _ _ _ hj, φ_eq _ hj'] - refine hasCardinalLT_iUnion _ (hY _ _) - (fun ⟨C, hC⟩ ↦ hasCardinalLT_union hκ₂.aleph0_le ?_ - (hasCardinalLT_of_finite _ _ hκ₂.aleph0_le)) - refine (C.prop.of_le h₀.le).of_injective (fun ⟨c, hc⟩ ↦ ?_) - (fun c₁ c₂ hc ↦ ?_) - · simp only [Set.mem_image, Subtype.exists, exists_and_right, exists_eq_right] at hc - exact ⟨⟨c, hc.choose⟩, hc.choose_spec⟩ - · simpa only [Subtype.ext_iff] using hc - | isSuccLimit j hj hj' => - dsimp [s] - rw [transfiniteIterate_limit _ _ _ hj, Set.iSup_eq_iUnion] - refine hasCardinalLT_iUnion _ - (HasCardinalLT.of_injective ?_ _ Subtype.val_injective) (fun ⟨k, hk⟩ ↦ hj' _ hk) - simpa [hasCardinalLT_iff_cardinal_mk_lt] - refine ⟨⋃ j, s j, ?_, ?_, ?_⟩ - · exact subset_trans (by simp [s]) (Set.subset_iUnion _ ⊥) - · suffices ∀ ⦃K : Type w⦄ (j : κ₁.ord.ToType) (f : K → s j) (hK : HasCardinalLT K κ₁), - ∃ (x : s (Order.succ j)), ∀ (k : K), (f k).val ≤ x.val by - refine isCardinalFiltered_preorder _ _ (fun K f hK ↦ ?_) - rw [← hasCardinalLT_iff_cardinal_mk_lt] at hK - have (k : K) : ∃ (j : κ₁.ord.ToType), (f k).val ∈ s j := by - simpa only [Set.mem_iUnion] using (f k).prop - choose a ha using this - obtain ⟨⟨z, hz⟩, hz'⟩ := this (IsCardinalFiltered.max a hK) (fun k ↦ - ⟨(f k).val, hs (leOfHom (IsCardinalFiltered.toMax a hK k)) (ha k)⟩) hK - exact ⟨⟨z, Set.subset_iUnion _ _ hz⟩, hz'⟩ - intro K j f hK - obtain ⟨⟨x, hx⟩, hx'⟩ := hφ₀ _ (hs' _) f hK - refine ⟨⟨x, ?_⟩, hx'⟩ - dsimp [s] - rwa [transfiniteIterate_succ _ _ _ (not_isMax j), φ_eq _ (hs' _)] - · exact hasCardinalLT_iUnion _ (by simpa [hasCardinalLT_iff_cardinal_mk_lt]) hs' + exact ⟨_, subset_iUnion Y m A, + isCardinalFiltered_iUnion h₀ Y hY hY' m hm A hA, + hasCardinalLT_iUnion _ (by simpa [hasCardinalLT_iff_cardinal_mk_lt]) + (hasCardinalLT_transfiniteIterate_φ h₀ Y hY m A hA)⟩ + +end section From ddaa3059c7dd863fbb74bcbfa1b729dd3a4f5455 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Wed, 27 May 2026 21:37:23 +0200 Subject: [PATCH 222/309] wip --- .../CategoryTheory/Presentable/SharplyLT.lean | 113 ++++++++++-------- .../Presentable/Uniformization.lean | 12 +- 2 files changed, 66 insertions(+), 59 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT.lean index 81d447196f101b..6b98bfc15e3ab8 100644 --- a/Mathlib/CategoryTheory/Presentable/SharplyLT.lean +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT.lean @@ -218,38 +218,25 @@ variable (hκ : κ₁ < κ₂) (A : Set X) (_ : HasCardinalLT A κ₂), ∃ (B : Set X), A ⊆ B ∧ IsCardinalFiltered B κ₁ ∧ HasCardinalLT B κ₂) -namespace isCardinalAccessible +variable (κ₁ κ₂) in +def IsCardinalFilteredAndHasCardinalLT + (J : Type w) [PartialOrder J] (A : Set J) : Prop := + IsCardinalFiltered A κ₁ ∧ HasCardinalLT A κ₂ -variable (κ₁ κ₂) +namespace IsCardinalFilteredAndHasCardinalLT -abbrev generator (C : Type u) [Category.{v} C] : - ObjectProperty C := - (isCardinalPresentable C κ₁).colimitsCardinalClosure κ₂ - -variable (C : Type u) [Category.{v} C] - -variable {κ₁ κ₂} in -include hκ in -lemma generator_le_isCardinalPresentable [LocallySmall.{w} C] : - generator κ₁ κ₂ C ≤ isCardinalPresentable C κ₂ := - ObjectProperty.colimitsCardinalClosure_le _ _ - (fun _ _ hJ ↦ isClosedUnderColimitsOfShape_isCardinalPresentable C hJ) - (isCardinalPresentable_monotone _ hκ.le) +variable (κ₁ κ₂) {C : Type u} [Category.{v} C] {X : C} + {J : Type w} [PartialOrder J] + (p : (isCardinalPresentable C κ₁).ColimitOfShape J X) variable [IsCardinalAccessibleCategory C κ₁] -def prop (J : Type w) [PartialOrder J] (A : Set J) : Prop := - IsCardinalFiltered A κ₁ ∧ HasCardinalLT A κ₂ - -variable {C} {X : C} {J : Type w} [PartialOrder J] - (p : (isCardinalPresentable C κ₁).ColimitOfShape J X) - -instance (A : Subtype (prop κ₁ κ₂ J)) : +instance (A : Subtype (IsCardinalFilteredAndHasCardinalLT κ₁ κ₂ J)) : HasColimit ((Subtype.mono_coe A.val).functor ⋙ p.diag) := by have : IsCardinalFiltered (Subtype A.val) κ₁ := A.prop.1 infer_instance -abbrev singleton (j : J) : Subtype (prop κ₁ κ₂ J) := +abbrev singleton (j : J) : Subtype (IsCardinalFilteredAndHasCardinalLT κ₁ κ₂ J) := ⟨{j}, by letI : OrderTop ({j} : Set J) := { top := ⟨j, by simp⟩ @@ -257,7 +244,8 @@ abbrev singleton (j : J) : Subtype (prop κ₁ κ₂ J) := exact isCardinalFiltered_of_hasTerminal _ _, hasCardinalLT_of_finite _ _ (IsRegular.aleph0_le Fact.out)⟩ -abbrev pair {j j' : J} (h : j ≤ j') : Subtype (prop κ₁ κ₂ J) := +abbrev pair {j j' : J} (h : j ≤ j') : + Subtype (IsCardinalFilteredAndHasCardinalLT κ₁ κ₂ J) := ⟨{j, j'}, by letI : OrderTop ({j, j'} : Set J) := { top := ⟨j', by simp⟩ @@ -275,22 +263,25 @@ lemma le_pair' {j j' : J} (h : j ≤ j') : rw [Subtype.mk_le_mk] simp -noncomputable abbrev colimit (A : Subtype (prop κ₁ κ₂ J)) : C := +noncomputable abbrev colimit + (A : Subtype (IsCardinalFilteredAndHasCardinalLT κ₁ κ₂ J)) : C := Limits.colimit ((Subtype.mono_coe A.val).functor ⋙ p.diag) -noncomputable abbrev colimit.ι (A : Subtype (prop κ₁ κ₂ J)) (a : J) (ha : a ∈ A.val) : +noncomputable abbrev colimit.ι + (A : Subtype (IsCardinalFilteredAndHasCardinalLT κ₁ κ₂ J)) (a : J) (ha : a ∈ A.val) : p.diag.obj a ⟶ colimit κ₁ κ₂ p A := Limits.colimit.ι ((Subtype.mono_coe A.val).functor ⋙ p.diag) ⟨a, ha⟩ omit [Fact κ₂.IsRegular] in @[reassoc (attr := simp)] -lemma colimit.w (A : Subtype (prop κ₁ κ₂ J)) {a b : J} (hab : a ≤ b) (ha : a ∈ A.val) - (hb : b ∈ A.val) : +lemma colimit.w (A : Subtype (IsCardinalFilteredAndHasCardinalLT κ₁ κ₂ J)) + {a b : J} (hab : a ≤ b) (ha : a ∈ A.val) (hb : b ∈ A.val) : p.diag.map (homOfLE hab) ≫ colimit.ι κ₁ κ₂ p A b hb = colimit.ι κ₁ κ₂ p A a ha := Limits.colimit.w ((Subtype.mono_coe A.val).functor ⋙ p.diag) (j := ⟨a, ha⟩) (j' := ⟨b, hb⟩) (homOfLE hab) -noncomputable def colimit.map {A₁ A₂ : Subtype (prop κ₁ κ₂ J)} (hA : A₁ ≤ A₂) : +noncomputable def colimit.map + {A₁ A₂ : Subtype (IsCardinalFilteredAndHasCardinalLT κ₁ κ₂ J)} (hA : A₁ ≤ A₂) : colimit κ₁ κ₂ p A₁ ⟶ colimit κ₁ κ₂ p A₂ := colimit.desc _ (Cocone.mk _ { app j := colimit.ι κ₁ κ₂ p A₂ j.val (hA j.prop) @@ -299,39 +290,45 @@ noncomputable def colimit.map {A₁ A₂ : Subtype (prop κ₁ κ₂ J)} (hA : A omit [Fact κ₂.IsRegular] in @[reassoc (attr := simp)] -lemma colimit.ι_map {A₁ A₂ : Subtype (prop κ₁ κ₂ J)} (hA : A₁ ≤ A₂) (j : J) (hj : j ∈ A₁.val) : +lemma colimit.ι_map {A₁ A₂ : Subtype (IsCardinalFilteredAndHasCardinalLT κ₁ κ₂ J)} + (hA : A₁ ≤ A₂) (j : J) (hj : j ∈ A₁.val) : colimit.ι κ₁ κ₂ p A₁ j hj ≫ colimit.map κ₁ κ₂ p hA = colimit.ι κ₁ κ₂ p A₂ j (hA hj) := colimit.ι_desc .. omit [Fact κ₂.IsRegular] in @[ext] -lemma colimit.hom_ext {A : Subtype (prop κ₁ κ₂ J)} {T : C} {φ₁ φ₂ : colimit κ₁ κ₂ p A ⟶ T} +lemma colimit.hom_ext + {A : Subtype (IsCardinalFilteredAndHasCardinalLT κ₁ κ₂ J)} {T : C} + {φ₁ φ₂ : colimit κ₁ κ₂ p A ⟶ T} (h : ∀ (j : J) (hj : j ∈ A.val), colimit.ι κ₁ κ₂ p A j hj ≫ φ₁ = colimit.ι κ₁ κ₂ p A j hj ≫ φ₂) : φ₁ = φ₂ := by ext apply h -noncomputable def colimit.π (A : Subtype (prop κ₁ κ₂ J)) : colimit κ₁ κ₂ p A ⟶ X := +noncomputable def colimit.π + (A : Subtype (IsCardinalFilteredAndHasCardinalLT κ₁ κ₂ J)) : colimit κ₁ κ₂ p A ⟶ X := colimit.desc _ (Cocone.mk _ { app a := by exact p.ι.app a naturality _ _ _ := by simpa using p.ι.naturality _ }) omit [Fact κ₂.IsRegular] in @[reassoc (attr := simp)] -lemma colimit.ι_π (A : Subtype (prop κ₁ κ₂ J)) (a : J) (ha : a ∈ A.val) : +lemma colimit.ι_π + (A : Subtype (IsCardinalFilteredAndHasCardinalLT κ₁ κ₂ J)) (a : J) (ha : a ∈ A.val) : colimit.ι κ₁ κ₂ p A a ha ≫ colimit.π κ₁ κ₂ p A = p.ι.app a := colimit.ι_desc .. omit [Fact κ₂.IsRegular] in @[reassoc (attr := simp)] -lemma colimit.map_π {A₁ A₂ : Subtype (prop κ₁ κ₂ J)} (hA : A₁ ≤ A₂) : +lemma colimit.map_π {A₁ A₂ : Subtype (IsCardinalFilteredAndHasCardinalLT κ₁ κ₂ J)} (hA : A₁ ≤ A₂) : colimit.map κ₁ κ₂ p hA ≫ colimit.π κ₁ κ₂ p A₂ = colimit.π κ₁ κ₂ p A₁ := by ext simp @[simps] -noncomputable def functor : Subtype (prop κ₁ κ₂ J) ⥤ C where +noncomputable def functor : + Subtype (IsCardinalFilteredAndHasCardinalLT κ₁ κ₂ J) ⥤ C where obj A := colimit κ₁ κ₂ p A map f := colimit.map κ₁ κ₂ p f.le map_id _ := by ext; simp @@ -342,8 +339,6 @@ noncomputable def cocone : Cocone (functor κ₁ κ₂ p) where pt := X ι.app j := colimit.π κ₁ κ₂ p j -section - namespace isColimit variable {κ₁ κ₂ p} (s : Cocone (functor κ₁ κ₂ p)) @@ -366,7 +361,7 @@ lemma fac (j : J) : p.isColimit.fac (coconeDesc s) j @[reassoc] -lemma fac' (A : Subtype (prop κ₁ κ₂ J)) : +lemma fac' (A : Subtype (IsCardinalFilteredAndHasCardinalLT κ₁ κ₂ J)) : colimit.π κ₁ κ₂ p A ≫ desc s = s.ι.app A := by ext j hj let φ : singleton κ₁ κ₂ j ⟶ A := homOfLE (by @@ -383,21 +378,35 @@ noncomputable def isColimit : IsColimit (cocone κ₁ κ₂ p) where uniq s m hm := p.isColimit.hom_ext (fun j ↦ by simp [fac s j, ← hm]) -end - variable {κ₁ κ₂} in include hκ' in -lemma isCardinalFiltered_subtype_prop [IsCardinalFiltered J κ₁] : - IsCardinalFiltered (Subtype (prop κ₁ κ₂ J)) κ₂ := +lemma isCardinalFiltered_subtype [IsCardinalFiltered J κ₁] : + IsCardinalFiltered (Subtype (IsCardinalFilteredAndHasCardinalLT κ₁ κ₂ J)) κ₂ := isCardinalFiltered_preorder _ _ (fun K f hK ↦ by rw [← hasCardinalLT_iff_cardinal_mk_lt] at hK obtain ⟨B, hB₁, hB₂, hB₃⟩ := hκ' (⋃ (k : K), (f k).val) (hasCardinalLT_iUnion _ hK (fun k ↦ (f k).prop.2)) exact ⟨⟨B, hB₂, hB₃⟩, fun k ↦ (Set.subset_iUnion _ k).trans hB₁⟩) -variable {κ₁ κ₂} (C) in +end IsCardinalFilteredAndHasCardinalLT + +variable (C : Type u) [Category.{v} C] + +variable (κ₁ κ₂) in +abbrev generator : ObjectProperty C := + (isCardinalPresentable C κ₁).colimitsCardinalClosure κ₂ + +include hκ in +lemma generator_le_isCardinalPresentable [LocallySmall.{w} C] : + generator κ₁ κ₂ C ≤ isCardinalPresentable C κ₂ := + ObjectProperty.colimitsCardinalClosure_le _ _ + (fun _ _ hJ ↦ isClosedUnderColimitsOfShape_isCardinalPresentable C hJ) + (isCardinalPresentable_monotone _ hκ.le) + +open IsCardinalFilteredAndHasCardinalLT in include hκ hκ' in -lemma isCardinalFilteredGenerator : +lemma isCardinalFilteredGenerator + [IsCardinalAccessibleCategory C κ₁] : (generator κ₁ κ₂ C).IsCardinalFilteredGenerator κ₂ where le_isCardinalPresentable := generator_le_isCardinalPresentable hκ C exists_colimitsOfShape X := by @@ -408,7 +417,8 @@ lemma isCardinalFilteredGenerator : obtain ⟨J₀, _, _, ⟨p₀⟩⟩ := hκ₁.exists_colimitsOfShape X obtain ⟨J, _, _, F, _⟩ := IsCardinalFiltered.exists_cardinal_directed J₀ κ₁ exact ⟨_, _, inferInstance, ⟨p₀.reindex F⟩⟩ - refine ⟨Subtype (prop κ₁ κ₂ J), inferInstance, isCardinalFiltered_subtype_prop hκ', + refine ⟨Subtype (IsCardinalFilteredAndHasCardinalLT κ₁ κ₂ J), inferInstance, + isCardinalFiltered_subtype hκ', ⟨{ diag := _, ι := _, isColimit := isColimit κ₁ κ₂ p, prop_diag_obj A := ?_ }⟩⟩ have : (generator κ₁ κ₂ C).IsClosedUnderColimitsOfShape (Subtype A.val) := by apply ObjectProperty.isClosedUnderColimitsOfShape_colimitsCardinalClosure @@ -418,11 +428,8 @@ lemma isCardinalFilteredGenerator : (fun ⟨a, ha⟩ ↦ ObjectProperty.le_colimitsCardinalClosure _ _ _ (p.prop_diag_obj a)) -end isCardinalAccessible - include hκ hκ' in -open isCardinalAccessible in -lemma isCardinalAccessible' +lemma isCardinalAccessibleCategory' (C : Type u) [Category.{v} C] [IsCardinalAccessibleCategory C κ₁] : IsCardinalAccessibleCategory C κ₂ where toHasCardinalFilteredColimits := .of_le C hκ.le @@ -447,7 +454,7 @@ lemma tfae (h : κ₁ < κ₂) : exists_cofinal_of_isCardinalAccessibleCategory_cardinalFilteredPoset h.le hX tfae_have 4 → 5 := fun h' X _ _ A hA ↦ exists_isCardinalFiltered_set_of_exists_cofinal h h' _ hA - tfae_have 5 → 3 := fun h' C _ _ ↦ isCardinalAccessible' h (fun A hA ↦ h' A hA) C + tfae_have 5 → 3 := fun h' C _ _ ↦ isCardinalAccessibleCategory' h (fun A hA ↦ h' A hA) C tfae_finish lemma exists_cofinal (h : SharplyLT κ₁ κ₂) @@ -464,10 +471,10 @@ lemma exists_isCardinalFiltered_set (h : SharplyLT κ₁ κ₂) have := (tfae h.lt).out 1 4 exact this.1 h.isCardinalAccessible_cardinalDirectedPoset A hA -lemma isCardinalAccessible (h : SharplyLT κ₁ κ₂) +lemma isCardinalAccessibleCategory (h : SharplyLT κ₁ κ₂) (C : Type u) [Category.{v} C] [IsCardinalAccessibleCategory C κ₁] : IsCardinalAccessibleCategory C κ₂ := - isCardinalAccessible' h.lt h.exists_isCardinalFiltered_set C + isCardinalAccessibleCategory' h.lt h.exists_isCardinalFiltered_set C lemma trans (h₁₂ : SharplyLT κ₁ κ₂) {κ₃ : Cardinal.{w}} [Fact κ₃.IsRegular] (h₂₃ : SharplyLT κ₂ κ₃) : @@ -475,7 +482,7 @@ lemma trans (h₁₂ : SharplyLT κ₁ κ₂) {κ₃ : Cardinal.{w}} [Fact κ₃ lt := h₁₂.lt.trans h₂₃.lt isCardinalAccessible_cardinalDirectedPoset := by have := h₁₂.isCardinalAccessible_cardinalDirectedPoset - exact h₂₃.isCardinalAccessible _ + exact h₂₃.isCardinalAccessibleCategory _ end SharplyLT diff --git a/Mathlib/CategoryTheory/Presentable/Uniformization.lean b/Mathlib/CategoryTheory/Presentable/Uniformization.lean index 770f7f4253b2dd..4d4d4e8bd2fc91 100644 --- a/Mathlib/CategoryTheory/Presentable/Uniformization.lean +++ b/Mathlib/CategoryTheory/Presentable/Uniformization.lean @@ -16,7 +16,7 @@ public import Mathlib.CategoryTheory.Presentable.SharplyLT universe w v v' u u' -open CategoryTheory Limits in +open CategoryTheory Limits Cardinal.SharplyLT.IsCardinalFilteredAndHasCardinalLT in lemma Cardinal.SharplyLT.exists_retract_of_isCardinalPresentable {κ₁ κ₂ : Cardinal.{w}} [Fact κ₁.IsRegular] [Fact κ₂.IsRegular] (hκ : κ₁.SharplyLT κ₂) {C : Type u} [Category.{v} C] @@ -31,12 +31,12 @@ lemma Cardinal.SharplyLT.exists_retract_of_isCardinalPresentable obtain ⟨J₀, _, _, ⟨p₀⟩⟩ := hκ₁.exists_colimitsOfShape X obtain ⟨J, _, _, F, _⟩ := IsCardinalFiltered.exists_cardinal_directed J₀ κ₁ exact ⟨_, _, inferInstance, ⟨p₀.reindex F⟩⟩ - have : IsCardinalFiltered (Subtype (isCardinalAccessible.prop κ₁ κ₂ J)) κ₂ := - isCardinalAccessible.isCardinalFiltered_subtype_prop hκ.exists_isCardinalFiltered_set + have : IsCardinalFiltered (Subtype (IsCardinalFilteredAndHasCardinalLT κ₁ κ₂ J)) κ₂ := + isCardinalFiltered_subtype hκ.exists_isCardinalFiltered_set obtain ⟨K, i, hi⟩ := IsCardinalPresentable.exists_hom_of_isColimit κ₂ - (isCardinalAccessible.isColimit κ₁ κ₂ p) (𝟙 X) - exact ⟨isCardinalAccessible.colimit κ₁ κ₂ p K, - { i := i, r := isCardinalAccessible.colimit.π κ₁ κ₂ p K }, Subtype K.val, + (isColimit κ₁ κ₂ p) (𝟙 X) + exact ⟨colimit κ₁ κ₂ p K, + { i := i, r := colimit.π κ₁ κ₂ p K }, Subtype K.val, inferInstance, K.prop.1, K.prop.2, ⟨.colimit _ (fun k ↦ p.prop_diag_obj _)⟩⟩ namespace CategoryTheory From a63140e3f9e38a585417d3502575c551a6fcec8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 28 May 2026 10:16:08 +0200 Subject: [PATCH 223/309] wip --- Mathlib.lean | 3 +- .../{SharplyLT.lean => SharplyLT/Basic.lean} | 7 ++ .../Presentable/SharplyLT/Lemmas.lean | 88 +++++++++++++++++++ .../Presentable/Uniformization.lean | 2 +- 4 files changed, 98 insertions(+), 2 deletions(-) rename Mathlib/CategoryTheory/Presentable/{SharplyLT.lean => SharplyLT/Basic.lean} (98%) create mode 100644 Mathlib/CategoryTheory/Presentable/SharplyLT/Lemmas.lean diff --git a/Mathlib.lean b/Mathlib.lean index 259fc70b80a625..02d669179b2cc4 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -3248,7 +3248,8 @@ public import Mathlib.CategoryTheory.Presentable.LocallyPresentable public import Mathlib.CategoryTheory.Presentable.OrthogonalReflection public import Mathlib.CategoryTheory.Presentable.Presheaf public import Mathlib.CategoryTheory.Presentable.Retracts -public import Mathlib.CategoryTheory.Presentable.SharplyLT +public import Mathlib.CategoryTheory.Presentable.SharplyLT.Basic +public import Mathlib.CategoryTheory.Presentable.SharplyLT.Lemmas public import Mathlib.CategoryTheory.Presentable.StrongGenerator public import Mathlib.CategoryTheory.Presentable.Type public import Mathlib.CategoryTheory.Presentable.Uniformization diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean similarity index 98% rename from Mathlib/CategoryTheory/Presentable/SharplyLT.lean rename to Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean index 6b98bfc15e3ab8..7ca2359d148c7a 100644 --- a/Mathlib/CategoryTheory/Presentable/SharplyLT.lean +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean @@ -464,6 +464,13 @@ lemma exists_cofinal (h : SharplyLT κ₁ κ₂) have := (tfae h.lt).out 1 3 exact this.1 h.isCardinalAccessible_cardinalDirectedPoset X hX +lemma of_exists_cofinal (h₀ : κ₁ < κ₂) + (h : ∀ (X : Type w) (_ : HasCardinalLT X κ₂), + ∃ (A : Set (CardinalFilteredPoset.SetCardinalLT κ₁ X)), + HasCardinalLT A κ₂ ∧ IsCofinal A) : + SharplyLT κ₁ κ₂ := + ((tfae h₀).out 3 0).1 h + lemma exists_isCardinalFiltered_set (h : SharplyLT κ₁ κ₂) {X : Type w} [PartialOrder X] [IsCardinalFiltered X κ₁] (A : Set X) (hA : HasCardinalLT A κ₂) : diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT/Lemmas.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT/Lemmas.lean new file mode 100644 index 00000000000000..b4a4ffc4fd28c0 --- /dev/null +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT/Lemmas.lean @@ -0,0 +1,88 @@ +/- +Copyright (c) 2026 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.Presentable.SharplyLT.Basic +public import Mathlib.SetTheory.Cardinal.Arithmetic + +/-! +# Lemmas about sharply smaller regular cardinals + +-/ + +@[expose] public section + +universe u + +open CategoryTheory Limits + +def Cardinal.setIioOrderEmbeddingToTypeOrd (κ : Cardinal.{u}) : + Set.Iio κ ↪o κ.ord.ToType := by + sorry + +@[no_expose] +noncomputable def Cardinal.toTypeOrdMkEquiv (X : Type u) : + (Cardinal.mk X).ord.ToType ≃ X := + Nonempty.some (by simp [← Cardinal.lift_mk_eq']) + +namespace CategoryTheory.CardinalFilteredPoset.SetCardinalLT + +variable (κ : Cardinal.{u}) (X : Type u) + +def fromSigma (x : Σ (κ' : Set.Iio κ), κ'.val.ord.ToType → X) : SetCardinalLT κ X := + ⟨Set.range x.2, + HasCardinalLT.of_surjective + (by simpa only [hasCardinalLT_iff_cardinal_mk_lt, + Cardinal.mk_toType, Cardinal.card_ord] using x.1.prop) _ + Set.rangeFactorization_surjective⟩ + +lemma fromSigma_surjective : Function.Surjective (fromSigma κ X) := by + rintro ⟨A, hA⟩ + rw [hasCardinalLT_iff_cardinal_mk_lt] at hA + refine ⟨⟨⟨_, hA⟩, Subtype.val ∘ Cardinal.toTypeOrdMkEquiv A⟩, ?_⟩ + rw [Subtype.mk_eq_mk] + simp [fromSigma] + +end CategoryTheory.CardinalFilteredPoset.SetCardinalLT + +namespace Cardinal.SharplyLT + +open CardinalFilteredPoset + +lemma of_pow_lt {κ₁ κ₂ : Cardinal.{u}} [Fact κ₁.IsRegular] [Fact κ₂.IsRegular] + (h₀ : κ₁ < κ₂) (h : ∀ (α β : Cardinal.{u}), α < κ₁ → β < κ₂ → β ^ α < κ₂) : + SharplyLT κ₁ κ₂ := + .of_exists_cofinal h₀ (fun X hX ↦ by + refine ⟨.univ, ?_, by simp⟩ + rw [hasCardinalLT_iff_of_equiv (Equiv.Set.univ _)] + refine HasCardinalLT.of_surjective ?_ _ (SetCardinalLT.fromSigma_surjective _ _) + refine hasCardinalLT_sigma _ _ ?_ (fun ⟨α, hα⟩ ↦ ?_) + · refine HasCardinalLT.of_injective ?_ _ + ((Cardinal.setIioOrderEmbeddingToTypeOrd κ₁).injective) + simpa [hasCardinalLT_iff_cardinal_mk_lt] + · simpa [hasCardinalLT_iff_cardinal_mk_lt] using + h _ _ hα (by rwa [hasCardinalLT_iff_cardinal_mk_lt] at hX)) + +lemma of_le {κ₁ κ₂ : Cardinal.{u}} [Fact κ₁.IsRegular] [Fact κ₂.IsRegular] + (h₀ : κ₁ ≤ κ₂) : + letI hκ₂ : κ₂.IsRegular := Fact.out + letI : Fact (Cardinal.IsRegular (Order.succ (2 ^ κ₂))) := + ⟨isRegular_succ (hκ₂.aleph0_le.trans (cantor _).le)⟩ + SharplyLT κ₁ (Order.succ (2 ^ κ₂)) := by + letI hκ₂ : κ₂.IsRegular := Fact.out + letI : Fact (Cardinal.IsRegular (Order.succ (2 ^ κ₂))) := + ⟨isRegular_succ (hκ₂.aleph0_le.trans (cantor _).le)⟩ + refine of_pow_lt ?_ (fun α β hα hβ ↦ ?_) + · simp only [Order.lt_succ_iff] + exact h₀.trans (cantor _).le + · simp only [Order.lt_succ_iff] at hβ ⊢ + refine (power_le_power_right hβ).trans ?_ + rw [← power_mul] + refine power_le_power_left (by simp) ?_ + conv_rhs => rw [← mul_eq_self (c := κ₂) (IsRegular.aleph0_le Fact.out)] + exact mul_le_mul_right (hα.le.trans h₀) _ + +end Cardinal.SharplyLT diff --git a/Mathlib/CategoryTheory/Presentable/Uniformization.lean b/Mathlib/CategoryTheory/Presentable/Uniformization.lean index 4d4d4e8bd2fc91..467ce07a968ed6 100644 --- a/Mathlib/CategoryTheory/Presentable/Uniformization.lean +++ b/Mathlib/CategoryTheory/Presentable/Uniformization.lean @@ -5,7 +5,7 @@ Authors: Joël Riou -/ module -public import Mathlib.CategoryTheory.Presentable.SharplyLT +public import Mathlib.CategoryTheory.Presentable.SharplyLT.Basic /-! # The uniformization theorem From 5db982d7a489d47e7a9eb501ef17902e7ed7ecfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 28 May 2026 10:27:38 +0200 Subject: [PATCH 224/309] wip --- .../Presentable/SharplyLT/Lemmas.lean | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT/Lemmas.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT/Lemmas.lean index b4a4ffc4fd28c0..1bd4fab2794f52 100644 --- a/Mathlib/CategoryTheory/Presentable/SharplyLT/Lemmas.lean +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT/Lemmas.lean @@ -19,15 +19,10 @@ universe u open CategoryTheory Limits -def Cardinal.setIioOrderEmbeddingToTypeOrd (κ : Cardinal.{u}) : - Set.Iio κ ↪o κ.ord.ToType := by +lemma Cardinal.mk_iio_le (κ : Cardinal.{u}) : + Cardinal.mk (Set.Iio κ) ≤ Cardinal.lift.{u + 1} κ := by sorry -@[no_expose] -noncomputable def Cardinal.toTypeOrdMkEquiv (X : Type u) : - (Cardinal.mk X).ord.ToType ≃ X := - Nonempty.some (by simp [← Cardinal.lift_mk_eq']) - namespace CategoryTheory.CardinalFilteredPoset.SetCardinalLT variable (κ : Cardinal.{u}) (X : Type u) @@ -42,7 +37,9 @@ def fromSigma (x : Σ (κ' : Set.Iio κ), κ'.val.ord.ToType → X) : SetCardina lemma fromSigma_surjective : Function.Surjective (fromSigma κ X) := by rintro ⟨A, hA⟩ rw [hasCardinalLT_iff_cardinal_mk_lt] at hA - refine ⟨⟨⟨_, hA⟩, Subtype.val ∘ Cardinal.toTypeOrdMkEquiv A⟩, ?_⟩ + let e : (Cardinal.mk A).ord.ToType ≃ A := + Nonempty.some (by simp [← Cardinal.lift_mk_eq']) + refine ⟨⟨⟨_, hA⟩, Subtype.val ∘ e⟩, ?_⟩ rw [Subtype.mk_eq_mk] simp [fromSigma] @@ -60,9 +57,8 @@ lemma of_pow_lt {κ₁ κ₂ : Cardinal.{u}} [Fact κ₁.IsRegular] [Fact κ₂. rw [hasCardinalLT_iff_of_equiv (Equiv.Set.univ _)] refine HasCardinalLT.of_surjective ?_ _ (SetCardinalLT.fromSigma_surjective _ _) refine hasCardinalLT_sigma _ _ ?_ (fun ⟨α, hα⟩ ↦ ?_) - · refine HasCardinalLT.of_injective ?_ _ - ((Cardinal.setIioOrderEmbeddingToTypeOrd κ₁).injective) - simpa [hasCardinalLT_iff_cardinal_mk_lt] + · refine lt_of_le_of_lt (le_trans ?_ (Cardinal.mk_iio_le κ₁)) (by simpa) + rw [lift_id'.{u, u + 1}] · simpa [hasCardinalLT_iff_cardinal_mk_lt] using h _ _ hα (by rwa [hasCardinalLT_iff_cardinal_mk_lt] at hX)) From d79c8f807e1e50b543980137b87550235ef11bfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 28 May 2026 10:56:33 +0200 Subject: [PATCH 225/309] wip --- Mathlib/CategoryTheory/Presentable/SharplyLT/Lemmas.lean | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT/Lemmas.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT/Lemmas.lean index 1bd4fab2794f52..6092ec2cb8b30d 100644 --- a/Mathlib/CategoryTheory/Presentable/SharplyLT/Lemmas.lean +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT/Lemmas.lean @@ -19,9 +19,11 @@ universe u open CategoryTheory Limits -lemma Cardinal.mk_iio_le (κ : Cardinal.{u}) : +lemma Cardinal.mk_iio_le_lift (κ : Cardinal.{u}) : Cardinal.mk (Set.Iio κ) ≤ Cardinal.lift.{u + 1} κ := by - sorry + conv_rhs => rw [← card_ord κ, ← mk_Iio_ordinal] + rw [Cardinal.le_def] + exact ⟨⟨fun ⟨a, ha⟩ ↦ ⟨a.ord, by simpa⟩, fun _ _ h ↦ by aesop⟩⟩ namespace CategoryTheory.CardinalFilteredPoset.SetCardinalLT @@ -57,7 +59,7 @@ lemma of_pow_lt {κ₁ κ₂ : Cardinal.{u}} [Fact κ₁.IsRegular] [Fact κ₂. rw [hasCardinalLT_iff_of_equiv (Equiv.Set.univ _)] refine HasCardinalLT.of_surjective ?_ _ (SetCardinalLT.fromSigma_surjective _ _) refine hasCardinalLT_sigma _ _ ?_ (fun ⟨α, hα⟩ ↦ ?_) - · refine lt_of_le_of_lt (le_trans ?_ (Cardinal.mk_iio_le κ₁)) (by simpa) + · refine lt_of_le_of_lt (le_trans ?_ (Cardinal.mk_iio_le_lift κ₁)) (by simpa) rw [lift_id'.{u, u + 1}] · simpa [hasCardinalLT_iff_cardinal_mk_lt] using h _ _ hα (by rwa [hasCardinalLT_iff_cardinal_mk_lt] at hX)) From 5eba21432ef2439b202aa282487a06421c6119e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 28 May 2026 18:28:37 +0200 Subject: [PATCH 226/309] fix --- Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean | 1 - 1 file changed, 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean index 98431190e04dd5..b460213be98e89 100644 --- a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean +++ b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean @@ -174,7 +174,6 @@ We assume that `Subtype P` is directed and nonempty, and that any `a : J.obj` belongs to some `S : Set J.obj` satisfying `P`. Then, `J` is the colimit in the category `CardinalFilteredPoset κ` of these subsets. -/ noncomputable def isColimitCoconeOfPredicateSet - [IsDirectedOrder (Subtype P)] [Nonempty (Subtype P)] (hP : ∀ (a : J.obj), ∃ (S : Set J.obj), P S ∧ a ∈ S) : IsColimit (coconeOfPredicateSet P) := isColimitOfReflects (CardinalFilteredPoset.ι) From 7ef6383c6d4731609329e3bb16419b54bf45438c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 29 May 2026 15:19:45 +0200 Subject: [PATCH 227/309] fix name --- Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean index ec148e93ef43fa..f0bb440be4ba26 100644 --- a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean +++ b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean @@ -356,7 +356,7 @@ instance (S : Subtype J.PropSet) : IsCardinalFiltered S κ := isCardinalFiltered_of_hasTerminal _ _ variable {J} in -lemma propSetWithTop_singleton (j : J.obj) : J.PropSet {j} := +lemma propSet_singleton (j : J.obj) : J.PropSet {j} := ⟨hasCardinalLT_of_finite _ _ (Cardinal.IsRegular.aleph0_le Fact.out), by let : OrderTop ({j} : Set J.obj) := { top := ⟨j, rfl⟩, le_top := by simp } exact isTerminalTop.hasTerminal⟩ @@ -399,7 +399,7 @@ abbrev cocone : Cocone (functorOfPredicateSet J.PropSet) := of its subsets that are of cardinality `< κ` and have a terminal object. -/ noncomputable def isColimitCocone (J : CardinalFilteredPoset κ) : IsColimit (cocone J) := - isColimitCoconeOfPredicateSet _ (fun a ↦ ⟨_, propSetWithTop_singleton a, by simp⟩) + isColimitCoconeOfPredicateSet _ (fun a ↦ ⟨_, propSet_singleton a, by simp⟩) end From c43390406fa57f38e648c6bc9321872771b43a71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 29 May 2026 15:26:46 +0200 Subject: [PATCH 228/309] docstrings --- .../CategoryTheory/Presentable/CardinalDirectedPoset.lean | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean index f0bb440be4ba26..427b606043a9ae 100644 --- a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean +++ b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean @@ -200,7 +200,7 @@ instance : ObjectProperty.EssentiallySmall.{u} (hasCardinalLTWithTerminal κ) wh obtain ⟨f⟩ : Cardinal.mk J.obj ≤ Cardinal.mk X := by simpa [hX] using ((hasCardinalLT_iff_cardinal_mk_lt _ _).1 hJ).le let e := Equiv.ofInjective _ f.injective - letI : PartialOrder (Set.range f) := PartialOrder.lift e.symm e.symm.injective + letI : PartialOrder (Set.range f) := PartialOrder.lift _ e.symm.injective let e' : Set.range f ≃o J.obj := { toEquiv := e.symm, map_rel_iff' := by rfl } exact ⟨_, ⟨⟨Set.range f, inferInstance, ⟨⟨IsCardinalFiltered.of_equivalence κ e'.symm.equivalence⟩⟩⟩⟩, @@ -347,6 +347,9 @@ section variable (J : CardinalFilteredPoset κ) +/-- Given `J : CardinalFilteredPoset κ`, this is the predicate +on `Set J.obj` that is satisfied by subsets that are of +cardinality `< κ` and have a terminal object. -/ def PropSet (S : Set J.obj) : Prop := HasCardinalLT S κ ∧ HasTerminal S @@ -392,6 +395,9 @@ instance : IsDirectedOrder (Subtype J.PropSet) := instance : Nonempty (Subtype J.PropSet) := IsFiltered.nonempty +/-- For any object `J : CardinalFilteredPoset κ`, this is a colimit +cocone exhibiting `J` as the colimit of its subsets +that are of cardinality `< κ` and have a terminal object. -/ abbrev cocone : Cocone (functorOfPredicateSet J.PropSet) := coconeOfPredicateSet J.PropSet From e03a27e6fb068410e28cbbf6e982cd3f4715055f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sat, 20 Jun 2026 15:49:06 +0200 Subject: [PATCH 229/309] wip --- Mathlib/CategoryTheory/Presentable/Basic.lean | 8 ++-- .../Presentable/LocallyPresentable.lean | 20 +++++++++- .../Presentable/SharplyLT/Lemmas.lean | 33 +++++++++++++++ .../Presentable/Uniformization.lean | 40 ++++++++++++++++--- 4 files changed, 91 insertions(+), 10 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/Basic.lean b/Mathlib/CategoryTheory/Presentable/Basic.lean index dc67a8ed501a72..df59dba0adf9f3 100644 --- a/Mathlib/CategoryTheory/Presentable/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/Basic.lean @@ -110,13 +110,13 @@ end section -variable (F : C ⥤ D) - /-- A functor is accessible relative to a universe `w` if it is `κ`-accessible for some regular `κ : Cardinal.{w}`. -/ @[pp_with_univ] -class IsAccessible : Prop where - exists_cardinal : ∃ (κ : Cardinal.{w}) (_ : Fact κ.IsRegular), IsCardinalAccessible F κ +class IsAccessible (F : C ⥤ D) : Prop where + exists_cardinal (F) : ∃ (κ : Cardinal.{w}) (_ : Fact κ.IsRegular), IsCardinalAccessible F κ + +variable (F : C ⥤ D) lemma isAccessible_of_isCardinalAccessible (κ : Cardinal.{w}) [Fact κ.IsRegular] [IsCardinalAccessible F κ] : IsAccessible.{w} F where diff --git a/Mathlib/CategoryTheory/Presentable/LocallyPresentable.lean b/Mathlib/CategoryTheory/Presentable/LocallyPresentable.lean index 53c0ad5a5e8fc3..7fa3c21f828f4f 100644 --- a/Mathlib/CategoryTheory/Presentable/LocallyPresentable.lean +++ b/Mathlib/CategoryTheory/Presentable/LocallyPresentable.lean @@ -29,7 +29,7 @@ universe w v u namespace CategoryTheory -open Limits +open Limits Opposite section @@ -104,4 +104,22 @@ example [IsLocallyPresentable.{w} C] (X : C) : IsPresentable.{w} X := inferInsta end +lemma ObjectProperty.le_isCardinalPresentable + {C : Type u} [Category.{v} C] [IsAccessibleCategory.{w} C] + (P : ObjectProperty C) [ObjectProperty.EssentiallySmall.{w} P] : + ∃ (κ' : Cardinal.{w}) (_ : Fact κ'.IsRegular), + P ≤ isCardinalPresentable C κ' := by + obtain ⟨Q, hQ, h₁, h₂⟩ := EssentiallySmall.exists_small_le.{w} P + choose κ hκ' hκ using fun (X : Subtype Q) ↦ + Functor.IsAccessible.exists_cardinal (coyoneda.obj (op X.val)) + obtain ⟨κ', h₃, h₄⟩ := HasCardinalLT.exists_regular_cardinal_forall + (fun i ↦ (κ i).ord.ToType) + have : Fact κ'.IsRegular := ⟨h₃⟩ + refine ⟨κ', inferInstance, h₂.trans ((isoClosure_le_iff _ _).2 ?_)⟩ + intro X hX + have := h₄ ⟨X, hX⟩ + simp only [hasCardinalLT_iff_cardinal_mk_lt, Cardinal.mk_toType, + Cardinal.card_ord] at this + exact isCardinalPresentable_monotone C this.le _ (hκ ⟨X, hX⟩) + end CategoryTheory diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT/Lemmas.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT/Lemmas.lean index 7ed24591b49506..7d52e7fc563e4a 100644 --- a/Mathlib/CategoryTheory/Presentable/SharplyLT/Lemmas.lean +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT/Lemmas.lean @@ -83,4 +83,37 @@ lemma of_le {κ₁ κ₂ : Cardinal.{u}} [Fact κ₁.IsRegular] [Fact κ₂.IsRe conv_rhs => rw [← mul_eq_self (c := κ₂) (IsRegular.aleph0_le Fact.out)] exact mul_le_mul_right (hα.le.trans h₀) _ +lemma exists_of_small {ι : Type*} [Small.{u} ι] (κ : ι → Cardinal.{u}) + [∀ i, Fact (κ i).IsRegular] : + ∃ (κ' : Cardinal.{u}) (_ : Fact κ'.IsRegular), + ∀ i, SharplyLT (κ i) κ' := sorry + +lemma exists_of_pair (κ₁ κ₂ : Cardinal.{u}) + [Fact κ₁.IsRegular] [Fact κ₂.IsRegular] : + ∃ (κ' : Cardinal.{u}) (_ : Fact κ'.IsRegular), + SharplyLT κ₁ κ' ∧ SharplyLT κ₂ κ' := by + let f (i : Fin 2) : Cardinal.{u} := match i with + | 0 => κ₁ + | 1 => κ₂ + have (i : _) : Fact (f i).IsRegular := match i with + | 0 => by assumption + | 1 => by assumption + obtain ⟨κ', _, h₂⟩ := exists_of_small f + exact ⟨κ', inferInstance, h₂ 0, h₂ 1⟩ + +lemma exists_of_triple (κ₁ κ₂ κ₃ : Cardinal.{u}) + [Fact κ₁.IsRegular] [Fact κ₂.IsRegular] [Fact κ₃.IsRegular] : + ∃ (κ' : Cardinal.{u}) (_ : Fact κ'.IsRegular), + SharplyLT κ₁ κ' ∧ SharplyLT κ₂ κ' ∧ SharplyLT κ₃ κ':= by + let f (i : Fin 3) : Cardinal.{u} := match i with + | 0 => κ₁ + | 1 => κ₂ + | 2 => κ₃ + have (i : _) : Fact (f i).IsRegular := match i with + | 0 => by assumption + | 1 => by assumption + | 2 => by assumption + obtain ⟨κ', _, h₂⟩ := exists_of_small f + exact ⟨κ', inferInstance, h₂ 0, h₂ 1, h₂ 2⟩ + end Cardinal.SharplyLT diff --git a/Mathlib/CategoryTheory/Presentable/Uniformization.lean b/Mathlib/CategoryTheory/Presentable/Uniformization.lean index 467ce07a968ed6..1d0b0164c99679 100644 --- a/Mathlib/CategoryTheory/Presentable/Uniformization.lean +++ b/Mathlib/CategoryTheory/Presentable/Uniformization.lean @@ -5,7 +5,7 @@ Authors: Joël Riou -/ module -public import Mathlib.CategoryTheory.Presentable.SharplyLT.Basic +public import Mathlib.CategoryTheory.Presentable.SharplyLT.Lemmas /-! # The uniformization theorem @@ -46,12 +46,12 @@ open Limits namespace IsCardinalAccessibleCategory variable {C : Type u} [Category.{v} C] {D : Type u'} [Category.{v'} D] - (F : C ⥤ D) {κ₁ κ₂ : Cardinal.{w}} [Fact κ₁.IsRegular] [Fact κ₂.IsRegular] - [IsCardinalAccessibleCategory C κ₁] [IsCardinalAccessibleCategory D κ₁] - [F.IsCardinalAccessible κ₁] (hκ : κ₁.SharplyLT κ₂) + (F : C ⥤ D) -include hκ in lemma uniformization + {κ₁ κ₂ : Cardinal.{w}} [Fact κ₁.IsRegular] [Fact κ₂.IsRegular] + [IsCardinalAccessibleCategory C κ₁] [IsCardinalAccessibleCategory D κ₁] + [F.IsCardinalAccessible κ₁] (hκ : κ₁.SharplyLT κ₂) (hF : isCardinalPresentable C κ₁ ≤ (isCardinalPresentable D κ₂).inverseImage F) : isCardinalPresentable C κ₂ ≤ (isCardinalPresentable D κ₂).inverseImage F := by intro X hX @@ -63,6 +63,36 @@ lemma uniformization exact isCardinalPresentable_of_isColimit _ (isColimitOfPreserves F p.isColimit) _ ((hasCardinalLT_arrow_iff_of_isThin _ _ (Cardinal.IsRegular.aleph0_le Fact.out)).2 hJ) +lemma uniformization' + [IsAccessibleCategory.{w} C] [IsAccessibleCategory.{w} D] + [Functor.IsAccessible.{w} F] : + ∃ (κ : Cardinal.{w}) (_ : Fact κ.IsRegular), + IsCardinalAccessibleCategory C κ ∧ + IsCardinalAccessibleCategory D κ ∧ + F.IsCardinalAccessible κ ∧ + isCardinalPresentable C κ ≤ (isCardinalPresentable D κ).inverseImage F := by + -- this should be a separate lemma + obtain ⟨κ, _, _, _, _⟩ : + ∃ (κ : Cardinal.{w}) (_ : Fact κ.IsRegular), + IsCardinalAccessibleCategory C κ ∧ IsCardinalAccessibleCategory D κ ∧ + F.IsCardinalAccessible κ := by + obtain ⟨κ₁, _, _⟩ := IsAccessibleCategory.exists_cardinal C + obtain ⟨κ₂, _, _⟩ := IsAccessibleCategory.exists_cardinal D + obtain ⟨κ₃, _, _⟩ := Functor.IsAccessible.exists_cardinal F + obtain ⟨κ, _, h₁, h₂, h₃⟩ := Cardinal.SharplyLT.exists_of_triple κ₁ κ₂ κ₃ + exact ⟨κ, inferInstance, + h₁.isCardinalAccessibleCategory C, + h₂.isCardinalAccessibleCategory D, Functor.isCardinalAccessible_of_le _ h₃.le⟩ + obtain ⟨κ₀, _, hκ₀⟩ := ObjectProperty.le_isCardinalPresentable.{w} + ((isCardinalPresentable C κ).map F) + obtain ⟨κ', _, h₁, h₂⟩ := Cardinal.SharplyLT.exists_of_pair κ κ₀ + exact ⟨κ', inferInstance, h₁.isCardinalAccessibleCategory C, + h₁.isCardinalAccessibleCategory D, + Functor.isCardinalAccessible_of_le _ h₁.le, + uniformization _ h₁ + (fun X hX ↦ isCardinalPresentable_monotone _ h₂.le _ + (hκ₀ _ (ObjectProperty.prop_map_obj _ _ hX)))⟩ + end IsCardinalAccessibleCategory end CategoryTheory From b7220d246d4a5457cfd85dc21095027a0babf362 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sat, 20 Jun 2026 19:32:13 +0200 Subject: [PATCH 230/309] wip --- .../Presentable/SharplyLT/Lemmas.lean | 30 ++++++++++++++----- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT/Lemmas.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT/Lemmas.lean index 7d52e7fc563e4a..09ce886b27b007 100644 --- a/Mathlib/CategoryTheory/Presentable/SharplyLT/Lemmas.lean +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT/Lemmas.lean @@ -64,15 +64,13 @@ lemma of_pow_lt {κ₁ κ₂ : Cardinal.{u}} [Fact κ₁.IsRegular] [Fact κ₂. · simpa [hasCardinalLT_iff_cardinal_mk_lt] using h _ _ hα (by rwa [hasCardinalLT_iff_cardinal_mk_lt] at hX)) -lemma of_le {κ₁ κ₂ : Cardinal.{u}} [Fact κ₁.IsRegular] [Fact κ₂.IsRegular] - (h₀ : κ₁ ≤ κ₂) : - letI hκ₂ : κ₂.IsRegular := Fact.out +lemma of_le {κ₁ κ₂ : Cardinal.{u}} [Fact κ₁.IsRegular] --[Fact κ₂.IsRegular] + (h₀ : κ₁ ≤ κ₂) (hκ₂ : Cardinal.aleph0 ≤ κ₂) : letI : Fact (Cardinal.IsRegular (Order.succ (2 ^ κ₂))) := - ⟨isRegular_succ (hκ₂.aleph0_le.trans (cantor _).le)⟩ + ⟨isRegular_succ (hκ₂.trans (cantor _).le)⟩ SharplyLT κ₁ (Order.succ (2 ^ κ₂)) := by - letI hκ₂ : κ₂.IsRegular := Fact.out letI : Fact (Cardinal.IsRegular (Order.succ (2 ^ κ₂))) := - ⟨isRegular_succ (hκ₂.aleph0_le.trans (cantor _).le)⟩ + ⟨isRegular_succ (hκ₂.trans (cantor _).le)⟩ refine of_pow_lt ?_ (fun α β hα hβ ↦ ?_) · simp only [Order.lt_succ_iff] exact h₀.trans (cantor _).le @@ -80,13 +78,29 @@ lemma of_le {κ₁ κ₂ : Cardinal.{u}} [Fact κ₁.IsRegular] [Fact κ₂.IsRe refine (power_le_power_right hβ).trans ?_ rw [← power_mul] refine power_le_power_left (by simp) ?_ - conv_rhs => rw [← mul_eq_self (c := κ₂) (IsRegular.aleph0_le Fact.out)] + conv_rhs => rw [← mul_eq_self hκ₂] exact mul_le_mul_right (hα.le.trans h₀) _ +-- to be moved +lemma _root_.Cardinal.exists_le_of_small {ι : Type*} [Small.{u} ι] + (κ : ι → Cardinal.{u}) : + ∃ (κ' : Cardinal.{u}), ∀ (i : ι), κ i ≤ κ' := by + let T (i : Shrink.{u} ι) : Type u := (κ ((equivShrink _).symm i)).ord.ToType + refine ⟨Cardinal.mk (Sigma T), fun i ↦ ?_⟩ + obtain ⟨i, rfl⟩ := (equivShrink.{u} _).symm.surjective i + simpa [T] using Cardinal.mk_le_of_injective + (sigma_mk_injective (β := fun i ↦ (κ ((equivShrink _).symm i)).ord.ToType)) + lemma exists_of_small {ι : Type*} [Small.{u} ι] (κ : ι → Cardinal.{u}) [∀ i, Fact (κ i).IsRegular] : ∃ (κ' : Cardinal.{u}) (_ : Fact κ'.IsRegular), - ∀ i, SharplyLT (κ i) κ' := sorry + ∀ i, SharplyLT (κ i) κ' := by + obtain ⟨κ₀, hκ₀, h⟩ : + ∃ (κ₀ : Cardinal.{u}), Cardinal.aleph0 ≤ κ₀ ∧ ∀ (i : ι), κ i ≤ κ₀ := by + obtain ⟨κ', h⟩ := Cardinal.exists_le_of_small κ + exact ⟨max κ' .aleph0, by simp, fun i ↦ (h i).trans (by simp)⟩ + exact ⟨Order.succ (2 ^ κ₀), ⟨isRegular_succ (hκ₀.trans (cantor _).le)⟩, + fun i ↦ of_le (h i) hκ₀⟩ lemma exists_of_pair (κ₁ κ₂ : Cardinal.{u}) [Fact κ₁.IsRegular] [Fact κ₂.IsRegular] : From 24450771bc8e43504793ea5c6ec3aa49be9ff696 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sat, 20 Jun 2026 19:33:04 +0200 Subject: [PATCH 231/309] removed comment --- Mathlib/CategoryTheory/Presentable/Uniformization.lean | 1 - 1 file changed, 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Presentable/Uniformization.lean b/Mathlib/CategoryTheory/Presentable/Uniformization.lean index 1d0b0164c99679..e1b971b25ef022 100644 --- a/Mathlib/CategoryTheory/Presentable/Uniformization.lean +++ b/Mathlib/CategoryTheory/Presentable/Uniformization.lean @@ -71,7 +71,6 @@ lemma uniformization' IsCardinalAccessibleCategory D κ ∧ F.IsCardinalAccessible κ ∧ isCardinalPresentable C κ ≤ (isCardinalPresentable D κ).inverseImage F := by - -- this should be a separate lemma obtain ⟨κ, _, _, _, _⟩ : ∃ (κ : Cardinal.{w}) (_ : Fact κ.IsRegular), IsCardinalAccessibleCategory C κ ∧ IsCardinalAccessibleCategory D κ ∧ From 1fbc6a7e874c0d1d3780e0cd1bcd03728bb9d0f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Sat, 20 Jun 2026 21:12:44 +0200 Subject: [PATCH 232/309] wip --- .../Presentable/Uniformization.lean | 78 +++++++++++++++---- 1 file changed, 61 insertions(+), 17 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/Uniformization.lean b/Mathlib/CategoryTheory/Presentable/Uniformization.lean index e1b971b25ef022..9a1e2ec24d46a3 100644 --- a/Mathlib/CategoryTheory/Presentable/Uniformization.lean +++ b/Mathlib/CategoryTheory/Presentable/Uniformization.lean @@ -46,9 +46,10 @@ open Limits namespace IsCardinalAccessibleCategory variable {C : Type u} [Category.{v} C] {D : Type u'} [Category.{v'} D] - (F : C ⥤ D) -lemma uniformization + +lemma uniformization' + (F : C ⥤ D) {κ₁ κ₂ : Cardinal.{w}} [Fact κ₁.IsRegular] [Fact κ₂.IsRegular] [IsCardinalAccessibleCategory C κ₁] [IsCardinalAccessibleCategory D κ₁] [F.IsCardinalAccessible κ₁] (hκ : κ₁.SharplyLT κ₂) @@ -63,34 +64,77 @@ lemma uniformization exact isCardinalPresentable_of_isColimit _ (isColimitOfPreserves F p.isColimit) _ ((hasCardinalLT_arrow_iff_of_isThin _ _ (Cardinal.IsRegular.aleph0_le Fact.out)).2 hJ) -lemma uniformization' +lemma uniformization_of_small [IsAccessibleCategory.{w} C] [IsAccessibleCategory.{w} D] - [Functor.IsAccessible.{w} F] : + {ι : Type*} [Small.{w} ι] (F : ι → C ⥤ D) + [∀ i, Functor.IsAccessible.{w} (F i)] : ∃ (κ : Cardinal.{w}) (_ : Fact κ.IsRegular), IsCardinalAccessibleCategory C κ ∧ IsCardinalAccessibleCategory D κ ∧ - F.IsCardinalAccessible κ ∧ - isCardinalPresentable C κ ≤ (isCardinalPresentable D κ).inverseImage F := by + (∀ i, (F i).IsCardinalAccessible κ) ∧ + ∀ i, isCardinalPresentable C κ ≤ (isCardinalPresentable D κ).inverseImage (F i) := by obtain ⟨κ, _, _, _, _⟩ : ∃ (κ : Cardinal.{w}) (_ : Fact κ.IsRegular), IsCardinalAccessibleCategory C κ ∧ IsCardinalAccessibleCategory D κ ∧ - F.IsCardinalAccessible κ := by + ∀ (i : ι), (F i).IsCardinalAccessible κ := by obtain ⟨κ₁, _, _⟩ := IsAccessibleCategory.exists_cardinal C obtain ⟨κ₂, _, _⟩ := IsAccessibleCategory.exists_cardinal D - obtain ⟨κ₃, _, _⟩ := Functor.IsAccessible.exists_cardinal F - obtain ⟨κ, _, h₁, h₂, h₃⟩ := Cardinal.SharplyLT.exists_of_triple κ₁ κ₂ κ₃ - exact ⟨κ, inferInstance, - h₁.isCardinalAccessibleCategory C, - h₂.isCardinalAccessibleCategory D, Functor.isCardinalAccessible_of_le _ h₃.le⟩ - obtain ⟨κ₀, _, hκ₀⟩ := ObjectProperty.le_isCardinalPresentable.{w} - ((isCardinalPresentable C κ).map F) + choose κ₃ _ hκ₃ using fun i ↦ Functor.IsAccessible.exists_cardinal (F i) + obtain ⟨κ₃', hκ₃' , hκ₃''⟩ := + HasCardinalLT.exists_regular_cardinal_forall (fun i ↦ (κ₃ i).ord.ToType) + have : Fact κ₃'.IsRegular := ⟨hκ₃'⟩ + obtain ⟨κ, _, hκ₁, hκ₂, hκ₃⟩ := Cardinal.SharplyLT.exists_of_triple κ₁ κ₂ κ₃' + refine ⟨κ, inferInstance, hκ₁.isCardinalAccessibleCategory C, + hκ₂.isCardinalAccessibleCategory D, + fun i ↦ Functor.isCardinalAccessible_of_le _ (show κ₃ i ≤ κ from ?_)⟩ + have := (hκ₃'' i) + simp only [hasCardinalLT_iff_cardinal_mk_lt, Cardinal.mk_toType, Cardinal.card_ord] at this + exact this.le.trans hκ₃.le + obtain ⟨κ₀, _, hκ₀⟩ : ∃ (κ₀ : Cardinal.{w}) (_ : Fact κ₀.IsRegular), + ∀ (i : ι), (isCardinalPresentable C κ).map (F i) ≤ isCardinalPresentable D κ₀ := by + choose κ' hκ' hκ'' using + fun i ↦ ObjectProperty.le_isCardinalPresentable.{w} ((isCardinalPresentable C κ).map (F i)) + obtain ⟨κ'', h₁, h₂⟩ := + HasCardinalLT.exists_regular_cardinal_forall (fun i ↦ (κ' i).ord.ToType) + have : Fact κ''.IsRegular := ⟨h₁⟩ + refine ⟨κ'', inferInstance, fun i ↦ (hκ'' i).trans ?_⟩ + have := h₂ i + simp only [hasCardinalLT_iff_cardinal_mk_lt, Cardinal.mk_toType, Cardinal.card_ord] at this + exact isCardinalPresentable_monotone _ this.le obtain ⟨κ', _, h₁, h₂⟩ := Cardinal.SharplyLT.exists_of_pair κ κ₀ exact ⟨κ', inferInstance, h₁.isCardinalAccessibleCategory C, h₁.isCardinalAccessibleCategory D, - Functor.isCardinalAccessible_of_le _ h₁.le, - uniformization _ h₁ + fun i ↦ Functor.isCardinalAccessible_of_le _ h₁.le, + fun i ↦ uniformization' _ h₁ (fun X hX ↦ isCardinalPresentable_monotone _ h₂.le _ - (hκ₀ _ (ObjectProperty.prop_map_obj _ _ hX)))⟩ + (hκ₀ i _ (ObjectProperty.prop_map_obj _ _ hX)))⟩ + +lemma uniformization_pair (F₁ F₂ : C ⥤ D) + [IsAccessibleCategory.{w} C] [IsAccessibleCategory.{w} D] + [Functor.IsAccessible.{w} F₁] [Functor.IsAccessible.{w} F₂] : + ∃ (κ : Cardinal.{w}) (_ : Fact κ.IsRegular), + IsCardinalAccessibleCategory C κ ∧ + IsCardinalAccessibleCategory D κ ∧ + F₁.IsCardinalAccessible κ ∧ F₂.IsCardinalAccessible κ ∧ + isCardinalPresentable C κ ≤ (isCardinalPresentable D κ).inverseImage F₁ ∧ + isCardinalPresentable C κ ≤ (isCardinalPresentable D κ).inverseImage F₂ := by + let F (i : Fin 2) : C ⥤ D := match i with | 0 => F₁ | 1 => F₂ + have (i : Fin 2) : Functor.IsAccessible.{w} (F i) := match i with + | 0 => by assumption + | 1 => by assumption + obtain ⟨κ, _, h₁, h₂, h₃, h₄⟩ := uniformization_of_small F + exact ⟨κ, inferInstance, h₁, h₂, h₃ 0, h₃ 1, h₄ 0, h₄ 1⟩ + +lemma uniformization (F : C ⥤ D) + [IsAccessibleCategory.{w} C] [IsAccessibleCategory.{w} D] + [Functor.IsAccessible.{w} F] : + ∃ (κ : Cardinal.{w}) (_ : Fact κ.IsRegular), + IsCardinalAccessibleCategory C κ ∧ + IsCardinalAccessibleCategory D κ ∧ + F.IsCardinalAccessible κ ∧ + isCardinalPresentable C κ ≤ (isCardinalPresentable D κ).inverseImage F := by + obtain ⟨κ, _, h₁, h₂, h₃, h₄⟩ := uniformization_of_small (fun (_ : Fin 1) ↦ F) + exact ⟨κ, inferInstance, h₁, h₂, h₃ 0, h₄ 0⟩ end IsCardinalAccessibleCategory From 8a04f2a4e2ff767f5db6e86988d88285a11f7de3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 23 Jun 2026 11:45:06 +0200 Subject: [PATCH 233/309] feat(CategoryTheory/Presentable): sharply small regular cardinals --- Mathlib.lean | 1 + .../Presentable/CardinalDirectedPoset.lean | 23 ++ .../Presentable/SharplyLT/Basic.lean | 235 ++++++++++++++++++ 3 files changed, 259 insertions(+) create mode 100644 Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean diff --git a/Mathlib.lean b/Mathlib.lean index e172db56965dbd..1a98743df37da0 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -3268,6 +3268,7 @@ public import Mathlib.CategoryTheory.Presentable.LocallyPresentable public import Mathlib.CategoryTheory.Presentable.OrthogonalReflection public import Mathlib.CategoryTheory.Presentable.Presheaf public import Mathlib.CategoryTheory.Presentable.Retracts +public import Mathlib.CategoryTheory.Presentable.SharplyLT.Basic public import Mathlib.CategoryTheory.Presentable.StrongGenerator public import Mathlib.CategoryTheory.Presentable.Type public import Mathlib.CategoryTheory.Products.Associator diff --git a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean index 8217cf1f7859a6..8d11c5af453829 100644 --- a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean +++ b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean @@ -429,6 +429,29 @@ instance : IsCardinalAccessibleCategory (CardinalFilteredPoset κ) κ where ⟨hasCardinalLTWithTerminal κ, inferInstance, isCardinalFilteredGenerator_hasCardinalLTWithTerminal κ⟩ +variable (κ) (X : Type u) + +/-- Given a cardinal `κ` and a type `X`, this is the subtype of `Set X` +consisting of subsets of `X` of cardinality `< κ`. -/ +abbrev SetCardinalLT := Subtype (fun (S : Set X) ↦ HasCardinalLT S κ) + +variable {X} in +abbrev SetCardinalLT.singleton (x : X) : SetCardinalLT κ X := + ⟨{x}, hasCardinalLT_of_finite _ _ (Cardinal.IsRegular.aleph0_le Fact.out)⟩ + +instance : IsCardinalFiltered (SetCardinalLT κ X) κ := + isCardinalFiltered_preorder _ _ + (fun K f hK ↦ + ⟨⟨⋃ (k : K), (f k).val, hasCardinalLT_iUnion _ + (by rwa [hasCardinalLT_iff_cardinal_mk_lt]) (fun k ↦ (f k).prop)⟩, + Set.subset_iUnion (fun k ↦ (f k).val)⟩) + +/-- Given a regular cardinal `κ` and a type `X`, this is the `κ`-filtered +partially ordered type of subsets of `X` of cardinality `< κ`, +as an object of the category `CardinalFilteredPoset κ`. -/ +abbrev setCardinalLT : CardinalFilteredPoset κ := + .of (PartOrdEmb.of (SetCardinalLT κ X)) + end CardinalFilteredPoset end CategoryTheory diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean new file mode 100644 index 00000000000000..861bc60ecef5e0 --- /dev/null +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean @@ -0,0 +1,235 @@ +/- +Copyright (c) 2026 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.ColimitsCardinalClosure +public import Mathlib.CategoryTheory.Presentable.CardinalDirectedPoset +public import Mathlib.CategoryTheory.Presentable.Dense +public import Mathlib.CategoryTheory.Presentable.Directed +public import Mathlib.Order.TransfiniteIteration + +/-! +# Sharply smaller regular cardinals + +In this file, we introduce the predicate `Cardinal.SharplyLT`. Given two regular +cardinals `κ₁ < κ₂`, this condition can be described in different ways: +(i) the category `IsCardinalAccessibleCategory C κ₁` is `κ₂`-accessible; +(ii) any `κ₁`-accessible category is `κ₂`-accessible. +(iii) for any type `X` of cardinality `< κ₂`, there exists a cofinal set of + cardinality `< κ₂` in the subtype of subsets of `X` of cardinality `< κ₁`; +(iv) for any `κ₁`-directed partially ordered type `X` and any subset `A` of `X` + of cardinality `< κ₂`, there exists a `κ₁`-directed subset `B` of `X` containing `A` + that is of cardinality `< κ₂`. +This is Theorem 2.11 in the book by Adámek and Rosický (TODO @joelriou). Here, +we take (i) as the definition. + +## References +* [Adámek, J. and Rosický, J., *Locally presentable and accessible categories*][Adamek_Rosicky_1994] + +-/ + +universe w v u + +open CategoryTheory Limits + +namespace Cardinal + +variable {κ₁ κ₂ : Cardinal.{w}} [Fact κ₁.IsRegular] [Fact κ₂.IsRegular] + +variable (κ₁ κ₂) in +/-- If `κ₁ < κ₂` are two regular cardinal, we say that `κ₁` is sharply +smaller than `κ₂` if the category `CardinalFilteredPoset κ₁` +is `κ₂`-accessible. There are other characterizations (TODO @joelriou), +including the property that any `κ₁`-accessible category is +also `κ₂`-accessible. -/ +public structure SharplyLT : Prop where + lt : κ₁ < κ₂ + isCardinalAccessible_cardinalDirectedPoset : + IsCardinalAccessibleCategory (CardinalFilteredPoset κ₁) κ₂ + +namespace SharplyLT + +public lemma le (h : SharplyLT κ₁ κ₂) : κ₁ ≤ κ₂ := h.lt.le + +set_option backward.defeqAttrib.useBackward true in +open CardinalFilteredPoset in +public lemma exists_cofinal_of_isCardinalAccessibleCategory_cardinalFilteredPoset + (h : κ₁ ≤ κ₂) [IsCardinalAccessibleCategory (CardinalFilteredPoset κ₁) κ₂] + {X : Type w} (hX : HasCardinalLT X κ₂) : + ∃ (A : Set (SetCardinalLT κ₁ X)), HasCardinalLT A κ₂ ∧ IsCofinal A := by + obtain ⟨J, _, _, ⟨p⟩⟩ := (isCardinalFilteredGenerator_isCardinalPresentable + (CardinalFilteredPoset κ₁) κ₂).exists_colimitsOfShape (setCardinalLT κ₁ X) + have : IsCardinalFiltered J κ₁ := .of_le _ h + have hp (j : J) : HasCardinalLT (p.diag.obj j).obj κ₂ := by + rw [← CardinalFilteredPoset.isCardinalPresentable_iff _ h] + exact p.prop_diag_obj j + choose j y hy using fun x ↦ Types.jointly_surjective_of_isColimit + (isColimitOfPreserves (forget (CardinalFilteredPoset κ₁)) p.isColimit) + (SetCardinalLT.singleton κ₁ x) + dsimp at y hy + let j' := IsCardinalFiltered.max j hX + let y' (x : X) : (p.diag.obj j').obj := + p.diag.map (IsCardinalFiltered.toMax j hX x) (y x) + have hy' (x : X) : p.ι.app j' (y' x) = SetCardinalLT.singleton κ₁ x := by + rw [← hy, ← p.w (IsCardinalFiltered.toMax j hX x)] + rfl + refine ⟨Set.range (p.ι.app j'), (hp j').of_surjective _ + (Set.rangeFactorization_surjective (f := p.ι.app j')), fun ⟨B, hB⟩ ↦ ?_⟩ + let j'' := IsCardinalFiltered.max (fun b ↦ y' b.val) hB + refine ⟨_, ⟨j'', rfl⟩, fun b hb ↦ ?_⟩ + have : y' b ≤ j'' := (leOfHom (IsCardinalFiltered.toMax (fun b ↦ y' b.val) hB ⟨b, hb⟩) :) + refine (p.ι.app j').hom.hom.monotone this ?_ + convert Set.mem_singleton b + exact Subtype.ext_iff.1 (hy' b) + +section + +open CardinalFilteredPoset + +namespace existsIsCardinalFilteredSetOfExistsCofinal + +variable (h₀ : κ₁ < κ₂) + {X : Type w} [PartialOrder X] + (Y : ∀ (B : Set X) (_ : HasCardinalLT B κ₂), Set (SetCardinalLT κ₁ B)) + (hY : ∀ (B : Set X) (hB : HasCardinalLT B κ₂), HasCardinalLT (Y B hB) κ₂) + (hY' : ∀ (B : Set X) (hB : HasCardinalLT B κ₂), IsCofinal (Y B hB)) + (m : ∀ (B : Set X) (hB : HasCardinalLT B κ₂) (C : SetCardinalLT κ₁ B), + C ∈ Y B hB → X) + (hm : ∀ (B : Set X) (hB : HasCardinalLT B κ₂) (C : SetCardinalLT κ₁ B) + (hC : C ∈ Y B hB) (b : B), b ∈ C.val → b ≤ m B hB C hC) + (A : Set X) (hA : HasCardinalLT A κ₂) + +def φ₀ (B : Set X) (hB : HasCardinalLT B κ₂) : Set X := + ⋃ (C : Y B hB), Subtype.val '' C.val.val ∪ {m B hB _ C.prop} + +omit [Fact κ₁.IsRegular] [Fact κ₂.IsRegular] in +include hY' hm in +lemma hφ₀ (B : Set X) (hB : HasCardinalLT B κ₂) {T : Type w} (f : T → B) + (hT : HasCardinalLT T κ₁) : + ∃ (a : φ₀ Y m B hB), ∀ (t : T), f t ≤ a.val := by + let C₀ : SetCardinalLT κ₁ B := + ⟨Set.range f, hT.of_surjective _ Set.rangeFactorization_surjective⟩ + obtain ⟨C, hC, hC'⟩ := hY' B hB C₀ + exact ⟨⟨m B hB C hC, Set.subset_iUnion _ ⟨C, hC⟩ (Or.inr (by simp))⟩, + fun t ↦ hm B hB C hC (f t) (hC' (by simp [C₀]))⟩ + +open Classical in +def φ (B : Set X) : Set X := + if hB : HasCardinalLT B κ₂ then φ₀ Y m B hB else B + +omit [Fact κ₁.IsRegular] [Fact κ₂.IsRegular] [PartialOrder X] in +lemma φ_eq (B : Set X) (hB : HasCardinalLT B κ₂) : + φ Y m B = φ₀ Y m B hB := dif_pos hB + +include hY' in +omit [Fact κ₂.IsRegular] [PartialOrder X] in +lemma le_φ (B : Set X) : B ≤ φ Y m B := by + dsimp [φ] + split_ifs with hB + · intro b hb + obtain ⟨C, hC, hC'⟩ := hY' B hB ⟨{⟨b, hb⟩}, + hasCardinalLT_of_finite _ _ (IsRegular.aleph0_le Fact.out)⟩ + refine Set.subset_iUnion _ ⟨C, hC⟩ (Or.inl ?_) + simp only [Set.mem_image, Subtype.exists, exists_and_right, exists_eq_right] + refine ⟨hb, @hC' ⟨b, hb⟩ (by simp)⟩ + · simp + +variable (κ₁) in +noncomputable abbrev orderBot : OrderBot κ₁.ord.ToType := + have : Nonempty κ₁.ord.ToType := by + rw [Ordinal.nonempty_toType_iff, ne_eq, ord_eq_zero] + exact IsRegular.ne_zero Fact.out + WellFoundedLT.toOrderBot _ + +include h₀ hA hY in +omit [PartialOrder X] in +lemma hasCardinalLT_transfiniteIterate_φ (j : κ₁.ord.ToType) : + HasCardinalLT (transfiniteIterate (φ Y m) j A :) κ₂ := by + induction j using SuccOrder.limitRecOn with + | isMin j hj => + letI := orderBot κ₁ + simpa [hj.eq_bot] + | succ j hj hj' => + have hκ₂ : κ₂.IsRegular := Fact.out + rw [transfiniteIterate_succ _ _ _ hj, φ_eq _ _ _ hj'] + refine hasCardinalLT_iUnion _ (hY _ _) + (fun ⟨C, hC⟩ ↦ hasCardinalLT_union hκ₂.aleph0_le ?_ + (hasCardinalLT_of_finite _ _ hκ₂.aleph0_le)) + refine (C.prop.of_le h₀.le).of_injective (fun ⟨c, hc⟩ ↦ ?_) + (fun c₁ c₂ hc ↦ ?_) + · simp only [Set.mem_image, Subtype.exists, exists_and_right, exists_eq_right] at hc + exact ⟨⟨c, hc.choose⟩, hc.choose_spec⟩ + · simpa only [Subtype.ext_iff] using hc + | isSuccLimit j hj hj' => + rw [transfiniteIterate_limit _ _ _ hj, Set.iSup_eq_iUnion] + refine hasCardinalLT_iUnion _ + (HasCardinalLT.of_injective ?_ _ Subtype.val_injective) (fun ⟨k, hk⟩ ↦ hj' _ hk) + simpa [hasCardinalLT_iff_cardinal_mk_lt] + +include hY' in +omit [Fact κ₂.IsRegular] [PartialOrder X] in +lemma monotone_transfiniteIterate_φ : + Monotone (fun (j : κ₁.ord.ToType) ↦ transfiniteIterate (φ Y m) j A) := + letI := orderBot κ₁ + monotone_transfiniteIterate _ _ (le_φ _ hY' _) + +omit [PartialOrder X] [Fact κ₂.IsRegular] in +lemma subset_iUnion : A ⊆ ⋃ (j : κ₁.ord.ToType), transfiniteIterate (φ Y m) j A := by + letI := orderBot κ₁ + exact subset_trans (by simp) (Set.subset_iUnion _ ⊥) + +include h₀ hY hY' hm hA in +lemma isCardinalFiltered_iUnion : + IsCardinalFiltered (⋃ (j : κ₁.ord.ToType), transfiniteIterate (φ Y m) j A) κ₁ := by + suffices ∀ ⦃K : Type w⦄ (j : κ₁.ord.ToType) (f : K → (transfiniteIterate (φ Y m) j A : Set _)) + (hK : HasCardinalLT K κ₁), + ∃ (x : (transfiniteIterate (φ Y m) (Order.succ j) A : Set _)), + ∀ (k : K), (f k).val ≤ x.val by + refine isCardinalFiltered_preorder _ _ (fun K f hK ↦ ?_) + rw [← hasCardinalLT_iff_cardinal_mk_lt] at hK + have (k : K) : ∃ (j : κ₁.ord.ToType), (f k).val ∈ transfiniteIterate (φ Y m) j A := by + simpa only [Set.mem_iUnion] using (f k).prop + choose a ha using this + obtain ⟨⟨z, hz⟩, hz'⟩ := this (IsCardinalFiltered.max a hK) (fun k ↦ + ⟨(f k).val, monotone_transfiniteIterate_φ Y hY' m A + (leOfHom (IsCardinalFiltered.toMax a hK k)) (ha k)⟩) hK + exact ⟨⟨z, Set.subset_iUnion _ _ hz⟩, hz'⟩ + intro K j f hK + have := hasCardinalLT_transfiniteIterate_φ h₀ Y hY m A + obtain ⟨⟨x, hx⟩, hx'⟩ := hφ₀ Y hY' m hm _ + (hasCardinalLT_transfiniteIterate_φ h₀ Y hY m A hA _) f hK + refine ⟨⟨x, ?_⟩, hx'⟩ + have : NoMaxOrder κ₁.ord.ToType := noMaxOrder (IsRegular.aleph0_le Fact.out) + rwa [transfiniteIterate_succ _ _ _ (not_isMax j), + φ_eq _ _ _ (hasCardinalLT_transfiniteIterate_φ h₀ Y hY m A hA _)] + +end existsIsCardinalFilteredSetOfExistsCofinal + +open existsIsCardinalFilteredSetOfExistsCofinal in +public lemma exists_isCardinalFiltered_set_of_exists_cofinal (h₀ : κ₁ < κ₂) + (h : ∀ (X : Type w) (_ : HasCardinalLT X κ₂), + ∃ (A : Set (SetCardinalLT κ₁ X)), HasCardinalLT A κ₂ ∧ IsCofinal A) + {X : Type w} [PartialOrder X] [IsCardinalFiltered X κ₁] + (A : Set X) (hA : HasCardinalLT A κ₂) : + ∃ (B : Set X), A ⊆ B ∧ IsCardinalFiltered B κ₁ ∧ HasCardinalLT B κ₂ := by + choose Y hY hY' using fun (B : Set X) hB ↦ h B hB + have hY'' (B : Set X) (hB : HasCardinalLT B κ₂) + (C : SetCardinalLT κ₁ B) (hC : C ∈ Y B hB) : + ∃ (m : X), ∀ (b : B), b ∈ C.val → b ≤ m := + ⟨IsCardinalFiltered.max (fun (c : C.val) ↦ c.val.val) C.prop, + fun b hb ↦ leOfHom (IsCardinalFiltered.toMax + (fun (c : C.val) ↦ c.val.val) C.prop ⟨_, hb⟩)⟩ + choose m hm using hY'' + exact ⟨_, subset_iUnion Y m A, + isCardinalFiltered_iUnion h₀ Y hY hY' m hm A hA, + hasCardinalLT_iUnion _ (by simpa [hasCardinalLT_iff_cardinal_mk_lt]) + (hasCardinalLT_transfiniteIterate_φ h₀ Y hY m A hA)⟩ + +end + +end SharplyLT + +end Cardinal From c8fc9efef8240825db327c50064716b9da83b3da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 23 Jun 2026 11:47:09 +0200 Subject: [PATCH 234/309] min_imports --- Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean | 2 -- 1 file changed, 2 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean index 861bc60ecef5e0..ac1c187aa30e99 100644 --- a/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean @@ -5,10 +5,8 @@ Authors: Joël Riou -/ module -public import Mathlib.CategoryTheory.ObjectProperty.ColimitsCardinalClosure public import Mathlib.CategoryTheory.Presentable.CardinalDirectedPoset public import Mathlib.CategoryTheory.Presentable.Dense -public import Mathlib.CategoryTheory.Presentable.Directed public import Mathlib.Order.TransfiniteIteration /-! From 8b12c8340b1a301b1cbb1e648cfb7b86633e4a2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 23 Jun 2026 12:00:17 +0200 Subject: [PATCH 235/309] docstring --- Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean index 8d11c5af453829..52c03d6e0bd03a 100644 --- a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean +++ b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean @@ -436,6 +436,8 @@ consisting of subsets of `X` of cardinality `< κ`. -/ abbrev SetCardinalLT := Subtype (fun (S : Set X) ↦ HasCardinalLT S κ) variable {X} in +/-- Given a regular cardinal `κ` and `x : X`, this is the singleton `{x}`, +considered as a subset of `X` of cardinality `< κ`. -/ abbrev SetCardinalLT.singleton (x : X) : SetCardinalLT κ X := ⟨{x}, hasCardinalLT_of_finite _ _ (Cardinal.IsRegular.aleph0_le Fact.out)⟩ From f0415c598b2be1fa193ef587851b051f84f2cd2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Wed, 24 Jun 2026 09:53:01 +0200 Subject: [PATCH 236/309] fix phrasing --- Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean index ac1c187aa30e99..d0302344fa48df 100644 --- a/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean @@ -14,7 +14,8 @@ public import Mathlib.Order.TransfiniteIteration In this file, we introduce the predicate `Cardinal.SharplyLT`. Given two regular cardinals `κ₁ < κ₂`, this condition can be described in different ways: -(i) the category `IsCardinalAccessibleCategory C κ₁` is `κ₂`-accessible; +(i) the category `CardinalFilteredPoset κ₁` (of `κ₁`-directed partially ordered + types, with order embeddings as morphisms), is `κ₂`-accessible; (ii) any `κ₁`-accessible category is `κ₂`-accessible. (iii) for any type `X` of cardinality `< κ₂`, there exists a cofinal set of cardinality `< κ₂` in the subtype of subsets of `X` of cardinality `< κ₁`; From 1d83224a54db9e060d62e21e7af3c54527e78b31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= <37772949+joelriou@users.noreply.github.com> Date: Wed, 24 Jun 2026 11:11:47 +0200 Subject: [PATCH 237/309] Update Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean Co-authored-by: smorel394 <67864981+smorel394@users.noreply.github.com> --- Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean index d0302344fa48df..0f1d4a57271d21 100644 --- a/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean @@ -39,7 +39,7 @@ namespace Cardinal variable {κ₁ κ₂ : Cardinal.{w}} [Fact κ₁.IsRegular] [Fact κ₂.IsRegular] variable (κ₁ κ₂) in -/-- If `κ₁ < κ₂` are two regular cardinal, we say that `κ₁` is sharply +/-- If `κ₁ < κ₂` are two regular cardinals, we say that `κ₁` is sharply smaller than `κ₂` if the category `CardinalFilteredPoset κ₁` is `κ₂`-accessible. There are other characterizations (TODO @joelriou), including the property that any `κ₁`-accessible category is From 23f907e62d8025d15fbc71b4c8968d34e9e5d159 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Wed, 24 Jun 2026 11:37:50 +0200 Subject: [PATCH 238/309] renames --- .../Presentable/CardinalDirectedPoset.lean | 142 ++++++++++++------ .../Presentable/SharplyLT/Basic.lean | 20 +-- 2 files changed, 106 insertions(+), 56 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean index 52c03d6e0bd03a..d1dad58cbdf7b1 100644 --- a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean +++ b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean @@ -13,12 +13,16 @@ public import Mathlib.Order.Category.PartOrdEmb # The κ-accessible category of κ-directed posets Given a regular cardinal `κ : Cardinal.{u}`, we define the -category `CardinalFilteredPoset κ` of `κ`-directed partially ordered +category `CardinalDirectedPoset κ` of `κ`-directed partially ordered types (with order embeddings as morphisms), and we show that it is a `κ`-accessible category. +The notion of `κ`-directed partially ordered type is implemented +using the categorial notion `IsCardinalFiltered`: we may consider +"`κ`-directed" and "`κ`-filtered" as synonyms. + If `κ ≤ κ'` where `κ'` is also a regular cardinal, we characterize -the `κ'`-presentable objects of `CardinalFilteredPoset κ` as +the `κ'`-presentable objects of `CardinalDirectedPoset κ` as the objects `J` such that the underlying type `J.obj` has cardinality `< κ'`. @@ -38,7 +42,10 @@ namespace PartOrdEmb variable (κ : Cardinal.{u}) [Fact κ.IsRegular] /-- The property of objects in `PartOrdEmb` that are -satisfied by partially ordered types of cardinality `< κ`. -/ +satisfied by `κ`-directed partially ordered types. +(Note: for partially ordered types, "`κ`-directed" and +"`κ`-filtered" are synonyms. This is implemented using the +categorical notion `IsCardinalFiltered`.) -/ abbrev isCardinalFiltered : ObjectProperty PartOrdEmb.{u} := fun X ↦ IsCardinalFiltered X κ @@ -91,78 +98,78 @@ namespace CategoryTheory variable (κ : Cardinal.{u}) [Fact κ.IsRegular] /-- The category of `κ`-filtered partially ordered types, -with morphisms given by order embeddings. -/ -abbrev CardinalFilteredPoset := +with morphisms given by order embeddings. () -/ +abbrev CardinalDirectedPoset := (PartOrdEmb.isCardinalFiltered κ).FullSubcategory variable {κ} -/-- The embedding of the category of `κ`-filtered +/-- The embedding of the category of `κ`-directed partially ordered types in the category of partially ordered types. -/ -abbrev CardinalFilteredPoset.ι : CardinalFilteredPoset κ ⥤ PartOrdEmb := +abbrev CardinalDirectedPoset.ι : CardinalDirectedPoset κ ⥤ PartOrdEmb := ObjectProperty.ι _ -namespace CardinalFilteredPoset +namespace CardinalDirectedPoset /-- Constructor for objects in `CardinalFilteredPoset κ`. -/ -abbrev of (J : PartOrdEmb.{u}) [IsCardinalFiltered J κ] : CardinalFilteredPoset κ where +abbrev of (J : PartOrdEmb.{u}) [IsCardinalFiltered J κ] : CardinalDirectedPoset κ where obj := J property := inferInstance -lemma Hom.injective {J₁ J₂ : CardinalFilteredPoset κ} (f : J₁ ⟶ J₂) : +lemma Hom.injective {J₁ J₂ : CardinalDirectedPoset κ} (f : J₁ ⟶ J₂) : Function.Injective f := f.hom.injective -lemma Hom.le_iff_le {J₁ J₂ : CardinalFilteredPoset κ} (f : J₁ ⟶ J₂) (x₁ x₂ : J₁.obj) : +lemma Hom.le_iff_le {J₁ J₂ : CardinalDirectedPoset κ} (f : J₁ ⟶ J₂) (x₁ x₂ : J₁.obj) : f x₁ ≤ f x₂ ↔ x₁ ≤ x₂ := f.hom.hom.le_iff_le -instance (J : CardinalFilteredPoset κ) : IsCardinalFiltered J.obj κ := J.property +instance (J : CardinalDirectedPoset κ) : IsCardinalFiltered J.obj κ := J.property -instance (J : CardinalFilteredPoset κ) : IsFiltered J.obj := +instance (J : CardinalDirectedPoset κ) : IsFiltered J.obj := isFiltered_of_isCardinalFiltered _ κ -instance (J : CardinalFilteredPoset κ) : Nonempty J.obj := IsFiltered.nonempty +instance (J : CardinalDirectedPoset κ) : Nonempty J.obj := IsFiltered.nonempty -instance : HasCardinalFilteredColimits (CardinalFilteredPoset κ) κ where +instance : HasCardinalFilteredColimits (CardinalDirectedPoset κ) κ where hasColimitsOfShape J _ _ := by have := isFiltered_of_isCardinalFiltered J κ infer_instance instance (A : Type u) [SmallCategory A] [IsCardinalFiltered A κ] : - PreservesColimitsOfShape A (forget (CardinalFilteredPoset κ)) := by + PreservesColimitsOfShape A (forget (CardinalDirectedPoset κ)) := by have := isFiltered_of_isCardinalFiltered A κ - change PreservesColimitsOfShape A (CardinalFilteredPoset.ι ⋙ forget _) + change PreservesColimitsOfShape A (CardinalDirectedPoset.ι ⋙ forget _) infer_instance -instance (J : CardinalFilteredPoset κ) (κ' : Cardinal.{u}) [Fact κ'.IsRegular] : +instance (J : CardinalDirectedPoset κ) (κ' : Cardinal.{u}) [Fact κ'.IsRegular] : IsCardinalFiltered (WithTop (J.obj)) κ' := isCardinalFiltered_of_hasTerminal _ _ -/-- The map `CardinalFilteredPoset κ → CardinalFilteredPoset κ` which sends +/-- The map `CardinalDirectedPoset κ → CardinalDirectedPoset κ` which sends a partially ordered `κ`-filtered type `J` to `WithTop J`. -/ -abbrev withTop (J : CardinalFilteredPoset κ) : CardinalFilteredPoset κ := +abbrev withTop (J : CardinalDirectedPoset κ) : CardinalDirectedPoset κ := .of (.of (WithTop J.obj)) section -variable {J : CardinalFilteredPoset κ} (P : Set J.obj → Prop) +variable {J : CardinalDirectedPoset κ} (P : Set J.obj → Prop) [IsDirectedOrder (Subtype P)] [Nonempty (Subtype P)] [∀ (S : Subtype P), IsCardinalFiltered S.val κ] set_option backward.defeqAttrib.useBackward true in /-- Given a predicate `P : Set J.obj → Prop` on the underlying type -of `J : CardinalFilteredPoset κ` such that all the subsets satisfying `P` -are `κ`-filtered, this is the functor `Subtype P ⥤ CardinalFilteredPoset κ` +of `J : CardinalDirectedPoset κ` such that all the subsets satisfying `P` +are `κ`-filtered, this is the functor `Subtype P ⥤ CardinalDirectedPoset κ` which sends a subset `S` of `J` satisfying `P` to the induced -partially ordered type `J`, as an object in `CardinalFilteredPoset κ`. -/ +partially ordered type `J`, as an object in `CardinalDirectedPoset κ`. -/ @[simps!] -def functorOfPredicateSet : Subtype P ⥤ CardinalFilteredPoset κ := +def functorOfPredicateSet : Subtype P ⥤ CardinalDirectedPoset κ := ObjectProperty.lift _ (PartOrdEmb.functorOfPredicateSet P) (fun S ↦ by dsimp; infer_instance) /-- Given a predicate `P : Set J.obj → Prop` on the underlying type -of `J : CardinalFilteredPoset κ` such that all the subsets satisfying `P` +of `J : CardinalDirectedPoset κ` such that all the subsets satisfying `P` are `κ`-filtered, this is the cocone with point `J` given by all the inclusions of the subsets satisfying `P`. -/ @[simps] @@ -170,22 +177,22 @@ def coconeOfPredicateSet : Cocone (functorOfPredicateSet P) where pt := J ι.app j := ObjectProperty.homMk ((PartOrdEmb.coconeOfPredicateSet P).ι.app j) -/-- Let `P` be a predicate on `Set J.obj` where `J : CardinalFilteredPoset κ`. +/-- Let `P` be a predicate on `Set J.obj` where `J : CardinalDirectedPoset κ`. We assume that `Subtype P` is directed and nonempty, and that any `a : J.obj` belongs to some `S : Set J.obj` satisfying `P`. Then, `J` is the colimit in the -category `CardinalFilteredPoset κ` of these subsets. -/ +category `CardinalDirectedPoset κ` of these subsets. -/ noncomputable def isColimitCoconeOfPredicateSet (hP : ∀ (a : J.obj), ∃ (S : Set J.obj), P S ∧ a ∈ S) : IsColimit (coconeOfPredicateSet P) := - isColimitOfReflects CardinalFilteredPoset.ι + isColimitOfReflects CardinalDirectedPoset.ι (PartOrdEmb.isColimitOfPredicateSet P hP) end variable (κ) in -/-- The property of posets in `CardinalFilteredPoset κ` that are +/-- The property of posets in `CardinalDirectedPoset κ` that are of cardinality `< κ` and have terminal object. -/ -def hasCardinalLTWithTerminal : ObjectProperty (CardinalFilteredPoset κ) := +def hasCardinalLTWithTerminal : ObjectProperty (CardinalDirectedPoset κ) := fun J ↦ HasCardinalLT J.obj κ ∧ HasTerminal J.obj instance : ObjectProperty.EssentiallySmall.{u} (hasCardinalLTWithTerminal κ) where @@ -194,7 +201,7 @@ instance : ObjectProperty.EssentiallySmall.{u} (hasCardinalLTWithTerminal κ) wh let α : Type u := Σ (S : Set X) (_ : PartialOrder S), ULift.{u} (PLift (IsCardinalFiltered S κ)) let (a : α) : PartialOrder a.1 := a.2.1 - let ι (a : α) : CardinalFilteredPoset κ := + let ι (a : α) : CardinalDirectedPoset κ := { obj := .of a.1 property := a.2.2.down.down } refine ⟨.ofObj ι, inferInstance, fun J ⟨hJ, _⟩ ↦ ?_⟩ @@ -205,11 +212,11 @@ instance : ObjectProperty.EssentiallySmall.{u} (hasCardinalLTWithTerminal κ) wh let e' : Set.range f ≃o J.obj := { toEquiv := e.symm, map_rel_iff' := by rfl } exact ⟨_, ⟨⟨Set.range f, inferInstance, ⟨⟨IsCardinalFiltered.of_equivalence κ e'.symm.equivalence⟩⟩⟩⟩, - ⟨CardinalFilteredPoset.ι.preimageIso (PartOrdEmb.Iso.mk (by exact e'.symm))⟩⟩ + ⟨CardinalDirectedPoset.ι.preimageIso (PartOrdEmb.Iso.mk (by exact e'.symm))⟩⟩ set_option backward.defeqAttrib.useBackward true in set_option backward.isDefEq.respectTransparency false in -lemma isCardinalPresentable_of_hasCardinalLT_of_le (J : CardinalFilteredPoset κ) +lemma isCardinalPresentable_of_hasCardinalLT_of_le (J : CardinalDirectedPoset κ) {κ' : Cardinal.{u}} [Fact κ'.IsRegular] (hJ : HasCardinalLT J.obj κ') (h : κ ≤ κ') : IsCardinalPresentable J κ' where preservesColimitOfShape A _ _ := ⟨fun {F} ↦ ⟨fun {c} hc ↦ ⟨by @@ -255,7 +262,7 @@ lemma isCardinalPresentable_of_hasCardinalLT_of_le (J : CardinalFilteredPoset κ section -variable (J : CardinalFilteredPoset κ) +variable (J : CardinalDirectedPoset κ) -- `@[nolint unusedArguments]` allows to setup some instances which uses -- the fact that `κ'` is regular. @@ -314,7 +321,7 @@ colimit of its subsets that are of cardinality `< κ'` and contain `⊤`. -/ abbrev coconeWithTop : Cocone (functorOfPredicateSet (J.PropSetWithTop κ')) := coconeOfPredicateSet (PropSetWithTop J κ') -/-- If `J : CardinalFilteredPoset κ` and `κ'` is any regular cardinal, +/-- If `J : CardinalDirectedPoset κ` and `κ'` is any regular cardinal, then `J.withTop` is the `κ'`-filtered colimit of its subsets that are of cardinality `< κ'` and contain `⊤`. -/ noncomputable def isColimitCoconeWithTop : IsColimit (coconeWithTop J κ') := @@ -341,15 +348,15 @@ protected lemma isCardinalPresentable_iff (h : κ ≤ κ') : end -protected lemma isCardinalPresentable_iff' (J : CardinalFilteredPoset κ) : +protected lemma isCardinalPresentable_iff' (J : CardinalDirectedPoset κ) : IsCardinalPresentable J κ ↔ HasCardinalLT J.obj κ := - CardinalFilteredPoset.isCardinalPresentable_iff _ (le_refl _) + CardinalDirectedPoset.isCardinalPresentable_iff _ (le_refl _) section -variable (J : CardinalFilteredPoset κ) +variable (J : CardinalDirectedPoset κ) -/-- Given `J : CardinalFilteredPoset κ`, this is the predicate +/-- Given `J : CardinalDirectedPoset κ`, this is the predicate on `Set J.obj` that is satisfied by subsets that are of cardinality `< κ` and have a terminal object. -/ def PropSet (S : Set J.obj) : Prop := @@ -397,15 +404,15 @@ instance : IsDirectedOrder (Subtype J.PropSet) := instance : Nonempty (Subtype J.PropSet) := IsFiltered.nonempty -/-- For any object `J : CardinalFilteredPoset κ`, this is a colimit +/-- For any object `J : CardinalDirectedPoset κ`, this is a colimit cocone exhibiting `J` as the colimit of its subsets that are of cardinality `< κ` and have a terminal object. -/ abbrev cocone : Cocone (functorOfPredicateSet J.PropSet) := coconeOfPredicateSet J.PropSet -/-- Any object `J : CardinalFilteredPoset κ` is a colimit +/-- Any object `J : CardinalDirectedPoset κ` is a colimit of its subsets that are of cardinality `< κ` and have a terminal object. -/ -noncomputable def isColimitCocone (J : CardinalFilteredPoset κ) : +noncomputable def isColimitCocone (J : CardinalDirectedPoset κ) : IsColimit (cocone J) := isColimitCoconeOfPredicateSet _ (fun a ↦ ⟨_, propSet_singleton a, by simp⟩) @@ -424,7 +431,7 @@ lemma isCardinalFilteredGenerator_hasCardinalLTWithTerminal : isColimit := isColimitCocone J prop_diag_obj j := j.prop }⟩⟩ -instance : IsCardinalAccessibleCategory (CardinalFilteredPoset κ) κ where +instance : IsCardinalAccessibleCategory (CardinalDirectedPoset κ) κ where exists_generator := ⟨hasCardinalLTWithTerminal κ, inferInstance, isCardinalFilteredGenerator_hasCardinalLTWithTerminal κ⟩ @@ -450,10 +457,53 @@ instance : IsCardinalFiltered (SetCardinalLT κ X) κ := /-- Given a regular cardinal `κ` and a type `X`, this is the `κ`-filtered partially ordered type of subsets of `X` of cardinality `< κ`, -as an object of the category `CardinalFilteredPoset κ`. -/ -abbrev setCardinalLT : CardinalFilteredPoset κ := +as an object of the category `CardinalDirectedPoset κ`. -/ +abbrev setCardinalLT : CardinalDirectedPoset κ := .of (PartOrdEmb.of (SetCardinalLT κ X)) +end CardinalDirectedPoset + +@[deprecated (since := "2026-06-24")] alias CardinalFilteredPoset := + CardinalDirectedPoset + +namespace CardinalFilteredPoset + +@[deprecated (since := "2026-06-24")] alias ι := CardinalDirectedPoset.ι +@[deprecated (since := "2026-06-24")] alias of := CardinalDirectedPoset.of +@[deprecated (since := "2026-06-24")] alias Hom.injective := CardinalDirectedPoset.Hom.injective +@[deprecated (since := "2026-06-24")] alias Hom.le_iff_le := CardinalDirectedPoset.Hom.le_iff_le +@[deprecated (since := "2026-06-24")] alias withTop := CardinalDirectedPoset.withTop +@[deprecated (since := "2026-06-24")] +alias functorOfPredicateSet := CardinalDirectedPoset.functorOfPredicateSet +@[deprecated (since := "2026-06-24")] +alias coconeOfPredicateSet := CardinalDirectedPoset.coconeOfPredicateSet +@[deprecated (since := "2026-06-24")] +alias isColimitCoconeOfPredicateSet := CardinalDirectedPoset.isColimitCoconeOfPredicateSet +@[deprecated (since := "2026-06-24")] +alias hasCardinalLTWithTerminal := CardinalDirectedPoset.hasCardinalLTWithTerminal +@[deprecated (since := "2026-06-24")] +alias isCardinalPresentable_of_hasCardinalLT_of_le := + CardinalDirectedPoset.isCardinalPresentable_of_hasCardinalLT_of_le +@[deprecated (since := "2026-06-24")] +alias PropSetWithTop := CardinalDirectedPoset.PropSetWithTop +@[deprecated (since := "2026-06-24")] +alias propSetWithTop_pair := CardinalDirectedPoset.propSetWithTop_pair +@[deprecated (since := "2026-06-24")] +alias exists_mem_propSetWithTop := CardinalDirectedPoset.exists_mem_propSetWithTop +@[deprecated (since := "2026-06-24")] +alias coconeWithTop := CardinalDirectedPoset.coconeWithTop +@[deprecated (since := "2026-06-24")] +alias isColimitCoconeWithTop := CardinalDirectedPoset.isColimitCoconeWithTop +@[deprecated (since := "2026-06-24")] +alias isCardinalPresentable_iff := CardinalDirectedPoset.isCardinalPresentable_iff +@[deprecated (since := "2026-06-24")] +alias isCardinalPresentable_iff' := CardinalDirectedPoset.isCardinalPresentable_iff' +@[deprecated (since := "2026-06-24")] alias PropSet := CardinalDirectedPoset.PropSet +@[deprecated (since := "2026-06-24")] +alias propSet_singleton := CardinalDirectedPoset.propSet_singleton +@[deprecated (since := "2026-06-24")] alias cocone := CardinalDirectedPoset.cocone +@[deprecated (since := "2026-06-24")] alias isColimitCocone := CardinalDirectedPoset.isColimitCocone + end CardinalFilteredPoset end CategoryTheory diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean index 0f1d4a57271d21..5c7095c7461b73 100644 --- a/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean @@ -14,7 +14,7 @@ public import Mathlib.Order.TransfiniteIteration In this file, we introduce the predicate `Cardinal.SharplyLT`. Given two regular cardinals `κ₁ < κ₂`, this condition can be described in different ways: -(i) the category `CardinalFilteredPoset κ₁` (of `κ₁`-directed partially ordered +(i) the category `CardinalDirectedPoset κ₁` (of `κ₁`-directed partially ordered types, with order embeddings as morphisms), is `κ₂`-accessible; (ii) any `κ₁`-accessible category is `κ₂`-accessible. (iii) for any type `X` of cardinality `< κ₂`, there exists a cofinal set of @@ -40,33 +40,33 @@ variable {κ₁ κ₂ : Cardinal.{w}} [Fact κ₁.IsRegular] [Fact κ₂.IsRegul variable (κ₁ κ₂) in /-- If `κ₁ < κ₂` are two regular cardinals, we say that `κ₁` is sharply -smaller than `κ₂` if the category `CardinalFilteredPoset κ₁` +smaller than `κ₂` if the category `CardinalDirectedPoset κ₁` is `κ₂`-accessible. There are other characterizations (TODO @joelriou), including the property that any `κ₁`-accessible category is also `κ₂`-accessible. -/ public structure SharplyLT : Prop where lt : κ₁ < κ₂ isCardinalAccessible_cardinalDirectedPoset : - IsCardinalAccessibleCategory (CardinalFilteredPoset κ₁) κ₂ + IsCardinalAccessibleCategory (CardinalDirectedPoset κ₁) κ₂ namespace SharplyLT public lemma le (h : SharplyLT κ₁ κ₂) : κ₁ ≤ κ₂ := h.lt.le set_option backward.defeqAttrib.useBackward true in -open CardinalFilteredPoset in -public lemma exists_cofinal_of_isCardinalAccessibleCategory_cardinalFilteredPoset - (h : κ₁ ≤ κ₂) [IsCardinalAccessibleCategory (CardinalFilteredPoset κ₁) κ₂] +open CardinalDirectedPoset in +public lemma exists_cofinal_of_isCardinalAccessibleCategory_cardinalDirectedPoset + (h : κ₁ ≤ κ₂) [IsCardinalAccessibleCategory (CardinalDirectedPoset κ₁) κ₂] {X : Type w} (hX : HasCardinalLT X κ₂) : ∃ (A : Set (SetCardinalLT κ₁ X)), HasCardinalLT A κ₂ ∧ IsCofinal A := by obtain ⟨J, _, _, ⟨p⟩⟩ := (isCardinalFilteredGenerator_isCardinalPresentable - (CardinalFilteredPoset κ₁) κ₂).exists_colimitsOfShape (setCardinalLT κ₁ X) + (CardinalDirectedPoset κ₁) κ₂).exists_colimitsOfShape (setCardinalLT κ₁ X) have : IsCardinalFiltered J κ₁ := .of_le _ h have hp (j : J) : HasCardinalLT (p.diag.obj j).obj κ₂ := by - rw [← CardinalFilteredPoset.isCardinalPresentable_iff _ h] + rw [← CardinalDirectedPoset.isCardinalPresentable_iff _ h] exact p.prop_diag_obj j choose j y hy using fun x ↦ Types.jointly_surjective_of_isColimit - (isColimitOfPreserves (forget (CardinalFilteredPoset κ₁)) p.isColimit) + (isColimitOfPreserves (forget (CardinalDirectedPoset κ₁)) p.isColimit) (SetCardinalLT.singleton κ₁ x) dsimp at y hy let j' := IsCardinalFiltered.max j hX @@ -86,7 +86,7 @@ public lemma exists_cofinal_of_isCardinalAccessibleCategory_cardinalFilteredPose section -open CardinalFilteredPoset +open CardinalDirectedPoset namespace existsIsCardinalFilteredSetOfExistsCofinal From 9a32e8aad1ef478d54a4bafeffbbf7c1fcc1241e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Wed, 24 Jun 2026 11:41:14 +0200 Subject: [PATCH 239/309] added docstring --- Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean index 5c7095c7461b73..98d7d156d64e15 100644 --- a/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean @@ -90,6 +90,10 @@ open CardinalDirectedPoset namespace existsIsCardinalFilteredSetOfExistsCofinal +/-! The definitions in this section are part of the proof of the +lemma `exists_isCardinalFiltered_set_of_exists_cofinal` below. +-/ + variable (h₀ : κ₁ < κ₂) {X : Type w} [PartialOrder X] (Y : ∀ (B : Set X) (_ : HasCardinalLT B κ₂), Set (SetCardinalLT κ₁ B)) From c666158a83f4c3c5221e5475d5e6c41e4ed6d6e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 25 Jun 2026 11:15:37 +0200 Subject: [PATCH 240/309] added docstrings --- .../Presentable/SharplyLT/Basic.lean | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean index 98d7d156d64e15..de7bc30ce83393 100644 --- a/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean @@ -55,20 +55,30 @@ public lemma le (h : SharplyLT κ₁ κ₂) : κ₁ ≤ κ₂ := h.lt.le set_option backward.defeqAttrib.useBackward true in open CardinalDirectedPoset in +/-- This is the implication (i) → (iii) in the characterizations +of `SharplyLT κ₁ κ₂` in the docstring of this file. -/ public lemma exists_cofinal_of_isCardinalAccessibleCategory_cardinalDirectedPoset (h : κ₁ ≤ κ₂) [IsCardinalAccessibleCategory (CardinalDirectedPoset κ₁) κ₂] {X : Type w} (hX : HasCardinalLT X κ₂) : ∃ (A : Set (SetCardinalLT κ₁ X)), HasCardinalLT A κ₂ ∧ IsCofinal A := by + -- We write the partially ordered type `setCardinalLT κ₁ X` of subsets + -- of `X` of cardinality `< κ₁` as a `κ₂`-filtered colimit (with index + -- category `J`) of `κ₂`-presentable objects (i.e. partially ordered + -- types of cardinality `< κ₂`.) obtain ⟨J, _, _, ⟨p⟩⟩ := (isCardinalFilteredGenerator_isCardinalPresentable (CardinalDirectedPoset κ₁) κ₂).exists_colimitsOfShape (setCardinalLT κ₁ X) have : IsCardinalFiltered J κ₁ := .of_le _ h have hp (j : J) : HasCardinalLT (p.diag.obj j).obj κ₂ := by rw [← CardinalDirectedPoset.isCardinalPresentable_iff _ h] exact p.prop_diag_obj j + -- For each `x : X`, we choose `j : J` in such a way that the singleton + -- `{x}` belongs to the image of `p.diag.obj j`. choose j y hy using fun x ↦ Types.jointly_surjective_of_isColimit (isColimitOfPreserves (forget (CardinalDirectedPoset κ₁)) p.isColimit) (SetCardinalLT.singleton κ₁ x) dsimp at y hy + -- The expected cofinal set `A` will be the range of `p.ι.app j'` + -- where `j' : J` is such that for any `x : X`, there is a map `j x ⟶ j'` let j' := IsCardinalFiltered.max j hX let y' (x : X) : (p.diag.obj j').obj := p.diag.map (IsCardinalFiltered.toMax j hX x) (y x) @@ -91,8 +101,9 @@ open CardinalDirectedPoset namespace existsIsCardinalFilteredSetOfExistsCofinal /-! The definitions in this section are part of the proof of the -lemma `exists_isCardinalFiltered_set_of_exists_cofinal` below. --/ +lemma `exists_isCardinalFiltered_set_of_exists_cofinal` below, +which is the implication (iii) → (iv) in the characterizations +of `Sharply κ₁ κ₂` which appear in the docstring of this file. -/ variable (h₀ : κ₁ < κ₂) {X : Type w} [PartialOrder X] @@ -212,6 +223,8 @@ lemma isCardinalFiltered_iUnion : end existsIsCardinalFilteredSetOfExistsCofinal open existsIsCardinalFilteredSetOfExistsCofinal in +/-- This is the implication (iii) → (iv) in the characterizations +of `SharplyLT κ₁ κ₂` in the docstring of this file. -/ public lemma exists_isCardinalFiltered_set_of_exists_cofinal (h₀ : κ₁ < κ₂) (h : ∀ (X : Type w) (_ : HasCardinalLT X κ₂), ∃ (A : Set (SetCardinalLT κ₁ X)), HasCardinalLT A κ₂ ∧ IsCofinal A) From 1aae6a530d9ee9cf27c1b5c307fc153bc22be5e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 25 Jun 2026 11:38:54 +0200 Subject: [PATCH 241/309] added comments --- .../Presentable/SharplyLT/Basic.lean | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean index de7bc30ce83393..df924ecd0b1ffa 100644 --- a/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean @@ -60,7 +60,7 @@ of `SharplyLT κ₁ κ₂` in the docstring of this file. -/ public lemma exists_cofinal_of_isCardinalAccessibleCategory_cardinalDirectedPoset (h : κ₁ ≤ κ₂) [IsCardinalAccessibleCategory (CardinalDirectedPoset κ₁) κ₂] {X : Type w} (hX : HasCardinalLT X κ₂) : - ∃ (A : Set (SetCardinalLT κ₁ X)), HasCardinalLT A κ₂ ∧ IsCofinal A := by + ∃ (Y : Set (SetCardinalLT κ₁ X)), HasCardinalLT Y κ₂ ∧ IsCofinal Y := by -- We write the partially ordered type `setCardinalLT κ₁ X` of subsets -- of `X` of cardinality `< κ₁` as a `κ₂`-filtered colimit (with index -- category `J`) of `κ₂`-presentable objects (i.e. partially ordered @@ -107,17 +107,28 @@ of `Sharply κ₁ κ₂` which appear in the docstring of this file. -/ variable (h₀ : κ₁ < κ₂) {X : Type w} [PartialOrder X] + -- The variables `Y`, `hY` and `hY'` below can be obtained by applying + -- the `choose` tactic to an assumption of the form + -- `∃ (Y : Set (SetCardinalLT κ₁ X)), HasCardinalLT Y κ₂ ∧ IsCofinal Y)` + -- e.g. when the condition (iii) in the docstring of this file is satisfied (Y : ∀ (B : Set X) (_ : HasCardinalLT B κ₂), Set (SetCardinalLT κ₁ B)) (hY : ∀ (B : Set X) (hB : HasCardinalLT B κ₂), HasCardinalLT (Y B hB) κ₂) (hY' : ∀ (B : Set X) (hB : HasCardinalLT B κ₂), IsCofinal (Y B hB)) + -- In the proof of `exists_isCardinalFiltered_set_of_exists_cofinal` below, + -- we shall show that we can find such `m` and `hm`, i.e. + -- for any `B : Set X`, `hB : HasCardinalLT B κ₂`, `C : SetCardinalLT κ₁ B`, + -- if `C ∈ Y B hB`, then there exists `m : X` such that all the elements + -- of `C` are less than or equal to `m`. (m : ∀ (B : Set X) (hB : HasCardinalLT B κ₂) (C : SetCardinalLT κ₁ B), C ∈ Y B hB → X) (hm : ∀ (B : Set X) (hB : HasCardinalLT B κ₂) (C : SetCardinalLT κ₁ B) (hC : C ∈ Y B hB) (b : B), b ∈ C.val → b ≤ m B hB C hC) (A : Set X) (hA : HasCardinalLT A κ₂) +/-- The subset of `X` given by the union over all `C : Y B hB` of +`C` and `{m B hB C _}`. -/ def φ₀ (B : Set X) (hB : HasCardinalLT B κ₂) : Set X := - ⋃ (C : Y B hB), Subtype.val '' C.val.val ∪ {m B hB _ C.prop} + ⋃ (C : Y B hB), Subtype.val '' C.val.val ∪ {m B hB C C.prop} omit [Fact κ₁.IsRegular] [Fact κ₂.IsRegular] in include hY' hm in @@ -131,6 +142,7 @@ lemma hφ₀ (B : Set X) (hB : HasCardinalLT B κ₂) {T : Type w} (f : T → B) fun t ↦ hm B hB C hC (f t) (hC' (by simp [C₀]))⟩ open Classical in +/-- This coincides with `φ₀` when `HasCardinalLT B κ₂` holds. -/ def φ (B : Set X) : Set X := if hB : HasCardinalLT B κ₂ then φ₀ Y m B hB else B @@ -160,6 +172,8 @@ noncomputable abbrev orderBot : OrderBot κ₁.ord.ToType := include h₀ hA hY in omit [PartialOrder X] in +/-- By iterating `φ` to the power `j : κ₁.ord.ToType` and evaluating +on `A`, we get a subset that is of cardinality `< κ₂`. -/ lemma hasCardinalLT_transfiniteIterate_φ (j : κ₁.ord.ToType) : HasCardinalLT (transfiniteIterate (φ Y m) j A :) κ₂ := by induction j using SuccOrder.limitRecOn with @@ -227,7 +241,7 @@ open existsIsCardinalFilteredSetOfExistsCofinal in of `SharplyLT κ₁ κ₂` in the docstring of this file. -/ public lemma exists_isCardinalFiltered_set_of_exists_cofinal (h₀ : κ₁ < κ₂) (h : ∀ (X : Type w) (_ : HasCardinalLT X κ₂), - ∃ (A : Set (SetCardinalLT κ₁ X)), HasCardinalLT A κ₂ ∧ IsCofinal A) + ∃ (Y : Set (SetCardinalLT κ₁ X)), HasCardinalLT Y κ₂ ∧ IsCofinal Y) {X : Type w} [PartialOrder X] [IsCardinalFiltered X κ₁] (A : Set X) (hA : HasCardinalLT A κ₂) : ∃ (B : Set X), A ⊆ B ∧ IsCardinalFiltered B κ₁ ∧ HasCardinalLT B κ₂ := by @@ -239,7 +253,10 @@ public lemma exists_isCardinalFiltered_set_of_exists_cofinal (h₀ : κ₁ < κ fun b hb ↦ leOfHom (IsCardinalFiltered.toMax (fun (c : C.val) ↦ c.val.val) C.prop ⟨_, hb⟩)⟩ choose m hm using hY'' - exact ⟨_, subset_iUnion Y m A, + -- The expected subset `B` is obtained as the union over + -- all `j : κ₁.ord.ToType` of the transfinite iterations + -- of the map `φ` + exact ⟨⋃ j, transfiniteIterate (φ Y m) j A, subset_iUnion Y m A, isCardinalFiltered_iUnion h₀ Y hY hY' m hm A hA, hasCardinalLT_iUnion _ (by simpa [hasCardinalLT_iff_cardinal_mk_lt]) (hasCardinalLT_transfiniteIterate_φ h₀ Y hY m A hA)⟩ From e8af20d18605ff244016ccc154d92f3cb7d70cd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 26 Jun 2026 09:43:58 +0200 Subject: [PATCH 242/309] fix --- Mathlib.lean | 1 - .../Presentable/ParallelMaps.lean | 89 ------------------- 2 files changed, 90 deletions(-) delete mode 100644 Mathlib/CategoryTheory/Presentable/ParallelMaps.lean diff --git a/Mathlib.lean b/Mathlib.lean index 3cb61878dbd70f..38bfc2b2e0d392 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -3274,7 +3274,6 @@ public import Mathlib.CategoryTheory.Presentable.IsCardinalFiltered public import Mathlib.CategoryTheory.Presentable.Limits public import Mathlib.CategoryTheory.Presentable.LocallyPresentable public import Mathlib.CategoryTheory.Presentable.OrthogonalReflection -public import Mathlib.CategoryTheory.Presentable.ParallelMaps public import Mathlib.CategoryTheory.Presentable.Presheaf public import Mathlib.CategoryTheory.Presentable.Retracts public import Mathlib.CategoryTheory.Presentable.StrongGenerator diff --git a/Mathlib/CategoryTheory/Presentable/ParallelMaps.lean b/Mathlib/CategoryTheory/Presentable/ParallelMaps.lean deleted file mode 100644 index 718a706dd0bfbb..00000000000000 --- a/Mathlib/CategoryTheory/Presentable/ParallelMaps.lean +++ /dev/null @@ -1,89 +0,0 @@ -/- -Copyright (c) 2024 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.Comma.Arrow -import Mathlib.SetTheory.Cardinal.HasCardinalLT - -/-! -# The category ParallelMaps - -Given a type `T`, we introduce a category with two objects `zero` and `one`, -such that `(zero ⟶ one) ≃ T`, and other morphisms are identities. - -This category is used in order to show that it is possible to coequalize -a suitable family of morphisms in a `κ`-filtered category -(see `CategoryTheory.Presentable.IsCardinalFiltered`.) - --/ - -universe w v u u₀ - -namespace CategoryTheory - -/-- Given a type `T`, which is the category with two objects `zero` and `one`, -such that `(zero ⟶ one) ≃ T`, and other morphisms are identities. -/ -inductive ParallelMaps (T : Type u₀) : Type - | zero - | one - -namespace ParallelMaps - -variable {T : Type u₀} - -/-- The type of morphisms in the category `ParallelMaps T`: identities, and morphisms -`zero ⟶ one` attached to any `t : T`. -/ -inductive Hom : ParallelMaps T → ParallelMaps T → Type u₀ - | id (X : ParallelMaps T) : Hom X X - | map (t : T) : Hom zero one - -/-- The composition of morphisms in the category `ParallelMaps T`. -/ -def Hom.comp : ∀ {X Y Z : ParallelMaps T}, Hom X Y → Hom Y Z → Hom X Z - | _, _, _, id _, g => g - | _, _, _, f, id _ => f - -instance : Category (ParallelMaps T) where - Hom := Hom - id := Hom.id - comp := Hom.comp - id_comp := by rintro _ _ (_ | _); all_goals rfl - comp_id := by rintro _ _ (_ | _); all_goals rfl - assoc := by rintro _ _ _ _ (_ | _) (_ | _) (_ | _); all_goals rfl - -/-- Constructor for functors from the category `ParallelMaps T`. -/ -@[simps] -def mkFunctor {C : Type u} [Category.{v} C] {X Y : C} (f : T → (X ⟶ Y)) : - ParallelMaps T ⥤ C where - obj a := match a with - | zero => X - | one => Y - map φ := match φ with - | .id _ => 𝟙 _ - | .map t => f t - map_comp := by - rintro _ _ _ (_ | _) (_ | _) <;> simp <;> rfl - -variable (T) in -/-- `Arrow (ParallelMaps T)` identify to the type obtained by adding two elements to `T`. -/ -def arrowEquiv : Arrow (ParallelMaps T) ≃ Option (Option T) where - toFun f := match f.left, f.right, f.hom with - | zero, _, .id _ => none - | one, _, .id _ => some none - | zero, one, .map t => some (some t) - invFun x := match x with - | none => Arrow.mk (𝟙 zero) - | some none => Arrow.mk (𝟙 one) - | some (some t) => Arrow.mk (.map t) - left_inv := by rintro ⟨(_ | _), _, (_ | _)⟩ <;> rfl - right_inv := by rintro (_ | (_ | _)) <;> rfl - -lemma hasCardinalLT {κ' : Cardinal.{w}} (hT : HasCardinalLT T κ') (hκ' : Cardinal.aleph0 ≤ κ') : - HasCardinalLT (Arrow (ParallelMaps T)) κ' := by - simpa only [hasCardinalLT_iff_of_equiv (arrowEquiv T), - hasCardinalLT_option_iff _ _ hκ'] using hT - -end ParallelMaps - -end CategoryTheory From f1aa914f7ce301ba4c64650bb6de5a188c84be0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 26 Jun 2026 11:04:59 +0200 Subject: [PATCH 243/309] wip --- Mathlib/CategoryTheory/Presentable/Comma.lean | 122 +++++++++++++++++- 1 file changed, 120 insertions(+), 2 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/Comma.lean b/Mathlib/CategoryTheory/Presentable/Comma.lean index d952b63e919731..212643149866fb 100644 --- a/Mathlib/CategoryTheory/Presentable/Comma.lean +++ b/Mathlib/CategoryTheory/Presentable/Comma.lean @@ -18,10 +18,128 @@ universe w v₁ v₂ v₃ u₁ u₂ u₃ namespace CategoryTheory -open Category Limits +open Limits + +-- to be moved +set_option backward.isDefEq.respectTransparency false in +set_option backward.defeqAttrib.useBackward true in +open IsFiltered in +lemma IsCardinalPresentable.mk + {C : Type*} [Category* C] {X : C} {κ : Cardinal.{w}} + [Fact κ.IsRegular] + (h : ∀ (J : Type w) (_ : Category.{w} J) (_ : IsCardinalFiltered J κ) + (F : J ⥤ C) (c : Cocone F) (_ : IsColimit c), + (∀ (g : X ⟶ c.pt), ∃ (j : J) (f : X ⟶ F.obj j), f ≫ c.ι.app j = g) ∧ + (∀ (j : J) (f₁ f₂ : X ⟶ F.obj j) (_ : f₁ ≫ c.ι.app j = f₂ ≫ c.ι.app j), + ∃ (j' : J) (a : j ⟶ j'), f₁ ≫ F.map a = f₂ ≫ F.map a)) : + IsCardinalPresentable X κ where + preservesColimitOfShape J _ _ := + ⟨fun {F} ↦ ⟨fun {c} hc ↦ by + have := isFiltered_of_isCardinalFiltered J κ + rw [Types.isColimit_iff_coconeTypesIsColimit] + refine ⟨fun f₁ f₂ hf ↦ ?_, fun g ↦ ?_⟩ + · obtain ⟨j₁, f₁, rfl⟩ := Functor.ιColimitType_jointly_surjective _ f₁ + obtain ⟨j₂, f₂, rfl⟩ := Functor.ιColimitType_jointly_surjective _ f₂ + dsimp at f₁ f₂ hf + obtain ⟨j', a, ha⟩ := (h J _ inferInstance F c hc).2 _ (f₁ ≫ F.map (leftToMax j₁ j₂)) + (f₂ ≫ F.map (rightToMax j₁ j₂)) (by simpa) + simp only [Category.assoc] at ha + exact Functor.ιColimitType_eq_of_map_eq_map _ _ _ + (leftToMax j₁ j₂ ≫ a) (rightToMax j₁ j₂ ≫ a) (by simpa) + · obtain ⟨j, f, rfl⟩ := (h J _ inferInstance F c hc).1 g + exact ⟨Functor.ιColimitType _ j f, rfl⟩⟩⟩ namespace Comma +variable {C₁ : Type u₁} [Category.{v₁} C₁] {C₂ : Type u₂} [Category.{v₂} C₂] + {D : Type u₃} [Category.{v₃} D] (F₁ : C₁ ⥤ D) (F₂ : C₂ ⥤ D) + (κ : Cardinal.{w}) [Fact κ.IsRegular] + +section + +variable [F₁.IsCardinalAccessible κ] + [HasCardinalFilteredColimits C₁ κ] [HasCardinalFilteredColimits C₂ κ] + +instance : HasCardinalFilteredColimits (Comma F₁ F₂) κ where + hasColimitsOfShape J _ _ := by + have := Functor.preservesColimitsOfShape_of_isCardinalAccessible F₁ κ J + infer_instance + +instance : (Comma.fst F₁ F₂).IsCardinalAccessible κ where + preservesColimitOfShape J _ _ := by + have := Functor.preservesColimitsOfShape_of_isCardinalAccessible F₁ κ J + infer_instance + +instance : (Comma.snd F₁ F₂).IsCardinalAccessible κ where + preservesColimitOfShape J _ _ := by + have := Functor.preservesColimitsOfShape_of_isCardinalAccessible F₁ κ J + infer_instance + +end + +variable [IsCardinalAccessibleCategory C₁ κ] [IsCardinalAccessibleCategory C₂ κ] + [F₁.IsCardinalAccessible κ] [F₂.IsCardinalAccessible κ] + (hF₁ : isCardinalPresentable C₁ κ ≤ (isCardinalPresentable D κ).inverseImage F₁) + (hF₂ : isCardinalPresentable C₂ κ ≤ (isCardinalPresentable D κ).inverseImage F₂) + +set_option backward.isDefEq.respectTransparency false in +set_option backward.defeqAttrib.useBackward true in +open IsFiltered in +include hF₁ in +lemma isCardinalPresentable_mk {X₁ : C₁} {X₂ : C₂} + [IsCardinalPresentable X₁ κ] [IsCardinalPresentable X₂ κ] + (f : F₁.obj X₁ ⟶ F₂.obj X₂) : + IsCardinalPresentable (Comma.mk _ _ f) κ := + .mk (fun J _ _ G c hc ↦ by + have := isFiltered_of_isCardinalFiltered J κ + have := Functor.preservesColimitsOfShape_of_isCardinalAccessible F₁ κ J + have := Functor.preservesColimitsOfShape_of_isCardinalAccessible F₂ κ J + refine ⟨fun g ↦ ?_, fun j f₁ f₂ hf ↦ ?_⟩ + · obtain ⟨j, f₁, f₂, hf₁, hf₂⟩ : + ∃ (j : J) (f₁ : X₁ ⟶ (G.obj j).left) (f₂ : X₂ ⟶ (G.obj j).right), + f₁ ≫ (c.ι.app j).left = g.left ∧ f₂ ≫ (c.ι.app j).right = g.right := by + obtain ⟨j₁, f₁, hf₁⟩ := IsCardinalPresentable.exists_hom_of_isColimit κ + (isColimitOfPreserves (fst _ _) hc) g.left + obtain ⟨j₂, f₂, hf₂⟩ := IsCardinalPresentable.exists_hom_of_isColimit κ + (isColimitOfPreserves (snd _ _) hc) g.right + dsimp at f₁ f₂ hf₁ hf₂ + refine ⟨max j₁ j₂, f₁ ≫ (G.map (leftToMax j₁ j₂)).left, + f₂ ≫ (G.map (rightToMax j₁ j₂)).right, ?_, ?_⟩ + · rw [Category.assoc, ← hf₁, ← Comma.comp_left, Cocone.w] + · rw [Category.assoc, ← hf₂, ← Comma.comp_right, Cocone.w] + have : IsCardinalPresentable (F₁.obj X₁) κ := hF₁ _ (by assumption) + obtain ⟨j', a, ha⟩ := IsCardinalPresentable.exists_eq_of_isColimit' + κ (isColimitOfPreserves (snd _ _ ⋙ F₂) hc) + (F₁.map f₁ ≫ (G.obj j).hom) (f ≫ F₂.map f₂) (by + dsimp + simp only [Category.assoc, ← Functor.map_comp, hf₂, + ← (c.ι.app j).w, Functor.const_obj_obj, + ← Functor.map_comp_assoc, hf₁, g.w]) + refine ⟨j', { left := f₁ ≫ (G.map a).left, right := f₂ ≫ (G.map a).right }, ?_⟩ + ext + · dsimp + rw [Category.assoc, ← hf₁, ← Comma.comp_left, Cocone.w] + · dsimp + rw [Category.assoc, ← hf₂, ← Comma.comp_right, Cocone.w] + · obtain ⟨j₁, a, ha⟩ := IsCardinalPresentable.exists_eq_of_isColimit' + κ (isColimitOfPreserves (fst _ _) hc) f₁.left f₂.left + ((fst _ _).congr_map hf) + obtain ⟨j₂, b, hb⟩ := IsCardinalPresentable.exists_eq_of_isColimit' + κ (isColimitOfPreserves (snd _ _) hc) f₁.right f₂.right + ((snd _ _).congr_map hf) + dsimp at ha hb + obtain ⟨j', a', b', h⟩ := IsFiltered.span a b + refine ⟨j', a ≫ a', ?_⟩ + ext + · simp [reassoc_of% ha] + · simp only [h, Functor.map_comp, comp_right, reassoc_of% hb]) + +end Comma + + +/- +namespace Comma + variable {C₁ : Type u₁} [Category.{v₁} C₁] {C₂ : Type u₂} [Category.{v₂} C₂] {D : Type u₃} [Category.{v₃} D] (F₁ : C₁ ⥤ D) (F₂ : C₂ ⥤ D) @@ -244,4 +362,4 @@ end end Comma -end CategoryTheory +end CategoryTheory-/ From e098a79f2d25e2354486962c1eb9c1e1b0ad06aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= <37772949+joelriou@users.noreply.github.com> Date: Fri, 26 Jun 2026 11:06:50 +0200 Subject: [PATCH 244/309] Update Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean Co-authored-by: smorel394 <67864981+smorel394@users.noreply.github.com> --- Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean index d1dad58cbdf7b1..b662c5e2dd2dd2 100644 --- a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean +++ b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean @@ -98,7 +98,7 @@ namespace CategoryTheory variable (κ : Cardinal.{u}) [Fact κ.IsRegular] /-- The category of `κ`-filtered partially ordered types, -with morphisms given by order embeddings. () -/ +with morphisms given by order embeddings. -/ abbrev CardinalDirectedPoset := (PartOrdEmb.isCardinalFiltered κ).FullSubcategory From 3f99756990943179de1c37a3732d17aa46ee628e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 26 Jun 2026 11:16:49 +0200 Subject: [PATCH 245/309] wip --- Mathlib/CategoryTheory/Presentable/Comma.lean | 31 ++++++++++++++----- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/Comma.lean b/Mathlib/CategoryTheory/Presentable/Comma.lean index 212643149866fb..14b0d1298f1a09 100644 --- a/Mathlib/CategoryTheory/Presentable/Comma.lean +++ b/Mathlib/CategoryTheory/Presentable/Comma.lean @@ -49,6 +49,25 @@ lemma IsCardinalPresentable.mk · obtain ⟨j, f, rfl⟩ := (h J _ inferInstance F c hc).1 g exact ⟨Functor.ιColimitType _ j f, rfl⟩⟩⟩ +namespace Functor + +variable {C D : Type*} [Category* C] [Category* D] + +-- to be moved +class PreservesCardinalPresentable + (F : C ⥤ D) (κ : Cardinal.{w}) [Fact κ.IsRegular] : Prop where + le_inverseImage_isCardinalPresentable (F κ) : + isCardinalPresentable C κ ≤ (isCardinalPresentable D κ).inverseImage F + +export PreservesCardinalPresentable (le_inverseImage_isCardinalPresentable) + +instance (F : C ⥤ D) (κ : Cardinal.{w}) [Fact κ.IsRegular] (X : C) + [IsCardinalPresentable X κ] [F.PreservesCardinalPresentable κ] : + IsCardinalPresentable (F.obj X) κ := + le_inverseImage_isCardinalPresentable F κ _ (by assumption) + +end Functor + namespace Comma variable {C₁ : Type u₁} [Category.{v₁} C₁] {C₂ : Type u₂} [Category.{v₂} C₂] @@ -77,18 +96,15 @@ instance : (Comma.snd F₁ F₂).IsCardinalAccessible κ where end -variable [IsCardinalAccessibleCategory C₁ κ] [IsCardinalAccessibleCategory C₂ κ] - [F₁.IsCardinalAccessible κ] [F₂.IsCardinalAccessible κ] - (hF₁ : isCardinalPresentable C₁ κ ≤ (isCardinalPresentable D κ).inverseImage F₁) - (hF₂ : isCardinalPresentable C₂ κ ≤ (isCardinalPresentable D κ).inverseImage F₂) - set_option backward.isDefEq.respectTransparency false in set_option backward.defeqAttrib.useBackward true in open IsFiltered in -include hF₁ in +variable {F₁ F₂} in lemma isCardinalPresentable_mk {X₁ : C₁} {X₂ : C₂} + [HasCardinalFilteredColimits C₁ κ] [HasCardinalFilteredColimits C₂ κ] + [F₁.IsCardinalAccessible κ] [F₂.IsCardinalAccessible κ] [IsCardinalPresentable X₁ κ] [IsCardinalPresentable X₂ κ] - (f : F₁.obj X₁ ⟶ F₂.obj X₂) : + [F₁.PreservesCardinalPresentable κ] (f : F₁.obj X₁ ⟶ F₂.obj X₂) : IsCardinalPresentable (Comma.mk _ _ f) κ := .mk (fun J _ _ G c hc ↦ by have := isFiltered_of_isCardinalFiltered J κ @@ -107,7 +123,6 @@ lemma isCardinalPresentable_mk {X₁ : C₁} {X₂ : C₂} f₂ ≫ (G.map (rightToMax j₁ j₂)).right, ?_, ?_⟩ · rw [Category.assoc, ← hf₁, ← Comma.comp_left, Cocone.w] · rw [Category.assoc, ← hf₂, ← Comma.comp_right, Cocone.w] - have : IsCardinalPresentable (F₁.obj X₁) κ := hF₁ _ (by assumption) obtain ⟨j', a, ha⟩ := IsCardinalPresentable.exists_eq_of_isColimit' κ (isColimitOfPreserves (snd _ _ ⋙ F₂) hc) (F₁.map f₁ ≫ (G.obj j).hom) (f ≫ F₂.map f₂) (by From f37cbc8fb7446822fffad1affd2ba8d60b849985 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= <37772949+joelriou@users.noreply.github.com> Date: Fri, 26 Jun 2026 11:49:58 +0200 Subject: [PATCH 246/309] Update Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean Co-authored-by: smorel394 <67864981+smorel394@users.noreply.github.com> --- Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean index df924ecd0b1ffa..20030b4aa9d0db 100644 --- a/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean @@ -72,7 +72,7 @@ public lemma exists_cofinal_of_isCardinalAccessibleCategory_cardinalDirectedPose rw [← CardinalDirectedPoset.isCardinalPresentable_iff _ h] exact p.prop_diag_obj j -- For each `x : X`, we choose `j : J` in such a way that the singleton - -- `{x}` belongs to the image of `p.diag.obj j`. + -- `{x}` belongs to the image of `p.diag.obj j` in `SetCardinalLT κ₁ X`. choose j y hy using fun x ↦ Types.jointly_surjective_of_isColimit (isColimitOfPreserves (forget (CardinalDirectedPoset κ₁)) p.isColimit) (SetCardinalLT.singleton κ₁ x) From e000d8836238d2b937eba907c1ff8aaba42173fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= <37772949+joelriou@users.noreply.github.com> Date: Fri, 26 Jun 2026 11:50:56 +0200 Subject: [PATCH 247/309] Update Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean Co-authored-by: smorel394 <67864981+smorel394@users.noreply.github.com> --- Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean | 1 - 1 file changed, 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean index 20030b4aa9d0db..51b6b1c859c28f 100644 --- a/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean @@ -226,7 +226,6 @@ lemma isCardinalFiltered_iUnion : (leOfHom (IsCardinalFiltered.toMax a hK k)) (ha k)⟩) hK exact ⟨⟨z, Set.subset_iUnion _ _ hz⟩, hz'⟩ intro K j f hK - have := hasCardinalLT_transfiniteIterate_φ h₀ Y hY m A obtain ⟨⟨x, hx⟩, hx'⟩ := hφ₀ Y hY' m hm _ (hasCardinalLT_transfiniteIterate_φ h₀ Y hY m A hA _) f hK refine ⟨⟨x, ?_⟩, hx'⟩ From a4f95439a405682dd556af19eb7a123d2b75a551 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= <37772949+joelriou@users.noreply.github.com> Date: Fri, 26 Jun 2026 11:51:08 +0200 Subject: [PATCH 248/309] Update Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean Co-authored-by: smorel394 <67864981+smorel394@users.noreply.github.com> --- Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean index 51b6b1c859c28f..33c51d0822c9ea 100644 --- a/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean @@ -103,7 +103,7 @@ namespace existsIsCardinalFilteredSetOfExistsCofinal /-! The definitions in this section are part of the proof of the lemma `exists_isCardinalFiltered_set_of_exists_cofinal` below, which is the implication (iii) → (iv) in the characterizations -of `Sharply κ₁ κ₂` which appear in the docstring of this file. -/ +of `SharplyLT κ₁ κ₂` which appear in the docstring of this file. -/ variable (h₀ : κ₁ < κ₂) {X : Type w} [PartialOrder X] From ba4de0bc00fadac13ed8505e1329c336ce539eac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= <37772949+joelriou@users.noreply.github.com> Date: Fri, 26 Jun 2026 11:51:37 +0200 Subject: [PATCH 249/309] Update Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean Co-authored-by: smorel394 <67864981+smorel394@users.noreply.github.com> --- Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean index 33c51d0822c9ea..3eeba328fdaf43 100644 --- a/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean @@ -61,7 +61,7 @@ public lemma exists_cofinal_of_isCardinalAccessibleCategory_cardinalDirectedPose (h : κ₁ ≤ κ₂) [IsCardinalAccessibleCategory (CardinalDirectedPoset κ₁) κ₂] {X : Type w} (hX : HasCardinalLT X κ₂) : ∃ (Y : Set (SetCardinalLT κ₁ X)), HasCardinalLT Y κ₂ ∧ IsCofinal Y := by - -- We write the partially ordered type `setCardinalLT κ₁ X` of subsets + -- We write the partially ordered type `SetCardinalLT κ₁ X` of subsets -- of `X` of cardinality `< κ₁` as a `κ₂`-filtered colimit (with index -- category `J`) of `κ₂`-presentable objects (i.e. partially ordered -- types of cardinality `< κ₂`.) From eb1fa1e6d2201a565a270adff2d58e867cab092f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 26 Jun 2026 11:59:27 +0200 Subject: [PATCH 250/309] Cardinal.nonempty_ord_toType --- .../Presentable/SharplyLT/Basic.lean | 16 ++++++---------- Mathlib/SetTheory/Ordinal/Basic.lean | 4 ++++ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean index 3eeba328fdaf43..ada92c9bb66c38 100644 --- a/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean @@ -163,13 +163,6 @@ lemma le_φ (B : Set X) : B ≤ φ Y m B := by refine ⟨hb, @hC' ⟨b, hb⟩ (by simp)⟩ · simp -variable (κ₁) in -noncomputable abbrev orderBot : OrderBot κ₁.ord.ToType := - have : Nonempty κ₁.ord.ToType := by - rw [Ordinal.nonempty_toType_iff, ne_eq, ord_eq_zero] - exact IsRegular.ne_zero Fact.out - WellFoundedLT.toOrderBot _ - include h₀ hA hY in omit [PartialOrder X] in /-- By iterating `φ` to the power `j : κ₁.ord.ToType` and evaluating @@ -178,7 +171,8 @@ lemma hasCardinalLT_transfiniteIterate_φ (j : κ₁.ord.ToType) : HasCardinalLT (transfiniteIterate (φ Y m) j A :) κ₂ := by induction j using SuccOrder.limitRecOn with | isMin j hj => - letI := orderBot κ₁ + have := Cardinal.nonempty_ord_toType (c := κ₁) (IsRegular.ne_zero Fact.out) + letI := WellFoundedLT.toOrderBot κ₁.ord.ToType simpa [hj.eq_bot] | succ j hj hj' => have hκ₂ : κ₂.IsRegular := Fact.out @@ -201,12 +195,14 @@ include hY' in omit [Fact κ₂.IsRegular] [PartialOrder X] in lemma monotone_transfiniteIterate_φ : Monotone (fun (j : κ₁.ord.ToType) ↦ transfiniteIterate (φ Y m) j A) := - letI := orderBot κ₁ + have := Cardinal.nonempty_ord_toType (c := κ₁) (IsRegular.ne_zero Fact.out) + letI := WellFoundedLT.toOrderBot κ₁.ord.ToType monotone_transfiniteIterate _ _ (le_φ _ hY' _) omit [PartialOrder X] [Fact κ₂.IsRegular] in lemma subset_iUnion : A ⊆ ⋃ (j : κ₁.ord.ToType), transfiniteIterate (φ Y m) j A := by - letI := orderBot κ₁ + have := Cardinal.nonempty_ord_toType (c := κ₁) (IsRegular.ne_zero Fact.out) + letI := WellFoundedLT.toOrderBot κ₁.ord.ToType exact subset_trans (by simp) (Set.subset_iUnion _ ⊥) include h₀ hY hY' hm hA in diff --git a/Mathlib/SetTheory/Ordinal/Basic.lean b/Mathlib/SetTheory/Ordinal/Basic.lean index d5641068269f63..689ae9ee2f849c 100644 --- a/Mathlib/SetTheory/Ordinal/Basic.lean +++ b/Mathlib/SetTheory/Ordinal/Basic.lean @@ -1269,6 +1269,10 @@ def ord.orderEmbedding : Cardinal ↪o Ordinal := theorem ord.orderEmbedding_coe : (ord.orderEmbedding : Cardinal → Ordinal) = ord := rfl +lemma nonempty_ord_toType {c : Cardinal} (h : c ≠ 0) : + Nonempty c.ord.ToType := by + rwa [Ordinal.nonempty_toType_iff, ne_eq, ord_eq_zero] + end Cardinal namespace Ordinal From f46c43ba9b1af7a3d8218cf6a37f79ae9dbba8b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 26 Jun 2026 14:43:14 +0200 Subject: [PATCH 251/309] wip --- .../CategoryTheory/ObjectProperty/Comma.lean | 53 ++++ Mathlib/CategoryTheory/Presentable/Basic.lean | 2 +- Mathlib/CategoryTheory/Presentable/Comma.lean | 252 ++---------------- 3 files changed, 82 insertions(+), 225 deletions(-) create mode 100644 Mathlib/CategoryTheory/ObjectProperty/Comma.lean diff --git a/Mathlib/CategoryTheory/ObjectProperty/Comma.lean b/Mathlib/CategoryTheory/ObjectProperty/Comma.lean new file mode 100644 index 00000000000000..e9ff18dd9e53a9 --- /dev/null +++ b/Mathlib/CategoryTheory/ObjectProperty/Comma.lean @@ -0,0 +1,53 @@ +/- +Copyright (c) 2026 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.Small + +/-! +# Properties of objects in comma categories + +-/ + +universe w + +@[expose] public section + +namespace CategoryTheory.ObjectProperty + +variable {C₁ C₂ D : Type*} [Category* C₁] [Category* C₂] [Category* D] + (F₁ : C₁ ⥤ D) (F₂ : C₂ ⥤ D) + (P₁ : ObjectProperty C₁) (P₂ : ObjectProperty C₂) + +def comma : ObjectProperty (Comma F₁ F₂) := + P₁.inverseImage (Comma.fst _ _) ⊓ P₂.inverseImage (Comma.snd _ _) + +variable {F₁ F₂} in +@[simp] +lemma comma_iff (X : Comma F₁ F₂) : + comma F₁ F₂ P₁ P₂ X ↔ P₁ X.left ∧ P₂ X.right := Iff.rfl + +instance [ObjectProperty.Small.{w} P₁] [ObjectProperty.Small.{w} P₂] [LocallySmall.{w} D] : + ObjectProperty.Small.{w} (comma F₁ F₂ P₁ P₂) := + small_of_surjective + (α := Σ (X₁ : Subtype P₁) (X₂ : Subtype P₂), F₁.obj X₁.val ⟶ F₂.obj X₂.val) + (f := fun ⟨X₁, X₂, f⟩ ↦ ⟨Comma.mk _ _ f, X₁.prop, X₂.prop⟩) + (fun f ↦ ⟨⟨⟨_, f.prop.1⟩, ⟨_, f.prop.2⟩, f.val.hom⟩, rfl⟩) + +instance [ObjectProperty.EssentiallySmall.{w} P₁] + [ObjectProperty.EssentiallySmall.{w} P₂] + [LocallySmall.{w} D] : + ObjectProperty.EssentiallySmall.{w} (comma F₁ F₂ P₁ P₂) := by + obtain ⟨Q₁, _, h₁, h₁'⟩ := EssentiallySmall.exists_small_le.{w} P₁ + obtain ⟨Q₂, _, h₂, h₂'⟩ := EssentiallySmall.exists_small_le.{w} P₂ + refine ⟨comma F₁ F₂ Q₁ Q₂, inferInstance, fun f hf ↦ ?_⟩ + simp only [comma_iff] at hf + obtain ⟨X₁, hX₁, ⟨e₁⟩⟩ := h₁' _ hf.1 + obtain ⟨X₂, hX₂, ⟨e₂⟩⟩ := h₂' _ hf.2 + exact ⟨Comma.mk _ _ (F₁.map e₁.inv ≫ f.hom ≫ F₂.map e₂.hom), by tauto, + ⟨Comma.isoMk e₁ e₂⟩⟩ + +end CategoryTheory.ObjectProperty diff --git a/Mathlib/CategoryTheory/Presentable/Basic.lean b/Mathlib/CategoryTheory/Presentable/Basic.lean index f1d14fbe781e7c..8c48205d815f1e 100644 --- a/Mathlib/CategoryTheory/Presentable/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/Basic.lean @@ -150,7 +150,7 @@ abbrev IsCardinalPresentable : Prop := (coyoneda.obj (op X)).IsCardinalAccessibl variable (C) in /-- The property of objects that are `κ`-presentable. -/ -def isCardinalPresentable : ObjectProperty C := fun X ↦ IsCardinalPresentable X κ +abbrev isCardinalPresentable : ObjectProperty C := fun X ↦ IsCardinalPresentable X κ instance (X : (isCardinalPresentable C κ).FullSubcategory) : IsCardinalPresentable X.obj κ := diff --git a/Mathlib/CategoryTheory/Presentable/Comma.lean b/Mathlib/CategoryTheory/Presentable/Comma.lean index 14b0d1298f1a09..0470ad4f7b2190 100644 --- a/Mathlib/CategoryTheory/Presentable/Comma.lean +++ b/Mathlib/CategoryTheory/Presentable/Comma.lean @@ -4,10 +4,12 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ +import Mathlib.CategoryTheory.Presentable.Dense import Mathlib.CategoryTheory.Presentable.LocallyPresentable import Mathlib.CategoryTheory.Limits.Comma import Mathlib.CategoryTheory.Limits.Final import Mathlib.CategoryTheory.Comma.LocallySmall +import Mathlib.CategoryTheory.ObjectProperty.Comma /-! # Comma categories are accessible @@ -99,7 +101,7 @@ end set_option backward.isDefEq.respectTransparency false in set_option backward.defeqAttrib.useBackward true in open IsFiltered in -variable {F₁ F₂} in +variable {F₁ F₂ κ} in lemma isCardinalPresentable_mk {X₁ : C₁} {X₂ : C₂} [HasCardinalFilteredColimits C₁ κ] [HasCardinalFilteredColimits C₂ κ] [F₁.IsCardinalAccessible κ] [F₂.IsCardinalAccessible κ] @@ -149,232 +151,34 @@ lemma isCardinalPresentable_mk {X₁ : C₁} {X₂ : C₂} · simp [reassoc_of% ha] · simp only [h, Functor.map_comp, comp_right, reassoc_of% hb]) -end Comma - - -/- -namespace Comma - -variable {C₁ : Type u₁} [Category.{v₁} C₁] {C₂ : Type u₂} [Category.{v₂} C₂] - {D : Type u₃} [Category.{v₃} D] (F₁ : C₁ ⥤ D) (F₂ : C₂ ⥤ D) - -variable (κ : Cardinal.{w}) [Fact κ.IsRegular] - -variable {F₁ F₂} in -instance isCardinalPresentable_mk {X₁ : C₁} {X₂ : C₂} - [IsCardinalPresentable X₁ κ] [IsCardinalPresentable X₂ κ] - [IsCardinalPresentable X₁ κ] [IsCardinalPresentable X₂ κ] - (f : F₁.obj X₁ ⟶ F₂.obj X₂) : - IsCardinalPresentable (Comma.mk _ _ f) κ := by - -- need that `F₁` (and `F₂` ?) preserve κ-presentable objects - sorry - -section - -variable [IsCardinalAccessibleCategory C₁ κ] [IsCardinalAccessibleCategory C₂ κ] - [IsCardinalAccessibleCategory D κ] - [F₁.IsCardinalAccessible κ] - -instance hasCardinalFilteredColimits : - HasCardinalFilteredColimits.{w} (Comma F₁ F₂) κ where - hasColimitsOfShape J _ _ := by - have := F₁.preservesColimitsOfShape_of_isCardinalAccessible κ - infer_instance - -instance : (Comma.fst F₁ F₂).IsCardinalAccessible κ where - preservesColimitOfShape J _ _ := by - have := F₁.preservesColimitsOfShape_of_isCardinalAccessible κ - infer_instance - -instance : (Comma.snd F₁ F₂).IsCardinalAccessible κ where - preservesColimitOfShape J _ _ := by - have := F₁.preservesColimitsOfShape_of_isCardinalAccessible κ - infer_instance - -end - -namespace hasCardinalFilteredGenerators - -variable {F₁ F₂ κ} {X₁ : C₁} {X₂ : C₂} (f : F₁.obj X₁ ⟶ F₂.obj X₂) - (p₁ : CardinalFilteredPresentation.{w} X₁ κ) - (p₂ : CardinalFilteredPresentation.{w} X₂ κ) - -structure Index where - j₁ : p₁.J - j₂ : p₂.J - hom : F₁.obj (p₁.F.obj j₁) ⟶ F₂.obj (p₂.F.obj j₂) - w : hom ≫ F₂.map (p₂.ι.app j₂) = F₁.map (p₁.ι.app j₁) ≫ f - -namespace Index - -attribute [reassoc (attr := simp)] w - -variable {f p₁ p₂} - -@[ext] -structure Hom (S₁ S₂ : Index f p₁ p₂) where - m₁ : S₁.j₁ ⟶ S₂.j₁ - m₂ : S₁.j₂ ⟶ S₂.j₂ - w : S₁.hom ≫ F₂.map (p₂.F.map m₂) = F₁.map (p₁.F.map m₁) ≫ S₂.hom := by aesop_cat - -attribute [reassoc] Hom.w -attribute [local simp] Hom.w_assoc Hom.w - -instance : Category (Index f p₁ p₂) where - Hom := Hom - id S := { m₁ := 𝟙 _, m₂ := 𝟙 _} - comp φ φ' := { m₁ := φ.m₁ ≫ φ'.m₁, m₂ := φ.m₂ ≫ φ'.m₂ } - -@[simp] lemma id_m₁ (S : Index f p₁ p₂) : Hom.m₁ (𝟙 S) = 𝟙 _ := rfl -@[simp] lemma id_m₂ (S : Index f p₁ p₂) : Hom.m₂ (𝟙 S) = 𝟙 _ := rfl - -section +protected def isCardinalPresentable : ObjectProperty (Comma F₁ F₂) := + ObjectProperty.comma _ _ (isCardinalPresentable C₁ κ) (isCardinalPresentable C₂ κ) -variable {S₁ S₂ S₃ : Index f p₁ p₂} (φ : S₁ ⟶ S₂) (φ' : S₂ ⟶ S₃) - -@[reassoc (attr := simp)] lemma comp_m₁ : (φ ≫ φ').m₁ = φ.m₁ ≫ φ'.m₁ := rfl -@[reassoc (attr := simp)] lemma comp_m₂ : (φ ≫ φ').m₂ = φ.m₂ ≫ φ'.m₂ := rfl - -end - -variable (f p₁ p₂) - -@[simps] -def π₁ : Index f p₁ p₂ ⥤ p₁.J where - obj S := S.j₁ - map φ := φ.m₁ - -@[simps] -def π₂ : Index f p₁ p₂ ⥤ p₂.J where - obj S := S.j₂ - map φ := φ.m₂ - -end Index - -@[simps] -def functor : Index f p₁ p₂ ⥤ Comma F₁ F₂ where - obj S := Comma.mk _ _ S.hom - map {S₁ S₂} φ := - { left := p₁.F.map φ.m₁ - right := p₂.F.map φ.m₂ - w := φ.w.symm } - -@[simps] -def cocone : Cocone (functor f p₁ p₂) where - pt := Comma.mk _ _ f - ι := - { app S := - { left := p₁.ι.app S.j₁ - right := p₂.ι.app S.j₂ - w := S.w.symm } } - -instance [LocallySmall.{w} D] : Small.{w} (Index f p₁ p₂) := by - let T := Σ (j₁ : p₁.J) (j₂ : p₂.J), Shrink.{w} (F₁.obj (p₁.F.obj j₁) ⟶ F₂.obj (p₂.F.obj j₂)) - let φ : Index f p₁ p₂ → T := fun S ↦ ⟨S.j₁, S.j₂, equivShrink _ S.hom⟩ - have hφ : Function.Injective φ := by - rintro ⟨j₁, j₂, hom, _⟩ ⟨j₁', j₂', hom', _⟩ h - dsimp [φ] at h - obtain rfl : j₁ = j₁' := congr_arg Sigma.fst h - rw [Sigma.ext_iff, heq_eq_eq] at h - replace h := h.2 - obtain rfl : j₂ = j₂' := congr_arg Sigma.fst h - simpa using h - exact small_of_injective hφ - -instance [LocallySmall.{w} D] : EssentiallySmall.{w} (Index f p₁ p₂) := by - apply essentiallySmall_of_small_of_locallySmall - -instance : IsCardinalFiltered (Index f p₁ p₂) κ := sorry - -instance : IsFiltered (Index f p₁ p₂) := by - apply isFiltered_of_isCardinalDirected _ κ - -instance : (Index.π₁ f p₁ p₂).Final := sorry - -instance : (Index.π₂ f p₁ p₂).Final := sorry - -section - -variable [IsCardinalAccessibleCategory C₁ κ] [IsCardinalAccessibleCategory C₂ κ] - [IsCardinalAccessibleCategory D κ] - [F₁.IsCardinalAccessible κ] [F₂.IsCardinalAccessible κ] - -def isColimitCocone : IsColimit (cocone f p₁ p₂) := by - sorry - -noncomputable def cardinalFilteredPresentation : - CardinalFilteredPresentation (Comma.mk _ _ f) κ := - .ofIsColimitOfEssentiallySmall _ (isColimitCocone f p₁ p₂) κ - -end - -lemma cardinalFilteredPresentation_exists_f_obj_iso - [IsCardinalAccessibleCategory D κ] - (x : (cardinalFilteredPresentation f p₁ p₂).J) : - ∃ (j : Index f p₁ p₂), - Nonempty ((cardinalFilteredPresentation f p₁ p₂).F.obj x ≅ (functor f p₁ p₂).obj j) := - CardinalFilteredPresentation.ofIsColimitOfEssentiallySmall_exists_f_obj_iso _ _ _ _ - -end hasCardinalFilteredGenerators - -section - -variable [IsCardinalAccessibleCategory C₁ κ] [IsCardinalAccessibleCategory C₂ κ] - [IsCardinalAccessibleCategory D κ] +lemma isCardinalPresentable_le + [HasCardinalFilteredColimits C₁ κ] [HasCardinalFilteredColimits C₂ κ] + [F₁.IsCardinalAccessible κ] [F₂.IsCardinalAccessible κ] + [F₁.PreservesCardinalPresentable κ] : + Comma.isCardinalPresentable F₁ F₂ κ ≤ isCardinalPresentable (Comma F₁ F₂) κ := by + intro f ⟨h₁, h₂⟩ + simp only [ObjectProperty.prop_inverseImage_iff, fst_obj, snd_obj] at h₁ h₂ + exact isCardinalPresentable_mk f.hom + +instance [ObjectProperty.EssentiallySmall.{w} (isCardinalPresentable C₁ κ)] + [ObjectProperty.EssentiallySmall.{w} (isCardinalPresentable C₂ κ)] + [LocallySmall.{w} D] : + ObjectProperty.EssentiallySmall.{w} + (Comma.isCardinalPresentable F₁ F₂ κ) := by + dsimp only [Comma.isCardinalPresentable] + infer_instance + +section isCardinalAccessibleCategory + +variable + [IsCardinalAccessibleCategory C₁ κ] [IsCardinalAccessibleCategory C₂ κ] [F₁.IsCardinalAccessible κ] [F₂.IsCardinalAccessible κ] -open hasCardinalFilteredGenerators in -instance hasCardinalFilteredGenerators : - HasCardinalFilteredGenerators.{w} (Comma F₁ F₂) κ where - exists_generators' := by - obtain ⟨ι₁, G₁, h₁⟩ := HasCardinalFilteredGenerators.exists_generators C₁ κ - obtain ⟨ι₂, G₂, h₂⟩ := HasCardinalFilteredGenerators.exists_generators C₂ κ - have := h₁.isCardinalPresentable - have := h₂.isCardinalPresentable - refine ⟨Σ (i₁ : ι₁) (i₂ : ι₂), Shrink.{w} (F₁.obj (G₁ i₁) ⟶ F₂.obj (G₂ i₂)), - fun ⟨i₁, i₂, hom⟩ ↦ Comma.mk _ _ ((equivShrink _).symm hom), ?_⟩ - constructor - · rintro ⟨i₁, i₂, hom⟩ - infer_instance - · rintro ⟨X₁, X₂, hom⟩ - refine ⟨cardinalFilteredPresentation hom (h₁.presentation X₁) (h₂.presentation X₂), - ?_⟩ - intro j - let Z := (cardinalFilteredPresentation hom (h₁.presentation X₁) - (h₂.presentation X₂)).F.obj j - obtain ⟨S, ⟨e : Z ≅ _⟩⟩ := cardinalFilteredPresentation_exists_f_obj_iso _ _ _ j - obtain ⟨i₁, ⟨e₁⟩⟩ := h₁.exists_presentation_obj_iso X₁ S.j₁ - obtain ⟨i₂, ⟨e₂⟩⟩ := h₂.exists_presentation_obj_iso X₂ S.j₂ - let α : F₁.obj (G₁ i₁) ⟶ F₂.obj (G₂ i₂) := - F₁.map (e₁.inv ≫ e.inv.left) ≫ Z.hom ≫ F₂.map (e.hom.right ≫ e₂.hom) - refine ⟨⟨i₁, i₂, equivShrink _ - (F₁.map (e₁.inv ≫ e.inv.left) ≫ Z.hom ≫ F₂.map (e.hom.right ≫ e₂.hom))⟩, - ⟨isoMk ((Comma.fst _ _).mapIso e ≪≫ e₁) ((Comma.snd _ _).mapIso e ≪≫ e₂) ?_⟩⟩ - dsimp - simp only [Functor.map_comp, Category.assoc, CommaMorphism.w_assoc, functor_obj_left, - functor_obj_right, functor_obj_hom, Equiv.symm_apply_apply, Iso.map_hom_inv_id_assoc] - have := e.hom.w - dsimp at this - rw [reassoc_of% this, ← F₂.map_comp_assoc e.inv.right, ← comp_right, - e.inv_hom_id] - dsimp - rw [F₂.map_id, id_comp] - -instance isCardinalAccessibleCategory : - IsCardinalAccessibleCategory (Comma F₁ F₂) κ where - -end - -section - -variable [IsCardinalLocallyPresentable C₁ κ] [IsCardinalLocallyPresentable C₂ κ] - [IsCardinalLocallyPresentable D κ] [PreservesColimitsOfSize.{w, w} F₁] - -instance isCardinalLocallyPresentable : - IsCardinalLocallyPresentable (Comma F₁ F₂) κ where - -end +end isCardinalAccessibleCategory end Comma -end CategoryTheory-/ +end CategoryTheory From 426a7303aebcfd7c3460c3291ca2f4d534e0efbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 26 Jun 2026 15:09:24 +0200 Subject: [PATCH 252/309] wip --- .../CardinalFilteredPresentation.lean | 9 ++++++- Mathlib/CategoryTheory/Presentable/Comma.lean | 27 +++++++++++++++---- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean b/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean index ea4d3d2bcf4dd8..da4e7248580c11 100644 --- a/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean +++ b/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean @@ -33,7 +33,7 @@ such that `P.IsCardinalFilteredGenerator κ` holds. public section -universe w v u +universe w₁ w₂ w v u namespace CategoryTheory @@ -83,6 +83,13 @@ structure IsCardinalFilteredGenerator : Prop where namespace IsCardinalFilteredGenerator +lemma mk' (h₁ : P ≤ isCardinalPresentable C κ) + (h₂ : ∀ (X : C), ∃ (J : Type w₁) (_ : Category.{w₂} J) + (_ : EssentiallySmall.{w} J) (_ : IsCardinalFiltered J κ), P.colimitsOfShape J X) : + P.IsCardinalFilteredGenerator κ where + le_isCardinalPresentable := h₁ + exists_colimitsOfShape := sorry + variable (h : P.IsCardinalFilteredGenerator κ) (X : C) include h in diff --git a/Mathlib/CategoryTheory/Presentable/Comma.lean b/Mathlib/CategoryTheory/Presentable/Comma.lean index 0470ad4f7b2190..fe9bc61d0b9bc5 100644 --- a/Mathlib/CategoryTheory/Presentable/Comma.lean +++ b/Mathlib/CategoryTheory/Presentable/Comma.lean @@ -171,13 +171,30 @@ instance [ObjectProperty.EssentiallySmall.{w} (isCardinalPresentable C₁ κ)] dsimp only [Comma.isCardinalPresentable] infer_instance -section isCardinalAccessibleCategory +instance (f : Comma F₁ F₂) : + IsCardinalFiltered (CostructuredArrow (Comma.isCardinalPresentable F₁ F₂ κ).ι f) κ := by + sorry -variable - [IsCardinalAccessibleCategory C₁ κ] [IsCardinalAccessibleCategory C₂ κ] - [F₁.IsCardinalAccessible κ] [F₂.IsCardinalAccessible κ] +instance : (Comma.isCardinalPresentable F₁ F₂ κ).ι.IsDense := by + sorry -end isCardinalAccessibleCategory +protected lemma isCardinalFilteredGenerator_isCardinalPresentable + [IsCardinalAccessibleCategory C₁ κ] [IsCardinalAccessibleCategory C₂ κ] + [F₁.IsCardinalAccessible κ] [F₂.IsCardinalAccessible κ] + [F₁.PreservesCardinalPresentable κ] [LocallySmall.{w} D] : + (Comma.isCardinalPresentable F₁ F₂ κ).IsCardinalFilteredGenerator κ := + .mk' (isCardinalPresentable_le _ _ _) + (fun f ↦ ⟨(CostructuredArrow (Comma.isCardinalPresentable F₁ F₂ κ).ι f), inferInstance, + inferInstance, inferInstance, + ⟨_, _, (Comma.isCardinalPresentable F₁ F₂ κ).ι.denseAt f⟩, + fun g ↦ g.left.property⟩) + +instance [IsCardinalAccessibleCategory C₁ κ] [IsCardinalAccessibleCategory C₂ κ] + [F₁.IsCardinalAccessible κ] [F₂.IsCardinalAccessible κ] + [F₁.PreservesCardinalPresentable κ] [LocallySmall.{w} D] : + IsCardinalAccessibleCategory (Comma F₁ F₂) κ where + exists_generator := + ⟨_, inferInstance, Comma.isCardinalFilteredGenerator_isCardinalPresentable.{w} F₁ F₂ κ⟩ end Comma From 0fc107e92eae5494c45d236cf4d26d71c020823c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 26 Jun 2026 16:18:15 +0200 Subject: [PATCH 253/309] wip --- Mathlib/CategoryTheory/Limits/Comma.lean | 22 ++++++++ Mathlib/CategoryTheory/Presentable/Comma.lean | 56 +++++++++++++++++-- 2 files changed, 72 insertions(+), 6 deletions(-) diff --git a/Mathlib/CategoryTheory/Limits/Comma.lean b/Mathlib/CategoryTheory/Limits/Comma.lean index 31172ac7aeb408..66d56173374aff 100644 --- a/Mathlib/CategoryTheory/Limits/Comma.lean +++ b/Mathlib/CategoryTheory/Limits/Comma.lean @@ -141,6 +141,28 @@ noncomputable def coconeOfPreservesIsColimit [PreservesColimit (F ⋙ fst L R) L · exact t₁.uniq ((fst L R).mapCocone s) _ (fun j => by simp [← w]) · exact t₂.uniq ((snd L R).mapCocone s) _ (fun j => by simp [← w]) +set_option backward.defeqAttrib.useBackward true in +def fstSndJointlyReflectColimit {F : J ⥤ Comma L R} {c : Cocone F} + [PreservesColimit (F ⋙ fst _ _) L] + (h₁ : IsColimit ((fst _ _).mapCocone c)) + (h₂ : IsColimit ((snd _ _).mapCocone c)) : + IsColimit c where + desc s := + { left := h₁.desc ((fst _ _).mapCocone s) + right := h₂.desc ((snd _ _).mapCocone s) + w := (isColimitOfPreserves L h₁).hom_ext (fun j ↦ by + simp [← Functor.map_comp_assoc, ← Functor.map_comp, + dsimp% h₁.fac ((fst _ _).mapCocone s) j, + dsimp% h₂.fac ((snd _ _).mapCocone s) j]) } + fac s j := by + ext + · exact h₁.fac ((fst _ _).mapCocone s) j + · exact h₂.fac ((snd _ _).mapCocone s) j + uniq s m hm := by + ext + · exact h₁.uniq ((fst _ _).mapCocone s) _ (fun j ↦ by simp [← hm]) + · exact h₂.uniq ((snd _ _).mapCocone s) _ (fun j ↦ by simp [← hm]) + instance hasLimit (F : J ⥤ Comma L R) [HasLimit (F ⋙ fst L R)] [HasLimit (F ⋙ snd L R)] [PreservesLimit (F ⋙ snd L R) R] : HasLimit F := HasLimit.mk ⟨_, coneOfPreservesIsLimit _ (limit.isLimit _) (limit.isLimit _)⟩ diff --git a/Mathlib/CategoryTheory/Presentable/Comma.lean b/Mathlib/CategoryTheory/Presentable/Comma.lean index fe9bc61d0b9bc5..58f8364dad29cd 100644 --- a/Mathlib/CategoryTheory/Presentable/Comma.lean +++ b/Mathlib/CategoryTheory/Presentable/Comma.lean @@ -166,18 +166,62 @@ lemma isCardinalPresentable_le instance [ObjectProperty.EssentiallySmall.{w} (isCardinalPresentable C₁ κ)] [ObjectProperty.EssentiallySmall.{w} (isCardinalPresentable C₂ κ)] [LocallySmall.{w} D] : - ObjectProperty.EssentiallySmall.{w} - (Comma.isCardinalPresentable F₁ F₂ κ) := by + ObjectProperty.EssentiallySmall.{w} (Comma.isCardinalPresentable F₁ F₂ κ) := by dsimp only [Comma.isCardinalPresentable] infer_instance -instance (f : Comma F₁ F₂) : - IsCardinalFiltered (CostructuredArrow (Comma.isCardinalPresentable F₁ F₂ κ).ι f) κ := by - sorry +namespace isCardinalAccessibleCategory + +variable {F₁ F₂} + [IsCardinalAccessibleCategory C₁ κ] [IsCardinalAccessibleCategory C₂ κ] + [F₁.IsCardinalAccessible κ] [F₂.IsCardinalAccessible κ] + [F₁.PreservesCardinalPresentable κ] [LocallySmall.{w} D] + +variable (f : Comma F₁ F₂) + +abbrev J := CostructuredArrow (Comma.isCardinalPresentable F₁ F₂ κ).ι f + +-- there must be some better way to define these functors +def π₁ : J κ f ⥤ CostructuredArrow (isCardinalPresentable C₁ κ).ι f.left where + obj g := CostructuredArrow.mk (Y := ⟨_, g.left.property.1⟩) (by exact g.hom.left) + map φ := CostructuredArrow.homMk (ObjectProperty.homMk (by exact φ.left.hom.left)) + (by exact congr_arg CommaMorphism.left (CostructuredArrow.w φ)) + +def π₂ : J κ f ⥤ CostructuredArrow (isCardinalPresentable C₂ κ).ι f.right where + obj g := CostructuredArrow.mk (Y := ⟨_, g.left.property.2⟩) (by exact g.hom.right) + map φ := CostructuredArrow.homMk (ObjectProperty.homMk (by exact φ.left.hom.right)) + (by exact congr_arg CommaMorphism.right (CostructuredArrow.w φ)) + +instance : (π₁ κ f).Final := sorry -instance : (Comma.isCardinalPresentable F₁ F₂ κ).ι.IsDense := by +instance : (π₂ κ f).Final := sorry + +instance : IsCardinalFiltered (J κ f) κ := by sorry +instance : PreservesColimitsOfShape (J κ f) F₁ := sorry + +abbrev functor : J κ f ⥤ Comma F₁ F₂ := + CostructuredArrow.proj (Comma.isCardinalPresentable F₁ F₂ κ).ι f ⋙ + (Comma.isCardinalPresentable F₁ F₂ κ).ι + +abbrev cocone : Cocone (functor κ f) := + (Functor.LeftExtension.mk (𝟭 (Comma F₁ F₂)) + (Comma.isCardinalPresentable F₁ F₂ κ).ι.rightUnitor.inv).coconeAt f + +noncomputable def isColimitCocone : IsColimit (cocone κ f) := by + refine Comma.fstSndJointlyReflectColimit ?_ ?_ + · exact (Functor.Final.isColimitWhiskerEquiv (π₁ κ f) _).2 + ((isCardinalPresentable C₁ κ).ι.denseAt f.left) + · exact (Functor.Final.isColimitWhiskerEquiv (π₂ κ f) _).2 + ((isCardinalPresentable C₂ κ).ι.denseAt f.right) + +instance [F₁.IsCardinalAccessible κ] : + (Comma.isCardinalPresentable F₁ F₂ κ).ι.IsDense where + isDenseAt f := ⟨isColimitCocone κ f⟩ + +end isCardinalAccessibleCategory + protected lemma isCardinalFilteredGenerator_isCardinalPresentable [IsCardinalAccessibleCategory C₁ κ] [IsCardinalAccessibleCategory C₂ κ] [F₁.IsCardinalAccessible κ] [F₂.IsCardinalAccessible κ] From 4eb980f9fb7d2d001162c552231fe8a91f559690 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 26 Jun 2026 16:21:21 +0200 Subject: [PATCH 254/309] wip --- Mathlib/CategoryTheory/Presentable/Comma.lean | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/Comma.lean b/Mathlib/CategoryTheory/Presentable/Comma.lean index 58f8364dad29cd..1451a93ca61760 100644 --- a/Mathlib/CategoryTheory/Presentable/Comma.lean +++ b/Mathlib/CategoryTheory/Presentable/Comma.lean @@ -192,14 +192,15 @@ def π₂ : J κ f ⥤ CostructuredArrow (isCardinalPresentable C₂ κ).ι f.ri map φ := CostructuredArrow.homMk (ObjectProperty.homMk (by exact φ.left.hom.right)) (by exact congr_arg CommaMorphism.right (CostructuredArrow.w φ)) +instance : IsCardinalFiltered (J κ f) κ := by + sorry + instance : (π₁ κ f).Final := sorry instance : (π₂ κ f).Final := sorry -instance : IsCardinalFiltered (J κ f) κ := by - sorry - -instance : PreservesColimitsOfShape (J κ f) F₁ := sorry +instance : PreservesColimitsOfShape (J κ f) F₁ := + F₁.preservesColimitsOfShape_of_isCardinalAccessible_of_essentiallySmall κ _ abbrev functor : J κ f ⥤ Comma F₁ F₂ := CostructuredArrow.proj (Comma.isCardinalPresentable F₁ F₂ κ).ι f ⋙ From b2d6c750c3142bda479679114359d281cfc17a84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 26 Jun 2026 17:41:10 +0200 Subject: [PATCH 255/309] wip --- Mathlib/CategoryTheory/Presentable/Comma.lean | 70 +++++++++++++++++-- 1 file changed, 63 insertions(+), 7 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/Comma.lean b/Mathlib/CategoryTheory/Presentable/Comma.lean index 1451a93ca61760..21474b9e7d51c9 100644 --- a/Mathlib/CategoryTheory/Presentable/Comma.lean +++ b/Mathlib/CategoryTheory/Presentable/Comma.lean @@ -175,33 +175,89 @@ namespace isCardinalAccessibleCategory variable {F₁ F₂} [IsCardinalAccessibleCategory C₁ κ] [IsCardinalAccessibleCategory C₂ κ] [F₁.IsCardinalAccessible κ] [F₂.IsCardinalAccessible κ] - [F₁.PreservesCardinalPresentable κ] [LocallySmall.{w} D] + [F₁.PreservesCardinalPresentable κ] + [F₂.PreservesCardinalPresentable κ] [LocallySmall.{w} D] variable (f : Comma F₁ F₂) abbrev J := CostructuredArrow (Comma.isCardinalPresentable F₁ F₂ κ).ι f +abbrev J₁ := CostructuredArrow (isCardinalPresentable C₁ κ).ι f.left +abbrev J₂ := CostructuredArrow (isCardinalPresentable C₂ κ).ι f.right + +instance : IsFiltered (J₁ κ f) := isFiltered_of_isCardinalFiltered _ κ + +instance : IsFiltered (J₂ κ f) := isFiltered_of_isCardinalFiltered _ κ + +attribute [local instance] IsFiltered.nonempty -- there must be some better way to define these functors -def π₁ : J κ f ⥤ CostructuredArrow (isCardinalPresentable C₁ κ).ι f.left where +@[simps] +def π₁ : J κ f ⥤ J₁ κ f where obj g := CostructuredArrow.mk (Y := ⟨_, g.left.property.1⟩) (by exact g.hom.left) map φ := CostructuredArrow.homMk (ObjectProperty.homMk (by exact φ.left.hom.left)) (by exact congr_arg CommaMorphism.left (CostructuredArrow.w φ)) -def π₂ : J κ f ⥤ CostructuredArrow (isCardinalPresentable C₂ κ).ι f.right where +@[simps] +def π₂ : J κ f ⥤ J₂ κ f where obj g := CostructuredArrow.mk (Y := ⟨_, g.left.property.2⟩) (by exact g.hom.right) map φ := CostructuredArrow.homMk (ObjectProperty.homMk (by exact φ.left.hom.right)) (by exact congr_arg CommaMorphism.right (CostructuredArrow.w φ)) -instance : IsCardinalFiltered (J κ f) κ := by - sorry +instance : PreservesColimitsOfShape (J₁ κ f) F₁ := + F₁.preservesColimitsOfShape_of_isCardinalAccessible_of_essentiallySmall κ _ -instance : (π₁ κ f).Final := sorry +instance : PreservesColimitsOfShape (J₂ κ f) F₂ := + F₂.preservesColimitsOfShape_of_isCardinalAccessible_of_essentiallySmall κ _ -instance : (π₂ κ f).Final := sorry +instance : IsCardinalFiltered (J κ f) κ := by + sorry instance : PreservesColimitsOfShape (J κ f) F₁ := F₁.preservesColimitsOfShape_of_isCardinalAccessible_of_essentiallySmall κ _ +instance : IsFiltered (J κ f) := + isFiltered_of_isCardinalFiltered _ κ + +set_option backward.defeqAttrib.useBackward true in +instance : (π₁ κ f).Final := by + rw [Functor.final_iff_of_isFiltered] + refine ⟨fun d ↦ ?_, ?_⟩ + · obtain ⟨g, a, ha⟩ := IsCardinalPresentable.exists_hom_of_isColimit κ + (isColimitOfPreserves F₂ ((isCardinalPresentable C₂ κ).ι.denseAt f.right)) + (F₁.map d.hom ≫ f.hom) + dsimp at a ha + simp only [Category.id_comp] at ha + refine ⟨CostructuredArrow.mk (Y := ⟨Comma.mk _ _ a, ?_⟩) + { left := by exact d.hom + right := by exact g.hom + w := ha.symm }, ⟨?_⟩⟩ + · exact CostructuredArrow.homMk (ObjectProperty.homMk (𝟙 _)) (by simp) + · exact ⟨d.left.property, g.left.property⟩ + · sorry + +set_option backward.defeqAttrib.useBackward true in +instance : (π₂ κ f).Final := by + rw [Functor.final_iff_of_isFiltered] + refine ⟨fun d ↦ ?_, ?_⟩ + · let j₁ : J₁ κ f := Classical.arbitrary _ + obtain ⟨e : J₂ κ f, a, ha⟩ := IsCardinalPresentable.exists_hom_of_isColimit κ + (isColimitOfPreserves F₂ ((isCardinalPresentable C₂ κ).ι.denseAt f.right)) + (F₁.map j₁.hom ≫ f.hom) + dsimp at a ha + simp only [Category.id_comp] at ha + refine ⟨CostructuredArrow.mk + (Y := ⟨Comma.mk _ _ (a ≫ F₂.map (IsFiltered.rightToMax d e).left.hom), + ⟨j₁.left.property, (IsFiltered.max d e).left.property⟩⟩) + { left := by exact j₁.hom + right := by exact (IsFiltered.max d e).hom + w := ?_ }, + ⟨by exact IsFiltered.leftToMax d e⟩⟩ + dsimp + rw [Category.assoc, ← ha, ← F₂.map_comp, + ← CostructuredArrow.w (IsFiltered.rightToMax d e)] + dsimp + · sorry + abbrev functor : J κ f ⥤ Comma F₁ F₂ := CostructuredArrow.proj (Comma.isCardinalPresentable F₁ F₂ κ).ι f ⋙ (Comma.isCardinalPresentable F₁ F₂ κ).ι From 855adb6b1d57909c37495b488a73954e7001e1f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 26 Jun 2026 19:46:21 +0200 Subject: [PATCH 256/309] wip --- Mathlib/CategoryTheory/Presentable/Comma.lean | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/Comma.lean b/Mathlib/CategoryTheory/Presentable/Comma.lean index 21474b9e7d51c9..51caac9bee0ad7 100644 --- a/Mathlib/CategoryTheory/Presentable/Comma.lean +++ b/Mathlib/CategoryTheory/Presentable/Comma.lean @@ -221,7 +221,7 @@ instance : IsFiltered (J κ f) := set_option backward.defeqAttrib.useBackward true in instance : (π₁ κ f).Final := by rw [Functor.final_iff_of_isFiltered] - refine ⟨fun d ↦ ?_, ?_⟩ + refine ⟨fun d ↦ ?_, fun {d e} g₁ g₂ ↦ ?_⟩ · obtain ⟨g, a, ha⟩ := IsCardinalPresentable.exists_hom_of_isColimit κ (isColimitOfPreserves F₂ ((isCardinalPresentable C₂ κ).ι.denseAt f.right)) (F₁.map d.hom ≫ f.hom) @@ -233,12 +233,13 @@ instance : (π₁ κ f).Final := by w := ha.symm }, ⟨?_⟩⟩ · exact CostructuredArrow.homMk (ObjectProperty.homMk (𝟙 _)) (by simp) · exact ⟨d.left.property, g.left.property⟩ - · sorry + · refine ⟨?_, sorry⟩ + sorry set_option backward.defeqAttrib.useBackward true in instance : (π₂ κ f).Final := by rw [Functor.final_iff_of_isFiltered] - refine ⟨fun d ↦ ?_, ?_⟩ + refine ⟨fun d ↦ ?_, fun {d e} f₁ f₂ ↦ ?_⟩ · let j₁ : J₁ κ f := Classical.arbitrary _ obtain ⟨e : J₂ κ f, a, ha⟩ := IsCardinalPresentable.exists_hom_of_isColimit κ (isColimitOfPreserves F₂ ((isCardinalPresentable C₂ κ).ι.denseAt f.right)) @@ -256,7 +257,25 @@ instance : (π₂ κ f).Final := by rw [Category.assoc, ← ha, ← F₂.map_comp, ← CostructuredArrow.w (IsFiltered.rightToMax d e)] dsimp - · sorry + · obtain ⟨j₂, a, ha⟩ := IsCardinalPresentable.exists_eq_of_isColimit' + κ ((isCardinalPresentable C₂ κ).ι.denseAt f.right) + (i := (π₂ κ f).obj e) f₁.left.hom f₂.left.hom (by + simp [dsimp% CostructuredArrow.w f₁, dsimp% CostructuredArrow.w f₂]) + refine ⟨CostructuredArrow.mk + (Y := ⟨Comma.mk _ _ (e.left.obj.hom ≫ F₂.map a.left.hom), + ⟨e.left.property.1, j₂.left.property⟩⟩) + { left := e.hom.left + right := by exact j₂.hom + w := by simp [← dsimp% CostructuredArrow.w a] }, + CostructuredArrow.homMk (ObjectProperty.homMk + { left := 𝟙 _ + right := by exact a.left.hom }) ?_, ?_⟩ + · dsimp + ext + · simp + · exact CostructuredArrow.w a + · ext + simpa abbrev functor : J κ f ⥤ Comma F₁ F₂ := CostructuredArrow.proj (Comma.isCardinalPresentable F₁ F₂ κ).ι f ⋙ From 3545b3543942e535a83a7c8015c5a64156effd20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 26 Jun 2026 19:56:09 +0200 Subject: [PATCH 257/309] wip --- Mathlib/CategoryTheory/Presentable/Comma.lean | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Presentable/Comma.lean b/Mathlib/CategoryTheory/Presentable/Comma.lean index 51caac9bee0ad7..df30b6403b8810 100644 --- a/Mathlib/CategoryTheory/Presentable/Comma.lean +++ b/Mathlib/CategoryTheory/Presentable/Comma.lean @@ -210,7 +210,10 @@ instance : PreservesColimitsOfShape (J₂ κ f) F₂ := F₂.preservesColimitsOfShape_of_isCardinalAccessible_of_essentiallySmall κ _ instance : IsCardinalFiltered (J κ f) κ := by - sorry + rw [isCardinalFiltered_iff] + refine ⟨fun ι j hι ↦ ?_, fun ι j k g hι ↦ ?_⟩ + · sorry + · sorry instance : PreservesColimitsOfShape (J κ f) F₁ := F₁.preservesColimitsOfShape_of_isCardinalAccessible_of_essentiallySmall κ _ From ff1af14baeb2362ff1b6341d57607dcb1f20cb87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Mon, 29 Jun 2026 23:41:35 +0200 Subject: [PATCH 258/309] wip --- Mathlib/CategoryTheory/Presentable/Comma.lean | 188 ++++++++++++------ .../Presentable/IsCardinalFiltered.lean | 19 ++ 2 files changed, 147 insertions(+), 60 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/Comma.lean b/Mathlib/CategoryTheory/Presentable/Comma.lean index df30b6403b8810..0b7916830126e8 100644 --- a/Mathlib/CategoryTheory/Presentable/Comma.lean +++ b/Mathlib/CategoryTheory/Presentable/Comma.lean @@ -190,30 +190,134 @@ instance : IsFiltered (J₂ κ f) := isFiltered_of_isCardinalFiltered _ κ attribute [local instance] IsFiltered.nonempty +abbrev J.fst (g : J κ f) : J₁ κ f := + CostructuredArrow.mk (Y := ⟨_, g.left.property.1⟩) (by exact g.hom.left) + +abbrev J.snd (g : J κ f) : J₂ κ f := + CostructuredArrow.mk (Y := ⟨_, g.left.property.2⟩) (by exact g.hom.right) -- there must be some better way to define these functors @[simps] def π₁ : J κ f ⥤ J₁ κ f where - obj g := CostructuredArrow.mk (Y := ⟨_, g.left.property.1⟩) (by exact g.hom.left) + obj g := g.fst map φ := CostructuredArrow.homMk (ObjectProperty.homMk (by exact φ.left.hom.left)) (by exact congr_arg CommaMorphism.left (CostructuredArrow.w φ)) @[simps] def π₂ : J κ f ⥤ J₂ κ f where - obj g := CostructuredArrow.mk (Y := ⟨_, g.left.property.2⟩) (by exact g.hom.right) + obj g := g.snd map φ := CostructuredArrow.homMk (ObjectProperty.homMk (by exact φ.left.hom.right)) (by exact congr_arg CommaMorphism.right (CostructuredArrow.w φ)) +section + +variable {κ f} + +abbrev J.mk (j₁ : J₁ κ f) (j₂ : J₂ κ f) (g : F₁.obj j₁.left.obj ⟶ F₂.obj j₂.left.obj) + (w : F₁.map j₁.hom ≫ f.hom = g ≫ F₂.map j₂.hom := by cat_disch) : + J κ f := + CostructuredArrow.mk (Y := ⟨Comma.mk _ _ g, j₁.left.property, j₂.left.property⟩) + { left := by exact j₁.hom + right := by exact j₂.hom } + +abbrev J.homMk {j j' : J κ f} (g₁ : j.fst ⟶ j'.fst) (g₂ : j.snd ⟶ j'.snd) + (h : F₁.map g₁.left.hom ≫ j'.left.obj.hom = + j.left.obj.hom ≫ F₂.map g₂.left.hom := by cat_disch) : + j ⟶ j' := + CostructuredArrow.homMk (ObjectProperty.homMk + { left := g₁.left.hom + right := g₂.left.hom }) (by + ext + · simpa using! CostructuredArrow.w g₁ + · simpa using! CostructuredArrow.w g₂) + +set_option backward.defeqAttrib.useBackward true in +lemma J.exists_hom {j j' : J κ f} (g₁ : j.fst ⟶ j'.fst) (g₂ : j.snd ⟶ j'.snd) : + ∃ (j'' : J κ f) (a : j ⟶ j'') (b : j' ⟶ j''), + g₁.left.hom ≫ b.left.hom.left = a.left.hom.left ∧ + g₂.left.hom ≫ b.left.hom.right = a.left.hom.right := by + have := Functor.preservesColimitsOfShape_of_isCardinalAccessible_of_essentiallySmall + F₂ κ (J₂ κ f) + obtain ⟨j₂, a, ha⟩ : + ∃ (j₂ : J₂ κ f) (a : j'.snd ⟶ j₂), + F₁.map g₁.left.hom ≫ j'.left.obj.hom ≫ F₂.map a.left.hom = + j.left.obj.hom ≫ F₂.map g₂.left.hom ≫ F₂.map a.left.hom := by + obtain ⟨j₂, a, ha⟩ := IsCardinalPresentable.exists_eq_of_isColimit' κ + (isColimitOfPreserves F₂ ((isCardinalPresentable C₂ κ).ι.denseAt f.right)) + (i := j'.snd) (F₁.map g₁.left.hom ≫ j'.left.obj.hom) + (j.left.obj.hom ≫ F₂.map g₂.left.hom) (by + dsimp + rw [Category.id_comp, Category.assoc, Category.assoc, ← Functor.map_comp, + ← dsimp% j'.hom.w, ← Functor.map_comp_assoc, dsimp% CostructuredArrow.w g₁, + dsimp% j.hom.w, dsimp% CostructuredArrow.w g₂]) + exact ⟨j₂, a, by cat_disch⟩ + exact ⟨J.mk j'.fst j₂ (j'.left.obj.hom ≫ F₂.map a.left.hom) + (by simp [← dsimp% (CostructuredArrow.w a)]), J.homMk g₁ (g₂ ≫ a) (by simpa), + J.homMk (𝟙 _) a (by simp), by simp⟩ + +set_option backward.defeqAttrib.useBackward true in +lemma exists_of_j₁_of_j₂ (j₁ : J₁ κ f) (j₂ : J₂ κ f) : + ∃ (j : J κ f) (_ : j₁ ⟶ j.fst), Nonempty (j₂ ⟶ j.snd) := by + have := Functor.preservesColimitsOfShape_of_isCardinalAccessible_of_essentiallySmall F₂ κ + (J₂ κ f) + obtain ⟨j₂', a, ha, ⟨b⟩⟩ : + ∃ (j₂' : J₂ κ f) (a : F₁.obj j₁.left.obj ⟶ F₂.obj j₂'.left.obj), + a ≫ F₂.map j₂'.hom = F₁.map j₁.hom ≫ f.hom ∧ Nonempty (j₂ ⟶ j₂') := by + obtain ⟨k, a, ha⟩ := IsCardinalPresentable.exists_hom_of_isColimit κ + (isColimitOfPreserves F₂ ((isCardinalPresentable C₂ κ).ι.denseAt f.right)) + (F₁.map j₁.hom ≫ f.hom) + dsimp at ha + simp only [Category.id_comp] at ha + obtain ⟨j₂', b, c, _⟩ := IsFilteredOrEmpty.cocone_objs j₂ k + exact ⟨j₂', a ≫ F₂.map c.left.hom, + by simp [← ha, ← Functor.map_comp, dsimp% CostructuredArrow.w c], ⟨b⟩⟩ + exact ⟨J.mk j₁ j₂' a, 𝟙 _, ⟨b⟩⟩ + +lemma exists_of_j₁ (j₁ : J₁ κ f) : + ∃ (j : J κ f), Nonempty (j₁ ⟶ j.fst) := by + obtain ⟨j, a, _⟩ := exists_of_j₁_of_j₂ j₁ (Classical.arbitrary _) + exact ⟨j, ⟨a⟩⟩ + +lemma exists_of_j₂ (j₂ : J₂ κ f) : + ∃ (j : J κ f), Nonempty (j₂ ⟶ j.snd) := by + obtain ⟨j, _, ⟨a⟩⟩ := exists_of_j₁_of_j₂ (Classical.arbitrary _) j₂ + exact ⟨j, ⟨a⟩⟩ + +end + instance : PreservesColimitsOfShape (J₁ κ f) F₁ := F₁.preservesColimitsOfShape_of_isCardinalAccessible_of_essentiallySmall κ _ instance : PreservesColimitsOfShape (J₂ κ f) F₂ := F₂.preservesColimitsOfShape_of_isCardinalAccessible_of_essentiallySmall κ _ +open IsCardinalFiltered in + +--set_option backward.isDefEq.respectTransparency false in +set_option backward.defeqAttrib.useBackward true in instance : IsCardinalFiltered (J κ f) κ := by - rw [isCardinalFiltered_iff] - refine ⟨fun ι j hι ↦ ?_, fun ι j k g hι ↦ ?_⟩ - · sorry + rw [isCardinalFiltered_iff'] + refine ⟨fun ι j hι ↦ ?_, fun ι j k g hι hι' ↦ ?_⟩ · sorry + · let g₁ (i : ι) := (π₁ κ f).map (g i) + let g₂ (i : ι) := (π₂ κ f).map (g i) + obtain ⟨l, a, ⟨b⟩⟩ := + exists_of_j₁_of_j₂ (coeq g₁ hι) (coeq g₂ hι) + obtain ⟨l', c, d, h₁, h₂⟩ := J.exists_hom (coeqHom g₁ hι ≫ a) (coeqHom g₂ hι ≫ b) + refine ⟨l', c, J.homMk (toCoeq g₁ hι ≫ a ≫ (π₁ κ f).map d) + (toCoeq g₂ hι ≫ b ≫ (π₂ κ f).map d) ?_, fun i ↦ ?_⟩ + · let i : ι := Classical.arbitrary _ + dsimp + rw [← dsimp% coeq_condition g₁ hι i, ← dsimp% coeq_condition g₂ hι i] + dsimp at h₁ h₂ ⊢ + simp only [Category.assoc] at h₁ h₂ ⊢ + rw [h₁, h₂] + simp only [Functor.map_comp, Category.assoc, CommaMorphism.w] + simp only [← Category.assoc] + congr 1 + exact (g i).left.hom.w + · ext + · simp [← dsimp% [g₁] coeq_condition g₁ hι i, ← h₁, g₁] + · simp [← dsimp% [g₂] coeq_condition g₂ hι i, ← h₂, g₂] instance : PreservesColimitsOfShape (J κ f) F₁ := F₁.preservesColimitsOfShape_of_isCardinalAccessible_of_essentiallySmall κ _ @@ -224,61 +328,26 @@ instance : IsFiltered (J κ f) := set_option backward.defeqAttrib.useBackward true in instance : (π₁ κ f).Final := by rw [Functor.final_iff_of_isFiltered] - refine ⟨fun d ↦ ?_, fun {d e} g₁ g₂ ↦ ?_⟩ - · obtain ⟨g, a, ha⟩ := IsCardinalPresentable.exists_hom_of_isColimit κ - (isColimitOfPreserves F₂ ((isCardinalPresentable C₂ κ).ι.denseAt f.right)) - (F₁.map d.hom ≫ f.hom) - dsimp at a ha - simp only [Category.id_comp] at ha - refine ⟨CostructuredArrow.mk (Y := ⟨Comma.mk _ _ a, ?_⟩) - { left := by exact d.hom - right := by exact g.hom - w := ha.symm }, ⟨?_⟩⟩ - · exact CostructuredArrow.homMk (ObjectProperty.homMk (𝟙 _)) (by simp) - · exact ⟨d.left.property, g.left.property⟩ - · refine ⟨?_, sorry⟩ - sorry + refine ⟨exists_of_j₁, fun {d e} g₁ g₂ ↦ ?_⟩ + obtain ⟨j₁, a, ha⟩ := IsFilteredOrEmpty.cocone_maps g₁ g₂ + obtain ⟨j, b, ⟨c⟩⟩ := exists_of_j₁_of_j₂ j₁ e.snd + obtain ⟨j', g, h, h₁, h₂⟩ := J.exists_hom (a ≫ b) c + refine ⟨j', g, ?_⟩ + ext + simp [← h₁, reassoc_of% dsimp% (CostructuredArrow.proj _ _ ⋙ + ObjectProperty.ι _).congr_map ha] set_option backward.defeqAttrib.useBackward true in instance : (π₂ κ f).Final := by rw [Functor.final_iff_of_isFiltered] - refine ⟨fun d ↦ ?_, fun {d e} f₁ f₂ ↦ ?_⟩ - · let j₁ : J₁ κ f := Classical.arbitrary _ - obtain ⟨e : J₂ κ f, a, ha⟩ := IsCardinalPresentable.exists_hom_of_isColimit κ - (isColimitOfPreserves F₂ ((isCardinalPresentable C₂ κ).ι.denseAt f.right)) - (F₁.map j₁.hom ≫ f.hom) - dsimp at a ha - simp only [Category.id_comp] at ha - refine ⟨CostructuredArrow.mk - (Y := ⟨Comma.mk _ _ (a ≫ F₂.map (IsFiltered.rightToMax d e).left.hom), - ⟨j₁.left.property, (IsFiltered.max d e).left.property⟩⟩) - { left := by exact j₁.hom - right := by exact (IsFiltered.max d e).hom - w := ?_ }, - ⟨by exact IsFiltered.leftToMax d e⟩⟩ - dsimp - rw [Category.assoc, ← ha, ← F₂.map_comp, - ← CostructuredArrow.w (IsFiltered.rightToMax d e)] - dsimp - · obtain ⟨j₂, a, ha⟩ := IsCardinalPresentable.exists_eq_of_isColimit' - κ ((isCardinalPresentable C₂ κ).ι.denseAt f.right) - (i := (π₂ κ f).obj e) f₁.left.hom f₂.left.hom (by - simp [dsimp% CostructuredArrow.w f₁, dsimp% CostructuredArrow.w f₂]) - refine ⟨CostructuredArrow.mk - (Y := ⟨Comma.mk _ _ (e.left.obj.hom ≫ F₂.map a.left.hom), - ⟨e.left.property.1, j₂.left.property⟩⟩) - { left := e.hom.left - right := by exact j₂.hom - w := by simp [← dsimp% CostructuredArrow.w a] }, - CostructuredArrow.homMk (ObjectProperty.homMk - { left := 𝟙 _ - right := by exact a.left.hom }) ?_, ?_⟩ - · dsimp - ext - · simp - · exact CostructuredArrow.w a - · ext - simpa + refine ⟨exists_of_j₂, fun {d e} g₁ g₂ ↦ ?_⟩ + obtain ⟨j₂, a, ha⟩ := IsFilteredOrEmpty.cocone_maps g₁ g₂ + obtain ⟨j, b, ⟨c⟩⟩ := exists_of_j₁_of_j₂ e.fst j₂ + obtain ⟨j', g, h, h₁, h₂⟩ := J.exists_hom b (a ≫ c) + refine ⟨j', g, ?_⟩ + ext + simp [← h₂, reassoc_of% dsimp% (CostructuredArrow.proj _ _ ⋙ + ObjectProperty.ι _).congr_map ha] abbrev functor : J κ f ⥤ Comma F₁ F₂ := CostructuredArrow.proj (Comma.isCardinalPresentable F₁ F₂ κ).ι f ⋙ @@ -295,8 +364,7 @@ noncomputable def isColimitCocone : IsColimit (cocone κ f) := by · exact (Functor.Final.isColimitWhiskerEquiv (π₂ κ f) _).2 ((isCardinalPresentable C₂ κ).ι.denseAt f.right) -instance [F₁.IsCardinalAccessible κ] : - (Comma.isCardinalPresentable F₁ F₂ κ).ι.IsDense where +instance : (Comma.isCardinalPresentable F₁ F₂ κ).ι.IsDense where isDenseAt f := ⟨isColimitCocone κ f⟩ end isCardinalAccessibleCategory @@ -304,7 +372,7 @@ end isCardinalAccessibleCategory protected lemma isCardinalFilteredGenerator_isCardinalPresentable [IsCardinalAccessibleCategory C₁ κ] [IsCardinalAccessibleCategory C₂ κ] [F₁.IsCardinalAccessible κ] [F₂.IsCardinalAccessible κ] - [F₁.PreservesCardinalPresentable κ] [LocallySmall.{w} D] : + [F₁.PreservesCardinalPresentable κ] [F₂.PreservesCardinalPresentable κ] [LocallySmall.{w} D] : (Comma.isCardinalPresentable F₁ F₂ κ).IsCardinalFilteredGenerator κ := .mk' (isCardinalPresentable_le _ _ _) (fun f ↦ ⟨(CostructuredArrow (Comma.isCardinalPresentable F₁ F₂ κ).ι f), inferInstance, @@ -314,7 +382,7 @@ protected lemma isCardinalFilteredGenerator_isCardinalPresentable instance [IsCardinalAccessibleCategory C₁ κ] [IsCardinalAccessibleCategory C₂ κ] [F₁.IsCardinalAccessible κ] [F₂.IsCardinalAccessible κ] - [F₁.PreservesCardinalPresentable κ] [LocallySmall.{w} D] : + [F₁.PreservesCardinalPresentable κ] [F₂.PreservesCardinalPresentable κ] [LocallySmall.{w} D] : IsCardinalAccessibleCategory (Comma F₁ F₂) κ where exists_generator := ⟨_, inferInstance, Comma.isCardinalFilteredGenerator_isCardinalPresentable.{w} F₁ F₂ κ⟩ diff --git a/Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean b/Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean index 8be9d46f911933..61b69d956a3594 100644 --- a/Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean +++ b/Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean @@ -302,6 +302,25 @@ lemma isCardinalFiltered_iff : ι.app i := a i ≫ b ι.naturality _ _ f := by simpa using hb (Arrow.mk f) }⟩ +/-- Same as `isCardinalFiltered_iff`, but for the second condition involving +coequalizing morphisms, we assume that the index type `ι` is nonempty. -/ +lemma isCardinalFiltered_iff' : + IsCardinalFiltered J κ ↔ + (∀ ⦃ι : Type w⦄ (j : ι → J) (_ : HasCardinalLT ι κ), + ∃ (k : J), ∀ (i : ι), Nonempty (j i ⟶ k)) ∧ + ∀ ⦃ι : Type w⦄ ⦃j k : J⦄ (f : ι → (j ⟶ k)) (_ : HasCardinalLT ι κ) (_ : Nonempty ι), + ∃ (l : J) (a : k ⟶ l) (b : j ⟶ l), ∀ (i : ι), f i ≫ a = b := by + rw [isCardinalFiltered_iff] + refine ⟨fun h ↦ ⟨h.1, by tauto⟩, fun ⟨h₁, h₂⟩ ↦ ⟨h₁, fun ι j k f hι ↦ ?_⟩⟩ + by_cases hι' : Nonempty ι + · exact h₂ f hι hι' + · have := h₁ (fun (x : ULift.{w} (Fin 2)) ↦ match x with + | ULift.up 0 => j + | ULift.up 1 => k) + (hasCardinalLT_of_finite _ _ (Cardinal.IsRegular.aleph0_le Fact.out)) + obtain ⟨l, hl⟩ := this + exact ⟨l, (hl ⟨1⟩).some, (hl ⟨0⟩).some, by tauto⟩ + end lemma IsCardinalFiltered.multicoequalizer From ff752df1ee1a17bcc8a0f52689b8b706a86b8fa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 30 Jun 2026 00:02:25 +0200 Subject: [PATCH 259/309] wip --- .../Presentable/CardinalFilteredPresentation.lean | 6 +++++- Mathlib/CategoryTheory/Presentable/Comma.lean | 3 +-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean b/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean index da4e7248580c11..1ce67dbf3060bc 100644 --- a/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean +++ b/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean @@ -88,7 +88,11 @@ lemma mk' (h₁ : P ≤ isCardinalPresentable C κ) (_ : EssentiallySmall.{w} J) (_ : IsCardinalFiltered J κ), P.colimitsOfShape J X) : P.IsCardinalFilteredGenerator κ where le_isCardinalPresentable := h₁ - exists_colimitsOfShape := sorry + exists_colimitsOfShape X := by + obtain ⟨J, _, _, _, p⟩ := h₂ X + exact ⟨SmallModel.{w} J, inferInstance, + IsCardinalFiltered.of_equivalence κ (equivSmallModel.{w} J), + by rwa [← P.colimitsOfShape_congr (equivSmallModel.{w} J)]⟩ variable (h : P.IsCardinalFilteredGenerator κ) (X : C) diff --git a/Mathlib/CategoryTheory/Presentable/Comma.lean b/Mathlib/CategoryTheory/Presentable/Comma.lean index 0b7916830126e8..0bc4ba1af40b67 100644 --- a/Mathlib/CategoryTheory/Presentable/Comma.lean +++ b/Mathlib/CategoryTheory/Presentable/Comma.lean @@ -27,8 +27,7 @@ set_option backward.isDefEq.respectTransparency false in set_option backward.defeqAttrib.useBackward true in open IsFiltered in lemma IsCardinalPresentable.mk - {C : Type*} [Category* C] {X : C} {κ : Cardinal.{w}} - [Fact κ.IsRegular] + {C : Type*} [Category* C] {X : C} {κ : Cardinal.{w}} [Fact κ.IsRegular] (h : ∀ (J : Type w) (_ : Category.{w} J) (_ : IsCardinalFiltered J κ) (F : J ⥤ C) (c : Cocone F) (_ : IsColimit c), (∀ (g : X ⟶ c.pt), ∃ (j : J) (f : X ⟶ F.obj j), f ≫ c.ι.app j = g) ∧ From 652a870e4eb6c9cc34dafe40e6855d95105344c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 30 Jun 2026 00:15:18 +0200 Subject: [PATCH 260/309] wip --- .../CategoryTheory/ObjectProperty/Comma.lean | 7 +++++++ Mathlib/CategoryTheory/Presentable/Comma.lean | 21 +++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/Mathlib/CategoryTheory/ObjectProperty/Comma.lean b/Mathlib/CategoryTheory/ObjectProperty/Comma.lean index e9ff18dd9e53a9..ff9151d7d1299c 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/Comma.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/Comma.lean @@ -6,6 +6,7 @@ Authors: Joël Riou module public import Mathlib.CategoryTheory.ObjectProperty.Small +public import Mathlib.CategoryTheory.ObjectProperty.Retract /-! # Properties of objects in comma categories @@ -30,6 +31,12 @@ variable {F₁ F₂} in lemma comma_iff (X : Comma F₁ F₂) : comma F₁ F₂ P₁ P₂ X ↔ P₁ X.left ∧ P₂ X.right := Iff.rfl +instance [P₁.IsStableUnderRetracts] [P₂.IsStableUnderRetracts] : + (comma F₁ F₂ P₁ P₂).IsStableUnderRetracts where + of_retract r h := + ⟨P₁.prop_of_retract (r.map (Comma.fst _ _)) h.1, + P₂.prop_of_retract (r.map (Comma.snd _ _)) h.2⟩ + instance [ObjectProperty.Small.{w} P₁] [ObjectProperty.Small.{w} P₂] [LocallySmall.{w} D] : ObjectProperty.Small.{w} (comma F₁ F₂ P₁ P₂) := small_of_surjective diff --git a/Mathlib/CategoryTheory/Presentable/Comma.lean b/Mathlib/CategoryTheory/Presentable/Comma.lean index 0bc4ba1af40b67..6f1265441d6615 100644 --- a/Mathlib/CategoryTheory/Presentable/Comma.lean +++ b/Mathlib/CategoryTheory/Presentable/Comma.lean @@ -152,6 +152,7 @@ lemma isCardinalPresentable_mk {X₁ : C₁} {X₂ : C₂} protected def isCardinalPresentable : ObjectProperty (Comma F₁ F₂) := ObjectProperty.comma _ _ (isCardinalPresentable C₁ κ) (isCardinalPresentable C₂ κ) +deriving ObjectProperty.IsStableUnderRetracts lemma isCardinalPresentable_le [HasCardinalFilteredColimits C₁ κ] [HasCardinalFilteredColimits C₂ κ] @@ -386,6 +387,26 @@ instance [IsCardinalAccessibleCategory C₁ κ] [IsCardinalAccessibleCategory C exists_generator := ⟨_, inferInstance, Comma.isCardinalFilteredGenerator_isCardinalPresentable.{w} F₁ F₂ κ⟩ +protected lemma isCardinalPresentable_eq + [IsCardinalAccessibleCategory C₁ κ] [IsCardinalAccessibleCategory C₂ κ] + [F₁.IsCardinalAccessible κ] [F₂.IsCardinalAccessible κ] + [F₁.PreservesCardinalPresentable κ] [F₂.PreservesCardinalPresentable κ] + [LocallySmall.{w} D] : + Comma.isCardinalPresentable F₁ F₂ κ = isCardinalPresentable (Comma F₁ F₂) κ := by + rw [(Comma.isCardinalFilteredGenerator_isCardinalPresentable + F₁ F₂ κ).isPresentable_eq_retractClosure, + ObjectProperty.retractClosure_eq_self] + +protected lemma isCardinalPresentable_iff + [IsCardinalAccessibleCategory C₁ κ] [IsCardinalAccessibleCategory C₂ κ] + [F₁.IsCardinalAccessible κ] [F₂.IsCardinalAccessible κ] + [F₁.PreservesCardinalPresentable κ] [F₂.PreservesCardinalPresentable κ] + [LocallySmall.{w} D] (X : Comma F₁ F₂) : + IsCardinalPresentable X κ ↔ + IsCardinalPresentable X.left κ ∧ IsCardinalPresentable X.right κ := by + change _ ↔ Comma.isCardinalPresentable F₁ F₂ κ X + rw [Comma.isCardinalPresentable_eq] + end Comma end CategoryTheory From 8a9d92b6b194c9c430b1923dc3e12b49b5941a66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 30 Jun 2026 00:18:44 +0200 Subject: [PATCH 261/309] wip --- Mathlib/CategoryTheory/Presentable/Comma.lean | 39 ++++++++++++------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/Comma.lean b/Mathlib/CategoryTheory/Presentable/Comma.lean index 6f1265441d6615..74cbf24500b235 100644 --- a/Mathlib/CategoryTheory/Presentable/Comma.lean +++ b/Mathlib/CategoryTheory/Presentable/Comma.lean @@ -387,26 +387,39 @@ instance [IsCardinalAccessibleCategory C₁ κ] [IsCardinalAccessibleCategory C exists_generator := ⟨_, inferInstance, Comma.isCardinalFilteredGenerator_isCardinalPresentable.{w} F₁ F₂ κ⟩ -protected lemma isCardinalPresentable_eq - [IsCardinalAccessibleCategory C₁ κ] [IsCardinalAccessibleCategory C₂ κ] - [F₁.IsCardinalAccessible κ] [F₂.IsCardinalAccessible κ] - [F₁.PreservesCardinalPresentable κ] [F₂.PreservesCardinalPresentable κ] - [LocallySmall.{w} D] : +section + +variable + [IsCardinalAccessibleCategory C₁ κ] [IsCardinalAccessibleCategory C₂ κ] + [F₁.IsCardinalAccessible κ] [F₂.IsCardinalAccessible κ] + [F₁.PreservesCardinalPresentable κ] [F₂.PreservesCardinalPresentable κ] + [LocallySmall.{w} D] + +protected lemma isCardinalPresentable_eq : Comma.isCardinalPresentable F₁ F₂ κ = isCardinalPresentable (Comma F₁ F₂) κ := by rw [(Comma.isCardinalFilteredGenerator_isCardinalPresentable F₁ F₂ κ).isPresentable_eq_retractClosure, ObjectProperty.retractClosure_eq_self] -protected lemma isCardinalPresentable_iff - [IsCardinalAccessibleCategory C₁ κ] [IsCardinalAccessibleCategory C₂ κ] - [F₁.IsCardinalAccessible κ] [F₂.IsCardinalAccessible κ] - [F₁.PreservesCardinalPresentable κ] [F₂.PreservesCardinalPresentable κ] - [LocallySmall.{w} D] (X : Comma F₁ F₂) : - IsCardinalPresentable X κ ↔ - IsCardinalPresentable X.left κ ∧ IsCardinalPresentable X.right κ := by - change _ ↔ Comma.isCardinalPresentable F₁ F₂ κ X +variable {F₁ F₂} in +protected lemma isCardinalPresentable_iff (f : Comma F₁ F₂) : + IsCardinalPresentable f κ ↔ + IsCardinalPresentable f.left κ ∧ IsCardinalPresentable f.right κ := by + change _ ↔ Comma.isCardinalPresentable F₁ F₂ κ f rw [Comma.isCardinalPresentable_eq] +instance : (Comma.fst F₁ F₂).PreservesCardinalPresentable κ where + le_inverseImage_isCardinalPresentable f hf := by + simp only [Comma.isCardinalPresentable_iff] at hf + tauto + +instance : (Comma.snd F₁ F₂).PreservesCardinalPresentable κ where + le_inverseImage_isCardinalPresentable f hf := by + simp only [Comma.isCardinalPresentable_iff] at hf + tauto + +end + end Comma end CategoryTheory From 3ab30f05a3ee1eabd43f8ca8a5b7cae92e972dcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 30 Jun 2026 07:57:02 +0200 Subject: [PATCH 262/309] wip --- Mathlib/CategoryTheory/Presentable/Comma.lean | 31 ++++++++++--------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/Comma.lean b/Mathlib/CategoryTheory/Presentable/Comma.lean index 74cbf24500b235..27814ee0366ab6 100644 --- a/Mathlib/CategoryTheory/Presentable/Comma.lean +++ b/Mathlib/CategoryTheory/Presentable/Comma.lean @@ -255,22 +255,25 @@ lemma J.exists_hom {j j' : J κ f} (g₁ : j.fst ⟶ j'.fst) (g₂ : j.snd ⟶ j J.homMk (𝟙 _) a (by simp), by simp⟩ set_option backward.defeqAttrib.useBackward true in -lemma exists_of_j₁_of_j₂ (j₁ : J₁ κ f) (j₂ : J₂ κ f) : - ∃ (j : J κ f) (_ : j₁ ⟶ j.fst), Nonempty (j₂ ⟶ j.snd) := by +lemma exists_of_j₁_of_j₂' (j₁ : J₁ κ f) (j₂ : J₂ κ f) : + ∃ (j₂' : J₂ κ f) (a : j₂ ⟶ j₂') (b : F₁.obj j₁.left.obj ⟶ F₂.obj j₂'.left.obj), + F₁.map j₁.hom ≫ f.hom = b ≫ F₂.map j₂'.hom := by have := Functor.preservesColimitsOfShape_of_isCardinalAccessible_of_essentiallySmall F₂ κ (J₂ κ f) - obtain ⟨j₂', a, ha, ⟨b⟩⟩ : - ∃ (j₂' : J₂ κ f) (a : F₁.obj j₁.left.obj ⟶ F₂.obj j₂'.left.obj), - a ≫ F₂.map j₂'.hom = F₁.map j₁.hom ≫ f.hom ∧ Nonempty (j₂ ⟶ j₂') := by - obtain ⟨k, a, ha⟩ := IsCardinalPresentable.exists_hom_of_isColimit κ - (isColimitOfPreserves F₂ ((isCardinalPresentable C₂ κ).ι.denseAt f.right)) - (F₁.map j₁.hom ≫ f.hom) - dsimp at ha - simp only [Category.id_comp] at ha - obtain ⟨j₂', b, c, _⟩ := IsFilteredOrEmpty.cocone_objs j₂ k - exact ⟨j₂', a ≫ F₂.map c.left.hom, - by simp [← ha, ← Functor.map_comp, dsimp% CostructuredArrow.w c], ⟨b⟩⟩ - exact ⟨J.mk j₁ j₂' a, 𝟙 _, ⟨b⟩⟩ + obtain ⟨k, a, ha⟩ := IsCardinalPresentable.exists_hom_of_isColimit κ + (isColimitOfPreserves F₂ ((isCardinalPresentable C₂ κ).ι.denseAt f.right)) + (F₁.map j₁.hom ≫ f.hom) + dsimp at ha + simp only [Category.id_comp] at ha + obtain ⟨j₂', b, c, _⟩ := IsFilteredOrEmpty.cocone_objs j₂ k + refine ⟨j₂', b, a ≫ F₂.map c.left.hom, ?_⟩ + simp [← ha, ← Functor.map_comp, dsimp% CostructuredArrow.w c] + +set_option backward.defeqAttrib.useBackward true in +lemma exists_of_j₁_of_j₂ (j₁ : J₁ κ f) (j₂ : J₂ κ f) : + ∃ (j : J κ f) (_ : j₁ ⟶ j.fst), Nonempty (j₂ ⟶ j.snd) := by + obtain ⟨j₂', a, b, h⟩ := exists_of_j₁_of_j₂' j₁ j₂ + exact ⟨J.mk j₁ j₂' b h, 𝟙 _, ⟨a⟩⟩ lemma exists_of_j₁ (j₁ : J₁ κ f) : ∃ (j : J κ f), Nonempty (j₁ ⟶ j.fst) := by From 2230adce7e2ba6775766677253235788ba50f03e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 30 Jun 2026 09:44:11 +0200 Subject: [PATCH 263/309] wip --- Mathlib/CategoryTheory/Presentable/Comma.lean | 100 ++++++++++-------- .../Presentable/IsCardinalFiltered.lean | 5 + 2 files changed, 62 insertions(+), 43 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/Comma.lean b/Mathlib/CategoryTheory/Presentable/Comma.lean index 27814ee0366ab6..251d29a578e6f8 100644 --- a/Mathlib/CategoryTheory/Presentable/Comma.lean +++ b/Mathlib/CategoryTheory/Presentable/Comma.lean @@ -173,10 +173,6 @@ instance [ObjectProperty.EssentiallySmall.{w} (isCardinalPresentable C₁ κ)] namespace isCardinalAccessibleCategory variable {F₁ F₂} - [IsCardinalAccessibleCategory C₁ κ] [IsCardinalAccessibleCategory C₂ κ] - [F₁.IsCardinalAccessible κ] [F₂.IsCardinalAccessible κ] - [F₁.PreservesCardinalPresentable κ] - [F₂.PreservesCardinalPresentable κ] [LocallySmall.{w} D] variable (f : Comma F₁ F₂) @@ -184,9 +180,11 @@ abbrev J := CostructuredArrow (Comma.isCardinalPresentable F₁ F₂ κ).ι f abbrev J₁ := CostructuredArrow (isCardinalPresentable C₁ κ).ι f.left abbrev J₂ := CostructuredArrow (isCardinalPresentable C₂ κ).ι f.right -instance : IsFiltered (J₁ κ f) := isFiltered_of_isCardinalFiltered _ κ +instance [IsCardinalAccessibleCategory C₁ κ] : IsFiltered (J₁ κ f) := + isFiltered_of_isCardinalFiltered _ κ -instance : IsFiltered (J₂ κ f) := isFiltered_of_isCardinalFiltered _ κ +instance [IsCardinalAccessibleCategory C₂ κ] : IsFiltered (J₂ κ f) := + isFiltered_of_isCardinalFiltered _ κ attribute [local instance] IsFiltered.nonempty @@ -208,8 +206,6 @@ def π₂ : J κ f ⥤ J₂ κ f where map φ := CostructuredArrow.homMk (ObjectProperty.homMk (by exact φ.left.hom.right)) (by exact congr_arg CommaMorphism.right (CostructuredArrow.w φ)) -section - variable {κ f} abbrev J.mk (j₁ : J₁ κ f) (j₂ : J₂ κ f) (g : F₁.obj j₁.left.obj ⟶ F₂.obj j₂.left.obj) @@ -230,33 +226,42 @@ abbrev J.homMk {j j' : J κ f} (g₁ : j.fst ⟶ j'.fst) (g₂ : j.snd ⟶ j'.sn · simpa using! CostructuredArrow.w g₁ · simpa using! CostructuredArrow.w g₂) +section + +variable [IsCardinalAccessibleCategory C₂ κ] [F₂.IsCardinalAccessible κ] + [F₁.PreservesCardinalPresentable κ] + +set_option backward.defeqAttrib.useBackward true in +lemma J.exists_hom' + {j j' : J κ f} (g₁ : j.fst ⟶ j'.fst) (g₂ : j.snd ⟶ j'.snd) : + ∃ (j₂ : J₂ κ f) (a : j'.snd ⟶ j₂), + F₁.map g₁.left.hom ≫ j'.left.obj.hom ≫ F₂.map a.left.hom = + j.left.obj.hom ≫ F₂.map g₂.left.hom ≫ F₂.map a.left.hom := by + have := Functor.preservesColimitsOfShape_of_isCardinalAccessible_of_essentiallySmall + F₂ κ (J₂ κ f) + obtain ⟨j₂, a, ha⟩ := IsCardinalPresentable.exists_eq_of_isColimit' κ + (isColimitOfPreserves F₂ ((isCardinalPresentable C₂ κ).ι.denseAt f.right)) + (i := j'.snd) (F₁.map g₁.left.hom ≫ j'.left.obj.hom) + (j.left.obj.hom ≫ F₂.map g₂.left.hom) (by + dsimp + rw [Category.id_comp, Category.assoc, Category.assoc, ← Functor.map_comp, + ← dsimp% j'.hom.w, ← Functor.map_comp_assoc, dsimp% CostructuredArrow.w g₁, + dsimp% j.hom.w, dsimp% CostructuredArrow.w g₂]) + exact ⟨j₂, a, by cat_disch⟩ + set_option backward.defeqAttrib.useBackward true in lemma J.exists_hom {j j' : J κ f} (g₁ : j.fst ⟶ j'.fst) (g₂ : j.snd ⟶ j'.snd) : ∃ (j'' : J κ f) (a : j ⟶ j'') (b : j' ⟶ j''), g₁.left.hom ≫ b.left.hom.left = a.left.hom.left ∧ g₂.left.hom ≫ b.left.hom.right = a.left.hom.right := by - have := Functor.preservesColimitsOfShape_of_isCardinalAccessible_of_essentiallySmall - F₂ κ (J₂ κ f) - obtain ⟨j₂, a, ha⟩ : - ∃ (j₂ : J₂ κ f) (a : j'.snd ⟶ j₂), - F₁.map g₁.left.hom ≫ j'.left.obj.hom ≫ F₂.map a.left.hom = - j.left.obj.hom ≫ F₂.map g₂.left.hom ≫ F₂.map a.left.hom := by - obtain ⟨j₂, a, ha⟩ := IsCardinalPresentable.exists_eq_of_isColimit' κ - (isColimitOfPreserves F₂ ((isCardinalPresentable C₂ κ).ι.denseAt f.right)) - (i := j'.snd) (F₁.map g₁.left.hom ≫ j'.left.obj.hom) - (j.left.obj.hom ≫ F₂.map g₂.left.hom) (by - dsimp - rw [Category.id_comp, Category.assoc, Category.assoc, ← Functor.map_comp, - ← dsimp% j'.hom.w, ← Functor.map_comp_assoc, dsimp% CostructuredArrow.w g₁, - dsimp% j.hom.w, dsimp% CostructuredArrow.w g₂]) - exact ⟨j₂, a, by cat_disch⟩ + obtain ⟨j₂, a, ha⟩ := J.exists_hom' g₁ g₂ exact ⟨J.mk j'.fst j₂ (j'.left.obj.hom ≫ F₂.map a.left.hom) (by simp [← dsimp% (CostructuredArrow.w a)]), J.homMk g₁ (g₂ ≫ a) (by simpa), J.homMk (𝟙 _) a (by simp), by simp⟩ set_option backward.defeqAttrib.useBackward true in lemma exists_of_j₁_of_j₂' (j₁ : J₁ κ f) (j₂ : J₂ κ f) : - ∃ (j₂' : J₂ κ f) (a : j₂ ⟶ j₂') (b : F₁.obj j₁.left.obj ⟶ F₂.obj j₂'.left.obj), + ∃ (j₂' : J₂ κ f) (_ : j₂ ⟶ j₂') (b : F₁.obj j₁.left.obj ⟶ F₂.obj j₂'.left.obj), F₁.map j₁.hom ≫ f.hom = b ≫ F₂.map j₂'.hom := by have := Functor.preservesColimitsOfShape_of_isCardinalAccessible_of_essentiallySmall F₂ κ (J₂ κ f) @@ -280,13 +285,17 @@ lemma exists_of_j₁ (j₁ : J₁ κ f) : obtain ⟨j, a, _⟩ := exists_of_j₁_of_j₂ j₁ (Classical.arbitrary _) exact ⟨j, ⟨a⟩⟩ -lemma exists_of_j₂ (j₂ : J₂ κ f) : +lemma exists_of_j₂ [IsCardinalAccessibleCategory C₁ κ] (j₂ : J₂ κ f) : ∃ (j : J κ f), Nonempty (j₂ ⟶ j.snd) := by obtain ⟨j, _, ⟨a⟩⟩ := exists_of_j₁_of_j₂ (Classical.arbitrary _) j₂ exact ⟨j, ⟨a⟩⟩ end +variable [IsCardinalAccessibleCategory C₁ κ] [IsCardinalAccessibleCategory C₂ κ] + [F₁.IsCardinalAccessible κ] [F₂.IsCardinalAccessible κ] + [F₁.PreservesCardinalPresentable κ] [LocallySmall.{w} D] + instance : PreservesColimitsOfShape (J₁ κ f) F₁ := F₁.preservesColimitsOfShape_of_isCardinalAccessible_of_essentiallySmall κ _ @@ -300,7 +309,20 @@ set_option backward.defeqAttrib.useBackward true in instance : IsCardinalFiltered (J κ f) κ := by rw [isCardinalFiltered_iff'] refine ⟨fun ι j hι ↦ ?_, fun ι j k g hι hι' ↦ ?_⟩ - · sorry + · obtain ⟨j₁, ⟨a₁⟩⟩ := IsCardinalFiltered.exists_max (fun i ↦ (j i).fst) hι + obtain ⟨j₂, ⟨a₂⟩⟩ := IsCardinalFiltered.exists_max (fun i ↦ (j i).snd) hι + obtain ⟨j₂', b, c, h₁⟩ := exists_of_j₁_of_j₂' j₁ j₂ + have (i : ι) : ∃ (j₂'' : J₂ κ f) (d : j₂' ⟶ j₂''), + F₁.map (a₁ i).left.hom ≫ c = + (j i).left.obj.hom ≫ F₂.map (a₂ i).left.hom ≫ F₂.map b.left.hom := by + sorry + choose j₂'' d h₂ using this + dsimp at h₁ h₂ + obtain ⟨l, e, g, fac⟩ := wideSpan d hι + refine ⟨J.mk j₁ l (c ≫ F₂.map g.left.hom) ?_, fun i ↦ ⟨?_⟩⟩ + · dsimp + rw [h₁, Category.assoc, ← Functor.map_comp, dsimp% CostructuredArrow.w g] + · exact J.homMk (a₁ i) (a₂ i ≫ b ≫ g) (by simp [reassoc_of% h₂]) · let g₁ (i : ι) := (π₁ κ f).map (g i) let g₂ (i : ι) := (π₂ κ f).map (g i) obtain ⟨l, a, ⟨b⟩⟩ := @@ -352,14 +374,17 @@ instance : (π₂ κ f).Final := by simp [← h₂, reassoc_of% dsimp% (CostructuredArrow.proj _ _ ⋙ ObjectProperty.ι _).congr_map ha] +variable (κ f) in abbrev functor : J κ f ⥤ Comma F₁ F₂ := CostructuredArrow.proj (Comma.isCardinalPresentable F₁ F₂ κ).ι f ⋙ (Comma.isCardinalPresentable F₁ F₂ κ).ι +variable (κ f) in abbrev cocone : Cocone (functor κ f) := (Functor.LeftExtension.mk (𝟭 (Comma F₁ F₂)) (Comma.isCardinalPresentable F₁ F₂ κ).ι.rightUnitor.inv).coconeAt f +variable (κ f) in noncomputable def isColimitCocone : IsColimit (cocone κ f) := by refine Comma.fstSndJointlyReflectColimit ?_ ?_ · exact (Functor.Final.isColimitWhiskerEquiv (π₁ κ f) _).2 @@ -372,10 +397,11 @@ instance : (Comma.isCardinalPresentable F₁ F₂ κ).ι.IsDense where end isCardinalAccessibleCategory -protected lemma isCardinalFilteredGenerator_isCardinalPresentable - [IsCardinalAccessibleCategory C₁ κ] [IsCardinalAccessibleCategory C₂ κ] - [F₁.IsCardinalAccessible κ] [F₂.IsCardinalAccessible κ] - [F₁.PreservesCardinalPresentable κ] [F₂.PreservesCardinalPresentable κ] [LocallySmall.{w} D] : +variable [IsCardinalAccessibleCategory C₁ κ] [IsCardinalAccessibleCategory C₂ κ] + [F₁.IsCardinalAccessible κ] [F₂.IsCardinalAccessible κ] + [F₁.PreservesCardinalPresentable κ] [LocallySmall.{w} D] + +protected lemma isCardinalFilteredGenerator_isCardinalPresentable : (Comma.isCardinalPresentable F₁ F₂ κ).IsCardinalFilteredGenerator κ := .mk' (isCardinalPresentable_le _ _ _) (fun f ↦ ⟨(CostructuredArrow (Comma.isCardinalPresentable F₁ F₂ κ).ι f), inferInstance, @@ -383,21 +409,11 @@ protected lemma isCardinalFilteredGenerator_isCardinalPresentable ⟨_, _, (Comma.isCardinalPresentable F₁ F₂ κ).ι.denseAt f⟩, fun g ↦ g.left.property⟩) -instance [IsCardinalAccessibleCategory C₁ κ] [IsCardinalAccessibleCategory C₂ κ] - [F₁.IsCardinalAccessible κ] [F₂.IsCardinalAccessible κ] - [F₁.PreservesCardinalPresentable κ] [F₂.PreservesCardinalPresentable κ] [LocallySmall.{w} D] : +instance : IsCardinalAccessibleCategory (Comma F₁ F₂) κ where exists_generator := ⟨_, inferInstance, Comma.isCardinalFilteredGenerator_isCardinalPresentable.{w} F₁ F₂ κ⟩ -section - -variable - [IsCardinalAccessibleCategory C₁ κ] [IsCardinalAccessibleCategory C₂ κ] - [F₁.IsCardinalAccessible κ] [F₂.IsCardinalAccessible κ] - [F₁.PreservesCardinalPresentable κ] [F₂.PreservesCardinalPresentable κ] - [LocallySmall.{w} D] - protected lemma isCardinalPresentable_eq : Comma.isCardinalPresentable F₁ F₂ κ = isCardinalPresentable (Comma F₁ F₂) κ := by rw [(Comma.isCardinalFilteredGenerator_isCardinalPresentable @@ -421,8 +437,6 @@ instance : (Comma.snd F₁ F₂).PreservesCardinalPresentable κ where simp only [Comma.isCardinalPresentable_iff] at hf tauto -end - end Comma end CategoryTheory diff --git a/Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean b/Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean index 61b69d956a3594..e8c746368cd8a1 100644 --- a/Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean +++ b/Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean @@ -95,6 +95,11 @@ noncomputable def toMax (k : K) : S k ⟶ max S hS := (cocone (κ := κ) (Discrete.functor S) (by simpa using hS)).ι.app ⟨k⟩ +include hS in +lemma exists_max : + ∃ (j : J), Nonempty (∀ (k : K), S k ⟶ j) := + ⟨max S hS, ⟨toMax S hS⟩⟩ + end max section coeq From 6c065f780a0bc8b8bc921e163a055498bb0674ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 30 Jun 2026 10:03:41 +0200 Subject: [PATCH 264/309] sorry free --- Mathlib/CategoryTheory/Presentable/Comma.lean | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/Comma.lean b/Mathlib/CategoryTheory/Presentable/Comma.lean index 251d29a578e6f8..cd3dcd4d000111 100644 --- a/Mathlib/CategoryTheory/Presentable/Comma.lean +++ b/Mathlib/CategoryTheory/Presentable/Comma.lean @@ -303,8 +303,6 @@ instance : PreservesColimitsOfShape (J₂ κ f) F₂ := F₂.preservesColimitsOfShape_of_isCardinalAccessible_of_essentiallySmall κ _ open IsCardinalFiltered in - ---set_option backward.isDefEq.respectTransparency false in set_option backward.defeqAttrib.useBackward true in instance : IsCardinalFiltered (J κ f) κ := by rw [isCardinalFiltered_iff'] @@ -312,17 +310,23 @@ instance : IsCardinalFiltered (J κ f) κ := by · obtain ⟨j₁, ⟨a₁⟩⟩ := IsCardinalFiltered.exists_max (fun i ↦ (j i).fst) hι obtain ⟨j₂, ⟨a₂⟩⟩ := IsCardinalFiltered.exists_max (fun i ↦ (j i).snd) hι obtain ⟨j₂', b, c, h₁⟩ := exists_of_j₁_of_j₂' j₁ j₂ - have (i : ι) : ∃ (j₂'' : J₂ κ f) (d : j₂' ⟶ j₂''), - F₁.map (a₁ i).left.hom ≫ c = - (j i).left.obj.hom ≫ F₂.map (a₂ i).left.hom ≫ F₂.map b.left.hom := by - sorry - choose j₂'' d h₂ using this + choose j₂'' d h₂ using + fun i ↦ IsCardinalPresentable.exists_eq_of_isColimit' κ + (isColimitOfPreserves F₂ ((isCardinalPresentable C₂ κ).ι.denseAt f.right)) + (F₁.map (a₁ i).left.hom ≫ c) + ((j i).left.obj.hom ≫ F₂.map (a₂ i).left.hom ≫ F₂.map b.left.hom) (by + dsimp + rw [Category.id_comp, Category.assoc, Category.assoc, Category.assoc, + ← dsimp% h₁, ← F₁.map_comp_assoc, dsimp% CostructuredArrow.w (a₁ i), + ← F₂.map_comp, dsimp% CostructuredArrow.w b, ← F₂.map_comp, + dsimp% CostructuredArrow.w (a₂ i), dsimp% (j i).hom.w]) dsimp at h₁ h₂ + simp only [Category.assoc] at h₂ obtain ⟨l, e, g, fac⟩ := wideSpan d hι refine ⟨J.mk j₁ l (c ≫ F₂.map g.left.hom) ?_, fun i ↦ ⟨?_⟩⟩ · dsimp rw [h₁, Category.assoc, ← Functor.map_comp, dsimp% CostructuredArrow.w g] - · exact J.homMk (a₁ i) (a₂ i ≫ b ≫ g) (by simp [reassoc_of% h₂]) + · refine J.homMk (a₁ i) (a₂ i ≫ b ≫ g) (by simp [← fac i, reassoc_of% h₂]) · let g₁ (i : ι) := (π₁ κ f).map (g i) let g₂ (i : ι) := (π₂ κ f).map (g i) obtain ⟨l, a, ⟨b⟩⟩ := From bd464a02a5edf85c523c8b41b5910ec232923189 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 30 Jun 2026 10:17:29 +0200 Subject: [PATCH 265/309] fix --- Mathlib/CategoryTheory/Presentable/Comma.lean | 1 + 1 file changed, 1 insertion(+) diff --git a/Mathlib/CategoryTheory/Presentable/Comma.lean b/Mathlib/CategoryTheory/Presentable/Comma.lean index cd3dcd4d000111..049f0348be0e7c 100644 --- a/Mathlib/CategoryTheory/Presentable/Comma.lean +++ b/Mathlib/CategoryTheory/Presentable/Comma.lean @@ -3,6 +3,7 @@ Copyright (c) 2024 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ +module import Mathlib.CategoryTheory.Presentable.Dense import Mathlib.CategoryTheory.Presentable.LocallyPresentable From 5d41a35f8bdd5a9aac01cec12b8e4e9db7c1682d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 30 Jun 2026 10:17:43 +0200 Subject: [PATCH 266/309] fix --- Mathlib.lean | 1 + 1 file changed, 1 insertion(+) diff --git a/Mathlib.lean b/Mathlib.lean index 891834f17cfea0..532ec55e58a83c 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -3199,6 +3199,7 @@ public import Mathlib.CategoryTheory.ObjectProperty.ClosureShift public import Mathlib.CategoryTheory.ObjectProperty.ColimitsCardinalClosure public import Mathlib.CategoryTheory.ObjectProperty.ColimitsClosure public import Mathlib.CategoryTheory.ObjectProperty.ColimitsOfShape +public import Mathlib.CategoryTheory.ObjectProperty.Comma public import Mathlib.CategoryTheory.ObjectProperty.CompleteLattice public import Mathlib.CategoryTheory.ObjectProperty.ContainsZero public import Mathlib.CategoryTheory.ObjectProperty.EpiMono From 1c6703f611cfcaa2aec78cfe6fa25ba59c1fefb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 30 Jun 2026 10:30:46 +0200 Subject: [PATCH 267/309] wip --- Mathlib/CategoryTheory/Presentable/Comma.lean | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/Comma.lean b/Mathlib/CategoryTheory/Presentable/Comma.lean index 049f0348be0e7c..9639023d47a786 100644 --- a/Mathlib/CategoryTheory/Presentable/Comma.lean +++ b/Mathlib/CategoryTheory/Presentable/Comma.lean @@ -5,12 +5,12 @@ Authors: Joël Riou -/ module -import Mathlib.CategoryTheory.Presentable.Dense -import Mathlib.CategoryTheory.Presentable.LocallyPresentable -import Mathlib.CategoryTheory.Limits.Comma -import Mathlib.CategoryTheory.Limits.Final -import Mathlib.CategoryTheory.Comma.LocallySmall -import Mathlib.CategoryTheory.ObjectProperty.Comma +public import Mathlib.CategoryTheory.Presentable.Dense +public import Mathlib.CategoryTheory.Presentable.LocallyPresentable +public import Mathlib.CategoryTheory.Limits.Comma +public import Mathlib.CategoryTheory.Limits.Final +public import Mathlib.CategoryTheory.Comma.LocallySmall +public import Mathlib.CategoryTheory.ObjectProperty.Comma /-! # Comma categories are accessible @@ -19,6 +19,8 @@ import Mathlib.CategoryTheory.ObjectProperty.Comma universe w v₁ v₂ v₃ u₁ u₂ u₃ +@[expose] public section + namespace CategoryTheory open Limits From 9f21a021bb9f458a1499c9661f99b917189ecb55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 30 Jun 2026 11:05:43 +0200 Subject: [PATCH 268/309] feat(CategoryTheory): limits in Comma categories --- Mathlib/CategoryTheory/Limits/Comma.lean | 54 ++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/Mathlib/CategoryTheory/Limits/Comma.lean b/Mathlib/CategoryTheory/Limits/Comma.lean index 31172ac7aeb408..8d12fbfcd399a2 100644 --- a/Mathlib/CategoryTheory/Limits/Comma.lean +++ b/Mathlib/CategoryTheory/Limits/Comma.lean @@ -91,6 +91,33 @@ noncomputable def coneOfPreservesIsLimit [PreservesLimit (F ⋙ snd L R) R] {c · exact t₁.uniq ((fst L R).mapCone s) _ (fun j => by simp [← w]) · exact t₂.uniq ((snd L R).mapCone s) _ (fun j => by simp [← w]) +set_option backward.defeqAttrib.useBackward true in +/-- Let `F : J ⥤ Comma L R`. If `R` preserves the limit of +`F ⋙ snd _ _`, then `Comma.fst L R` and `Comma.snd L R` jointly +reflect the colimit of `F`, i.e. if `c` is a cone for `F` which +becomes a limit after applying `Comma.fst L R` and `Comma.snd L R`, +then `c` is a limit. -/ +def fstSndJointlyReflectLimit {F : J ⥤ Comma L R} {c : Cone F} + [PreservesLimit (F ⋙ snd _ _) R] + (h₁ : IsLimit ((fst _ _).mapCone c)) + (h₂ : IsLimit ((snd _ _).mapCone c)) : + IsLimit c where + lift s := + { left := h₁.lift ((fst _ _).mapCone s) + right := h₂.lift ((snd _ _).mapCone s) + w := (isLimitOfPreserves R h₂).hom_ext (fun j ↦ by + simp [← Functor.map_comp, ← Functor.map_comp_assoc, ← CommaMorphism.w, + dsimp% h₂.fac ((snd _ _).mapCone s) j, + dsimp% h₁.fac ((fst _ _).mapCone s) j]) } + fac s j := by + ext + · exact h₁.fac ((fst _ _).mapCone s) j + · exact h₂.fac ((snd _ _).mapCone s) j + uniq s m hm := by + ext + · exact h₁.uniq ((fst _ _).mapCone s) _ (fun j ↦ by simp [← hm]) + · exact h₂.uniq ((snd _ _).mapCone s) _ (fun j ↦ by simp [← hm]) + /-- (Implementation). An auxiliary cocone which is useful in order to construct colimits in the comma category. -/ @[simps!] @@ -141,6 +168,33 @@ noncomputable def coconeOfPreservesIsColimit [PreservesColimit (F ⋙ fst L R) L · exact t₁.uniq ((fst L R).mapCocone s) _ (fun j => by simp [← w]) · exact t₂.uniq ((snd L R).mapCocone s) _ (fun j => by simp [← w]) +set_option backward.defeqAttrib.useBackward true in +/-- Let `F : J ⥤ Comma L R`. If `L` preserves the colimit of +`F ⋙ fst _ _`, then `Comma.fst L R` and `Comma.snd L R` jointly +reflect the colimit of `F`, i.e. if `c` is a cocone for `F` which +becomes a colimit after applying `Comma.fst L R` and `Comma.snd L R`, +then `c` is a colimit. -/ +def fstSndJointlyReflectColimit {F : J ⥤ Comma L R} {c : Cocone F} + [PreservesColimit (F ⋙ fst _ _) L] + (h₁ : IsColimit ((fst _ _).mapCocone c)) + (h₂ : IsColimit ((snd _ _).mapCocone c)) : + IsColimit c where + desc s := + { left := h₁.desc ((fst _ _).mapCocone s) + right := h₂.desc ((snd _ _).mapCocone s) + w := (isColimitOfPreserves L h₁).hom_ext (fun j ↦ by + simp [← Functor.map_comp_assoc, ← Functor.map_comp, + dsimp% h₁.fac ((fst _ _).mapCocone s) j, + dsimp% h₂.fac ((snd _ _).mapCocone s) j]) } + fac s j := by + ext + · exact h₁.fac ((fst _ _).mapCocone s) j + · exact h₂.fac ((snd _ _).mapCocone s) j + uniq s m hm := by + ext + · exact h₁.uniq ((fst _ _).mapCocone s) _ (fun j ↦ by simp [← hm]) + · exact h₂.uniq ((snd _ _).mapCocone s) _ (fun j ↦ by simp [← hm]) + instance hasLimit (F : J ⥤ Comma L R) [HasLimit (F ⋙ fst L R)] [HasLimit (F ⋙ snd L R)] [PreservesLimit (F ⋙ snd L R) R] : HasLimit F := HasLimit.mk ⟨_, coneOfPreservesIsLimit _ (limit.isLimit _) (limit.isLimit _)⟩ From cfe94d2d8c47d4ca4f13eff4940025d1bb106af0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 30 Jun 2026 11:14:42 +0200 Subject: [PATCH 269/309] feat(CategoryTheory/Presentable): new constructor for `IsCardinalFilteredGenerator` --- .../Presentable/CardinalFilteredPresentation.lean | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean b/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean index ea4d3d2bcf4dd8..1ce67dbf3060bc 100644 --- a/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean +++ b/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean @@ -33,7 +33,7 @@ such that `P.IsCardinalFilteredGenerator κ` holds. public section -universe w v u +universe w₁ w₂ w v u namespace CategoryTheory @@ -83,6 +83,17 @@ structure IsCardinalFilteredGenerator : Prop where namespace IsCardinalFilteredGenerator +lemma mk' (h₁ : P ≤ isCardinalPresentable C κ) + (h₂ : ∀ (X : C), ∃ (J : Type w₁) (_ : Category.{w₂} J) + (_ : EssentiallySmall.{w} J) (_ : IsCardinalFiltered J κ), P.colimitsOfShape J X) : + P.IsCardinalFilteredGenerator κ where + le_isCardinalPresentable := h₁ + exists_colimitsOfShape X := by + obtain ⟨J, _, _, _, p⟩ := h₂ X + exact ⟨SmallModel.{w} J, inferInstance, + IsCardinalFiltered.of_equivalence κ (equivSmallModel.{w} J), + by rwa [← P.colimitsOfShape_congr (equivSmallModel.{w} J)]⟩ + variable (h : P.IsCardinalFilteredGenerator κ) (X : C) include h in From 4982e62cc70b4fee37a0464227badd30137b3d9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 30 Jun 2026 11:17:32 +0200 Subject: [PATCH 270/309] =?UTF-8?q?feat(CategoryTheory/Presentable):=20mor?= =?UTF-8?q?e=20basic=20API=20for=20=CE=BA-filtered=20categories?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Presentable/IsCardinalFiltered.lean | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean b/Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean index 8be9d46f911933..e8c746368cd8a1 100644 --- a/Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean +++ b/Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean @@ -95,6 +95,11 @@ noncomputable def toMax (k : K) : S k ⟶ max S hS := (cocone (κ := κ) (Discrete.functor S) (by simpa using hS)).ι.app ⟨k⟩ +include hS in +lemma exists_max : + ∃ (j : J), Nonempty (∀ (k : K), S k ⟶ j) := + ⟨max S hS, ⟨toMax S hS⟩⟩ + end max section coeq @@ -302,6 +307,25 @@ lemma isCardinalFiltered_iff : ι.app i := a i ≫ b ι.naturality _ _ f := by simpa using hb (Arrow.mk f) }⟩ +/-- Same as `isCardinalFiltered_iff`, but for the second condition involving +coequalizing morphisms, we assume that the index type `ι` is nonempty. -/ +lemma isCardinalFiltered_iff' : + IsCardinalFiltered J κ ↔ + (∀ ⦃ι : Type w⦄ (j : ι → J) (_ : HasCardinalLT ι κ), + ∃ (k : J), ∀ (i : ι), Nonempty (j i ⟶ k)) ∧ + ∀ ⦃ι : Type w⦄ ⦃j k : J⦄ (f : ι → (j ⟶ k)) (_ : HasCardinalLT ι κ) (_ : Nonempty ι), + ∃ (l : J) (a : k ⟶ l) (b : j ⟶ l), ∀ (i : ι), f i ≫ a = b := by + rw [isCardinalFiltered_iff] + refine ⟨fun h ↦ ⟨h.1, by tauto⟩, fun ⟨h₁, h₂⟩ ↦ ⟨h₁, fun ι j k f hι ↦ ?_⟩⟩ + by_cases hι' : Nonempty ι + · exact h₂ f hι hι' + · have := h₁ (fun (x : ULift.{w} (Fin 2)) ↦ match x with + | ULift.up 0 => j + | ULift.up 1 => k) + (hasCardinalLT_of_finite _ _ (Cardinal.IsRegular.aleph0_le Fact.out)) + obtain ⟨l, hl⟩ := this + exact ⟨l, (hl ⟨1⟩).some, (hl ⟨0⟩).some, by tauto⟩ + end lemma IsCardinalFiltered.multicoequalizer From f21777134ce2e79eb6aa01f98a35c42fee463d18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 30 Jun 2026 11:35:48 +0200 Subject: [PATCH 271/309] feat(CategoryTheory/Presentable): constructor for `IsCardinalPresentable` --- Mathlib/CategoryTheory/Presentable/Basic.lean | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Mathlib/CategoryTheory/Presentable/Basic.lean b/Mathlib/CategoryTheory/Presentable/Basic.lean index f1d14fbe781e7c..99877f0079fa07 100644 --- a/Mathlib/CategoryTheory/Presentable/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/Basic.lean @@ -237,6 +237,33 @@ lemma isCardinalPresentable_iff_of_isEquivalence · intro infer_instance +variable {X κ} in +set_option backward.isDefEq.respectTransparency false in +set_option backward.defeqAttrib.useBackward true in +open IsFiltered in +lemma IsCardinalPresentable.mk + (hX : ∀ (J : Type w) (_ : Category.{w} J) (_ : IsCardinalFiltered J κ) + (F : J ⥤ C) (c : Cocone F) (_ : IsColimit c), + (∀ (g : X ⟶ c.pt), ∃ (j : J) (f : X ⟶ F.obj j), f ≫ c.ι.app j = g) ∧ + (∀ (j : J) (f₁ f₂ : X ⟶ F.obj j) (_ : f₁ ≫ c.ι.app j = f₂ ≫ c.ι.app j), + ∃ (j' : J) (a : j ⟶ j'), f₁ ≫ F.map a = f₂ ≫ F.map a)) : + IsCardinalPresentable X κ where + preservesColimitOfShape J _ _ := + ⟨fun {F} ↦ ⟨fun {c} hc ↦ by + have := isFiltered_of_isCardinalFiltered J κ + rw [Types.isColimit_iff_coconeTypesIsColimit] + refine ⟨fun f₁ f₂ hf ↦ ?_, fun g ↦ ?_⟩ + · obtain ⟨j₁, f₁, rfl⟩ := Functor.ιColimitType_jointly_surjective _ f₁ + obtain ⟨j₂, f₂, rfl⟩ := Functor.ιColimitType_jointly_surjective _ f₂ + dsimp at f₁ f₂ hf + obtain ⟨j', a, ha⟩ := (hX J _ inferInstance F c hc).2 _ (f₁ ≫ F.map (leftToMax j₁ j₂)) + (f₂ ≫ F.map (rightToMax j₁ j₂)) (by simpa) + simp only [Category.assoc] at ha + exact Functor.ιColimitType_eq_of_map_eq_map _ _ _ + (leftToMax j₁ j₂ ≫ a) (rightToMax j₁ j₂ ≫ a) (by simpa) + · obtain ⟨j, f, rfl⟩ := (hX J _ inferInstance F c hc).1 g + exact ⟨Functor.ιColimitType _ j f, rfl⟩⟩⟩ + section variable {J : Type*} [Category* J] {D : J ⥤ C} From ad7f28fc4cadf5a96f296d68ab9d9f2d5abd9186 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 30 Jun 2026 11:47:11 +0200 Subject: [PATCH 272/309] =?UTF-8?q?feat(CategoryTheory/Presentable):=20fun?= =?UTF-8?q?ctors=20which=20preserves=20=CE=BA-presentable=20objects?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Mathlib.lean | 1 + Mathlib/CategoryTheory/Presentable/Basic.lean | 2 +- .../PreservesCardinalPresentable.lean | 61 +++++++++++++++++++ 3 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 Mathlib/CategoryTheory/Presentable/PreservesCardinalPresentable.lean diff --git a/Mathlib.lean b/Mathlib.lean index feceaf0c28726e..1ba35b6f9bb0c1 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -3273,6 +3273,7 @@ public import Mathlib.CategoryTheory.Presentable.IsCardinalFiltered public import Mathlib.CategoryTheory.Presentable.Limits public import Mathlib.CategoryTheory.Presentable.LocallyPresentable public import Mathlib.CategoryTheory.Presentable.OrthogonalReflection +public import Mathlib.CategoryTheory.Presentable.PreservesCardinalPresentable public import Mathlib.CategoryTheory.Presentable.Presheaf public import Mathlib.CategoryTheory.Presentable.Retracts public import Mathlib.CategoryTheory.Presentable.StrongGenerator diff --git a/Mathlib/CategoryTheory/Presentable/Basic.lean b/Mathlib/CategoryTheory/Presentable/Basic.lean index f1d14fbe781e7c..8c48205d815f1e 100644 --- a/Mathlib/CategoryTheory/Presentable/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/Basic.lean @@ -150,7 +150,7 @@ abbrev IsCardinalPresentable : Prop := (coyoneda.obj (op X)).IsCardinalAccessibl variable (C) in /-- The property of objects that are `κ`-presentable. -/ -def isCardinalPresentable : ObjectProperty C := fun X ↦ IsCardinalPresentable X κ +abbrev isCardinalPresentable : ObjectProperty C := fun X ↦ IsCardinalPresentable X κ instance (X : (isCardinalPresentable C κ).FullSubcategory) : IsCardinalPresentable X.obj κ := diff --git a/Mathlib/CategoryTheory/Presentable/PreservesCardinalPresentable.lean b/Mathlib/CategoryTheory/Presentable/PreservesCardinalPresentable.lean new file mode 100644 index 00000000000000..56e45b2a7020d8 --- /dev/null +++ b/Mathlib/CategoryTheory/Presentable/PreservesCardinalPresentable.lean @@ -0,0 +1,61 @@ +/- +Copyright (c) 2026 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.Presentable.Basic + +/-! +# Functors which preserves `κ`-presentable objects + +-/ + +@[expose] public section + +universe w + +namespace CategoryTheory.Functor + +variable {C D E : Type*} [Category* C] [Category* D] [Category* E] + +/-- Let `F : C ⥤ D` be a functor and `κ` be a regular cardinal, we say +that `F.PreservesCardinalPresentable κ` holds if for any `X : C` +that is `κ`-presentable in `C`, the object `F.obj X` is `κ`-presentable in `D`. -/ +class PreservesCardinalPresentable + (F : C ⥤ D) (κ : Cardinal.{w}) [Fact κ.IsRegular] : Prop where + le_inverseImage_isCardinalPresentable (F κ) : + isCardinalPresentable C κ ≤ (isCardinalPresentable D κ).inverseImage F + +export PreservesCardinalPresentable (le_inverseImage_isCardinalPresentable) + +instance (F : C ⥤ D) (κ : Cardinal.{w}) [Fact κ.IsRegular] (X : C) + [IsCardinalPresentable X κ] [F.PreservesCardinalPresentable κ] : + IsCardinalPresentable (F.obj X) κ := + le_inverseImage_isCardinalPresentable F κ _ (by assumption) + +instance (κ : Cardinal.{w}) [Fact κ.IsRegular] : + (𝟭 C).PreservesCardinalPresentable κ where + le_inverseImage_isCardinalPresentable := by rfl + +instance (F : C ⥤ D) (G : D ⥤ E) (κ : Cardinal.{w}) [Fact κ.IsRegular] + [F.PreservesCardinalPresentable κ] [G.PreservesCardinalPresentable κ] : + (F ⋙ G).PreservesCardinalPresentable κ where + le_inverseImage_isCardinalPresentable X hX := by + simp only [ObjectProperty.prop_inverseImage_iff, comp_obj] + infer_instance + +lemma PreservesCardinalPresentable.of_iso {F G : C ⥤ D} (e : F ≅ G) + (κ : Cardinal.{w}) [Fact κ.IsRegular] + [F.PreservesCardinalPresentable κ] : + G.PreservesCardinalPresentable κ where + le_inverseImage_isCardinalPresentable X _ := + isCardinalPresentable_of_iso (e.app X) κ + +lemma PreservesCardinalPresentable.iff_of_iso {F G : C ⥤ D} (e : F ≅ G) + (κ : Cardinal.{w}) [Fact κ.IsRegular] : + F.PreservesCardinalPresentable κ ↔ G.PreservesCardinalPresentable κ := + ⟨fun _ ↦ .of_iso e _, fun _ ↦ .of_iso e.symm _⟩ + +end CategoryTheory.Functor From 8f2e1c3ded0c48845126d71e1bf6a9c4e38c8e8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 30 Jun 2026 12:01:51 +0200 Subject: [PATCH 273/309] typo --- .../Presentable/PreservesCardinalPresentable.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Presentable/PreservesCardinalPresentable.lean b/Mathlib/CategoryTheory/Presentable/PreservesCardinalPresentable.lean index 56e45b2a7020d8..ec19465c9a0360 100644 --- a/Mathlib/CategoryTheory/Presentable/PreservesCardinalPresentable.lean +++ b/Mathlib/CategoryTheory/Presentable/PreservesCardinalPresentable.lean @@ -8,7 +8,7 @@ module public import Mathlib.CategoryTheory.Presentable.Basic /-! -# Functors which preserves `κ`-presentable objects +# Functors which preserve `κ`-presentable objects -/ From 8897225f5d41385dd05b75a6c0258adcd2c70aeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 30 Jun 2026 14:18:18 +0200 Subject: [PATCH 274/309] wip --- Mathlib/CategoryTheory/ObjectProperty/Comma.lean | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Mathlib/CategoryTheory/ObjectProperty/Comma.lean b/Mathlib/CategoryTheory/ObjectProperty/Comma.lean index ff9151d7d1299c..c86784ee5b8cad 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/Comma.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/Comma.lean @@ -37,6 +37,12 @@ instance [P₁.IsStableUnderRetracts] [P₂.IsStableUnderRetracts] : ⟨P₁.prop_of_retract (r.map (Comma.fst _ _)) h.1, P₂.prop_of_retract (r.map (Comma.snd _ _)) h.2⟩ +instance [P₁.IsClosedUnderIsomorphisms] [P₂.IsClosedUnderIsomorphisms] : + (comma F₁ F₂ P₁ P₂).IsClosedUnderIsomorphisms where + of_iso e h := + ⟨P₁.prop_of_iso ((Comma.fst _ _).mapIso e) h.1, + P₂.prop_of_iso ((Comma.snd _ _).mapIso e) h.2⟩ + instance [ObjectProperty.Small.{w} P₁] [ObjectProperty.Small.{w} P₂] [LocallySmall.{w} D] : ObjectProperty.Small.{w} (comma F₁ F₂ P₁ P₂) := small_of_surjective From f83f035f56c52ffa0a1215845a70f633e8d3f2ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= <37772949+joelriou@users.noreply.github.com> Date: Tue, 30 Jun 2026 15:55:27 +0200 Subject: [PATCH 275/309] Update Mathlib/CategoryTheory/Limits/Comma.lean Co-authored-by: smorel394 <67864981+smorel394@users.noreply.github.com> --- Mathlib/CategoryTheory/Limits/Comma.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Limits/Comma.lean b/Mathlib/CategoryTheory/Limits/Comma.lean index 8d12fbfcd399a2..1da3b2d2beec6d 100644 --- a/Mathlib/CategoryTheory/Limits/Comma.lean +++ b/Mathlib/CategoryTheory/Limits/Comma.lean @@ -115,7 +115,7 @@ def fstSndJointlyReflectLimit {F : J ⥤ Comma L R} {c : Cone F} · exact h₂.fac ((snd _ _).mapCone s) j uniq s m hm := by ext - · exact h₁.uniq ((fst _ _).mapCone s) _ (fun j ↦ by simp [← hm]) + · exact h₁.uniq ((fst _ _).mapCone s) _ (fun _ ↦ by simp [← hm]) · exact h₂.uniq ((snd _ _).mapCone s) _ (fun j ↦ by simp [← hm]) /-- (Implementation). An auxiliary cocone which is useful in order to construct colimits From f3cc4fa31858bc7ca354726a935b3ac70587a0f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= <37772949+joelriou@users.noreply.github.com> Date: Tue, 30 Jun 2026 15:55:36 +0200 Subject: [PATCH 276/309] Update Mathlib/CategoryTheory/Limits/Comma.lean Co-authored-by: smorel394 <67864981+smorel394@users.noreply.github.com> --- Mathlib/CategoryTheory/Limits/Comma.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Limits/Comma.lean b/Mathlib/CategoryTheory/Limits/Comma.lean index 1da3b2d2beec6d..1531a3a90564a6 100644 --- a/Mathlib/CategoryTheory/Limits/Comma.lean +++ b/Mathlib/CategoryTheory/Limits/Comma.lean @@ -116,7 +116,7 @@ def fstSndJointlyReflectLimit {F : J ⥤ Comma L R} {c : Cone F} uniq s m hm := by ext · exact h₁.uniq ((fst _ _).mapCone s) _ (fun _ ↦ by simp [← hm]) - · exact h₂.uniq ((snd _ _).mapCone s) _ (fun j ↦ by simp [← hm]) + · exact h₂.uniq ((snd _ _).mapCone s) _ (fun _ ↦ by simp [← hm]) /-- (Implementation). An auxiliary cocone which is useful in order to construct colimits in the comma category. -/ From 02bff9ad97c29aabf6db9aaaddf83503bc1f7d52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= <37772949+joelriou@users.noreply.github.com> Date: Tue, 30 Jun 2026 15:55:44 +0200 Subject: [PATCH 277/309] Update Mathlib/CategoryTheory/Limits/Comma.lean Co-authored-by: smorel394 <67864981+smorel394@users.noreply.github.com> --- Mathlib/CategoryTheory/Limits/Comma.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Limits/Comma.lean b/Mathlib/CategoryTheory/Limits/Comma.lean index 1531a3a90564a6..844d0468f5e5eb 100644 --- a/Mathlib/CategoryTheory/Limits/Comma.lean +++ b/Mathlib/CategoryTheory/Limits/Comma.lean @@ -190,7 +190,7 @@ def fstSndJointlyReflectColimit {F : J ⥤ Comma L R} {c : Cocone F} ext · exact h₁.fac ((fst _ _).mapCocone s) j · exact h₂.fac ((snd _ _).mapCocone s) j - uniq s m hm := by + uniq s _ hm := by ext · exact h₁.uniq ((fst _ _).mapCocone s) _ (fun j ↦ by simp [← hm]) · exact h₂.uniq ((snd _ _).mapCocone s) _ (fun j ↦ by simp [← hm]) From 4cb4841aef21ae5a971bf7be69bcce5e068d7480 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= <37772949+joelriou@users.noreply.github.com> Date: Tue, 30 Jun 2026 15:55:53 +0200 Subject: [PATCH 278/309] Update Mathlib/CategoryTheory/Limits/Comma.lean Co-authored-by: smorel394 <67864981+smorel394@users.noreply.github.com> --- Mathlib/CategoryTheory/Limits/Comma.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Limits/Comma.lean b/Mathlib/CategoryTheory/Limits/Comma.lean index 844d0468f5e5eb..03e7abde003e86 100644 --- a/Mathlib/CategoryTheory/Limits/Comma.lean +++ b/Mathlib/CategoryTheory/Limits/Comma.lean @@ -192,7 +192,7 @@ def fstSndJointlyReflectColimit {F : J ⥤ Comma L R} {c : Cocone F} · exact h₂.fac ((snd _ _).mapCocone s) j uniq s _ hm := by ext - · exact h₁.uniq ((fst _ _).mapCocone s) _ (fun j ↦ by simp [← hm]) + · exact h₁.uniq ((fst _ _).mapCocone s) _ (fun _ ↦ by simp [← hm]) · exact h₂.uniq ((snd _ _).mapCocone s) _ (fun j ↦ by simp [← hm]) instance hasLimit (F : J ⥤ Comma L R) [HasLimit (F ⋙ fst L R)] [HasLimit (F ⋙ snd L R)] From b6e43dba682e0f180cd47b36b80efe60f8ea3708 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= <37772949+joelriou@users.noreply.github.com> Date: Tue, 30 Jun 2026 15:56:06 +0200 Subject: [PATCH 279/309] Update Mathlib/CategoryTheory/Limits/Comma.lean Co-authored-by: smorel394 <67864981+smorel394@users.noreply.github.com> --- Mathlib/CategoryTheory/Limits/Comma.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Limits/Comma.lean b/Mathlib/CategoryTheory/Limits/Comma.lean index 03e7abde003e86..77671f2904a524 100644 --- a/Mathlib/CategoryTheory/Limits/Comma.lean +++ b/Mathlib/CategoryTheory/Limits/Comma.lean @@ -94,7 +94,7 @@ noncomputable def coneOfPreservesIsLimit [PreservesLimit (F ⋙ snd L R) R] {c set_option backward.defeqAttrib.useBackward true in /-- Let `F : J ⥤ Comma L R`. If `R` preserves the limit of `F ⋙ snd _ _`, then `Comma.fst L R` and `Comma.snd L R` jointly -reflect the colimit of `F`, i.e. if `c` is a cone for `F` which +reflect the limit of `F`, i.e. if `c` is a cone for `F` which becomes a limit after applying `Comma.fst L R` and `Comma.snd L R`, then `c` is a limit. -/ def fstSndJointlyReflectLimit {F : J ⥤ Comma L R} {c : Cone F} From 20e28cbea3b41c78a99bebfd8ac77bf6652e5709 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= <37772949+joelriou@users.noreply.github.com> Date: Tue, 30 Jun 2026 15:56:51 +0200 Subject: [PATCH 280/309] Update Mathlib/CategoryTheory/Limits/Comma.lean Co-authored-by: smorel394 <67864981+smorel394@users.noreply.github.com> --- Mathlib/CategoryTheory/Limits/Comma.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Limits/Comma.lean b/Mathlib/CategoryTheory/Limits/Comma.lean index 77671f2904a524..579456cfeb3066 100644 --- a/Mathlib/CategoryTheory/Limits/Comma.lean +++ b/Mathlib/CategoryTheory/Limits/Comma.lean @@ -113,7 +113,7 @@ def fstSndJointlyReflectLimit {F : J ⥤ Comma L R} {c : Cone F} ext · exact h₁.fac ((fst _ _).mapCone s) j · exact h₂.fac ((snd _ _).mapCone s) j - uniq s m hm := by + uniq s _ hm := by ext · exact h₁.uniq ((fst _ _).mapCone s) _ (fun _ ↦ by simp [← hm]) · exact h₂.uniq ((snd _ _).mapCone s) _ (fun _ ↦ by simp [← hm]) From a5cae989421b6de75d8af69cc8522b096a254ffa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 30 Jun 2026 15:58:45 +0200 Subject: [PATCH 281/309] better syntax --- Mathlib/CategoryTheory/Limits/Comma.lean | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Mathlib/CategoryTheory/Limits/Comma.lean b/Mathlib/CategoryTheory/Limits/Comma.lean index 579456cfeb3066..19da7699779323 100644 --- a/Mathlib/CategoryTheory/Limits/Comma.lean +++ b/Mathlib/CategoryTheory/Limits/Comma.lean @@ -115,8 +115,8 @@ def fstSndJointlyReflectLimit {F : J ⥤ Comma L R} {c : Cone F} · exact h₂.fac ((snd _ _).mapCone s) j uniq s _ hm := by ext - · exact h₁.uniq ((fst _ _).mapCone s) _ (fun _ ↦ by simp [← hm]) - · exact h₂.uniq ((snd _ _).mapCone s) _ (fun _ ↦ by simp [← hm]) + · exact h₁.uniq ((fst _ _).mapCone s) _ (by simp [← hm]) + · exact h₂.uniq ((snd _ _).mapCone s) _ (by simp [← hm]) /-- (Implementation). An auxiliary cocone which is useful in order to construct colimits in the comma category. -/ @@ -192,8 +192,8 @@ def fstSndJointlyReflectColimit {F : J ⥤ Comma L R} {c : Cocone F} · exact h₂.fac ((snd _ _).mapCocone s) j uniq s _ hm := by ext - · exact h₁.uniq ((fst _ _).mapCocone s) _ (fun _ ↦ by simp [← hm]) - · exact h₂.uniq ((snd _ _).mapCocone s) _ (fun j ↦ by simp [← hm]) + · exact h₁.uniq ((fst _ _).mapCocone s) _ (by simp [← hm]) + · exact h₂.uniq ((snd _ _).mapCocone s) _ (by simp [← hm]) instance hasLimit (F : J ⥤ Comma L R) [HasLimit (F ⋙ fst L R)] [HasLimit (F ⋙ snd L R)] [PreservesLimit (F ⋙ snd L R) R] : HasLimit F := From 9fe16ce356f9091464fb5c6179cd6fb24e75c4be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Tue, 30 Jun 2026 16:01:55 +0200 Subject: [PATCH 282/309] refactored proofs --- Mathlib/CategoryTheory/Limits/Comma.lean | 56 +++++++----------------- 1 file changed, 15 insertions(+), 41 deletions(-) diff --git a/Mathlib/CategoryTheory/Limits/Comma.lean b/Mathlib/CategoryTheory/Limits/Comma.lean index 19da7699779323..d466ee5bc80337 100644 --- a/Mathlib/CategoryTheory/Limits/Comma.lean +++ b/Mathlib/CategoryTheory/Limits/Comma.lean @@ -71,26 +71,6 @@ noncomputable def coneOfPreserves [PreservesLimit (F ⋙ snd L R) R] (c₁ : Con · simp [← c₁.w t] · simp [← c₂.w t] } -set_option backward.isDefEq.respectTransparency false in -/-- Provided that `R` preserves the appropriate limit, then the cone in `coneOfPreserves` is a -limit. -/ -noncomputable def coneOfPreservesIsLimit [PreservesLimit (F ⋙ snd L R) R] {c₁ : Cone (F ⋙ fst L R)} - (t₁ : IsLimit c₁) {c₂ : Cone (F ⋙ snd L R)} (t₂ : IsLimit c₂) : - IsLimit (coneOfPreserves F c₁ t₂) where - lift s := - { left := t₁.lift ((fst L R).mapCone s) - right := t₂.lift ((snd L R).mapCone s) - w := - (isLimitOfPreserves R t₂).hom_ext fun j => by - rw [coneOfPreserves_pt_hom, assoc, assoc, (isLimitOfPreserves R t₂).fac, - limitAuxiliaryCone_π_app, ← L.map_comp_assoc, t₁.fac, R.mapCone_π_app, - ← R.map_comp, t₂.fac] - exact (s.π.app j).w } - uniq s m w := by - apply CommaMorphism.ext - · exact t₁.uniq ((fst L R).mapCone s) _ (fun j => by simp [← w]) - · exact t₂.uniq ((snd L R).mapCone s) _ (fun j => by simp [← w]) - set_option backward.defeqAttrib.useBackward true in /-- Let `F : J ⥤ Comma L R`. If `R` preserves the limit of `F ⋙ snd _ _`, then `Comma.fst L R` and `Comma.snd L R` jointly @@ -118,6 +98,13 @@ def fstSndJointlyReflectLimit {F : J ⥤ Comma L R} {c : Cone F} · exact h₁.uniq ((fst _ _).mapCone s) _ (by simp [← hm]) · exact h₂.uniq ((snd _ _).mapCone s) _ (by simp [← hm]) +/-- Provided that `R` preserves the appropriate limit, then the cone in `coneOfPreserves` is a +limit. -/ +noncomputable def coneOfPreservesIsLimit [PreservesLimit (F ⋙ snd L R) R] {c₁ : Cone (F ⋙ fst L R)} + (t₁ : IsLimit c₁) {c₂ : Cone (F ⋙ snd L R)} (t₂ : IsLimit c₂) : + IsLimit (coneOfPreserves F c₁ t₂) := + fstSndJointlyReflectLimit t₁ t₂ + /-- (Implementation). An auxiliary cocone which is useful in order to construct colimits in the comma category. -/ @[simps!] @@ -147,27 +134,6 @@ noncomputable def coconeOfPreserves [PreservesColimit (F ⋙ fst L R) L] {c₁ : · simp [← c₁.w t] · simp [← c₂.w t] } -set_option backward.isDefEq.respectTransparency false in -/-- Provided that `L` preserves the appropriate colimit, then the cocone in `coconeOfPreserves` is -a colimit. -/ -noncomputable def coconeOfPreservesIsColimit [PreservesColimit (F ⋙ fst L R) L] - {c₁ : Cocone (F ⋙ fst L R)} - (t₁ : IsColimit c₁) {c₂ : Cocone (F ⋙ snd L R)} (t₂ : IsColimit c₂) : - IsColimit (coconeOfPreserves F t₁ c₂) where - desc s := - { left := t₁.desc ((fst L R).mapCocone s) - right := t₂.desc ((snd L R).mapCocone s) - w := - (isColimitOfPreserves L t₁).hom_ext fun j => by - rw [coconeOfPreserves_pt_hom, (isColimitOfPreserves L t₁).fac_assoc, - colimitAuxiliaryCocone_ι_app, assoc, ← R.map_comp, t₂.fac, L.mapCocone_ι_app, ← - L.map_comp_assoc, t₁.fac] - exact (s.ι.app j).w } - uniq s m w := by - apply CommaMorphism.ext - · exact t₁.uniq ((fst L R).mapCocone s) _ (fun j => by simp [← w]) - · exact t₂.uniq ((snd L R).mapCocone s) _ (fun j => by simp [← w]) - set_option backward.defeqAttrib.useBackward true in /-- Let `F : J ⥤ Comma L R`. If `L` preserves the colimit of `F ⋙ fst _ _`, then `Comma.fst L R` and `Comma.snd L R` jointly @@ -195,6 +161,14 @@ def fstSndJointlyReflectColimit {F : J ⥤ Comma L R} {c : Cocone F} · exact h₁.uniq ((fst _ _).mapCocone s) _ (by simp [← hm]) · exact h₂.uniq ((snd _ _).mapCocone s) _ (by simp [← hm]) +/-- Provided that `L` preserves the appropriate colimit, then the cocone in `coconeOfPreserves` is +a colimit. -/ +noncomputable def coconeOfPreservesIsColimit [PreservesColimit (F ⋙ fst L R) L] + {c₁ : Cocone (F ⋙ fst L R)} + (t₁ : IsColimit c₁) {c₂ : Cocone (F ⋙ snd L R)} (t₂ : IsColimit c₂) : + IsColimit (coconeOfPreserves F t₁ c₂) := + fstSndJointlyReflectColimit t₁ t₂ + instance hasLimit (F : J ⥤ Comma L R) [HasLimit (F ⋙ fst L R)] [HasLimit (F ⋙ snd L R)] [PreservesLimit (F ⋙ snd L R) R] : HasLimit F := HasLimit.mk ⟨_, coneOfPreservesIsLimit _ (limit.isLimit _) (limit.isLimit _)⟩ From 671b09e6d100b919a991c2f1b9407a23ae786432 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= <37772949+joelriou@users.noreply.github.com> Date: Tue, 30 Jun 2026 20:22:44 +0200 Subject: [PATCH 283/309] Update Mathlib/CategoryTheory/Presentable/PreservesCardinalPresentable.lean Co-authored-by: smorel394 <67864981+smorel394@users.noreply.github.com> --- .../Presentable/PreservesCardinalPresentable.lean | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/PreservesCardinalPresentable.lean b/Mathlib/CategoryTheory/Presentable/PreservesCardinalPresentable.lean index ec19465c9a0360..1b5b6148326873 100644 --- a/Mathlib/CategoryTheory/Presentable/PreservesCardinalPresentable.lean +++ b/Mathlib/CategoryTheory/Presentable/PreservesCardinalPresentable.lean @@ -47,8 +47,7 @@ instance (F : C ⥤ D) (G : D ⥤ E) (κ : Cardinal.{w}) [Fact κ.IsRegular] infer_instance lemma PreservesCardinalPresentable.of_iso {F G : C ⥤ D} (e : F ≅ G) - (κ : Cardinal.{w}) [Fact κ.IsRegular] - [F.PreservesCardinalPresentable κ] : + (κ : Cardinal.{w}) [Fact κ.IsRegular] [F.PreservesCardinalPresentable κ] : G.PreservesCardinalPresentable κ where le_inverseImage_isCardinalPresentable X _ := isCardinalPresentable_of_iso (e.app X) κ From 9287912fe969bfb6124f8414134cbe20c7ca5386 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= <37772949+joelriou@users.noreply.github.com> Date: Tue, 30 Jun 2026 20:24:26 +0200 Subject: [PATCH 284/309] Update Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean Co-authored-by: smorel394 <67864981+smorel394@users.noreply.github.com> --- Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean b/Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean index e8c746368cd8a1..2bb0a333bebad3 100644 --- a/Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean +++ b/Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean @@ -319,11 +319,10 @@ lemma isCardinalFiltered_iff' : refine ⟨fun h ↦ ⟨h.1, by tauto⟩, fun ⟨h₁, h₂⟩ ↦ ⟨h₁, fun ι j k f hι ↦ ?_⟩⟩ by_cases hι' : Nonempty ι · exact h₂ f hι hι' - · have := h₁ (fun (x : ULift.{w} (Fin 2)) ↦ match x with + · obtain ⟨l, hl⟩ := h₁ (fun (x : ULift.{w} (Fin 2)) ↦ match x with | ULift.up 0 => j | ULift.up 1 => k) (hasCardinalLT_of_finite _ _ (Cardinal.IsRegular.aleph0_le Fact.out)) - obtain ⟨l, hl⟩ := this exact ⟨l, (hl ⟨1⟩).some, (hl ⟨0⟩).some, by tauto⟩ end From 701d883fde15485fa25237bd151cdb21d13f5fb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Wed, 1 Jul 2026 07:05:12 +0200 Subject: [PATCH 285/309] suggestions by @smorel394 --- Mathlib/CategoryTheory/Presentable/Basic.lean | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/Basic.lean b/Mathlib/CategoryTheory/Presentable/Basic.lean index 99877f0079fa07..ff750f2bcd5892 100644 --- a/Mathlib/CategoryTheory/Presentable/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/Basic.lean @@ -22,7 +22,7 @@ a regular cardinal `κ` such that `Functor.IsCardinalAccessible`. An object `X` of a category is `κ`-presentable (`IsCardinalPresentable`) if the functor `Hom(X, _)` (i.e. `coyoneda.obj (op X)`) is `κ`-accessible. -Similarly as for accessible functors, we define a type class `IsAccessible`. +Similarly as for accessible functors, we define a type class `IsPresentable`. ## References * [Adámek, J. and Rosický, J., *Locally presentable and accessible categories*][Adamek_Rosicky_1994] @@ -242,7 +242,7 @@ set_option backward.isDefEq.respectTransparency false in set_option backward.defeqAttrib.useBackward true in open IsFiltered in lemma IsCardinalPresentable.mk - (hX : ∀ (J : Type w) (_ : Category.{w} J) (_ : IsCardinalFiltered J κ) + (hX : ∀ (J : Type w) [SmallCategory J] [IsCardinalFiltered J κ] (F : J ⥤ C) (c : Cocone F) (_ : IsColimit c), (∀ (g : X ⟶ c.pt), ∃ (j : J) (f : X ⟶ F.obj j), f ≫ c.ι.app j = g) ∧ (∀ (j : J) (f₁ f₂ : X ⟶ F.obj j) (_ : f₁ ≫ c.ι.app j = f₂ ≫ c.ι.app j), @@ -256,12 +256,12 @@ lemma IsCardinalPresentable.mk · obtain ⟨j₁, f₁, rfl⟩ := Functor.ιColimitType_jointly_surjective _ f₁ obtain ⟨j₂, f₂, rfl⟩ := Functor.ιColimitType_jointly_surjective _ f₂ dsimp at f₁ f₂ hf - obtain ⟨j', a, ha⟩ := (hX J _ inferInstance F c hc).2 _ (f₁ ≫ F.map (leftToMax j₁ j₂)) + obtain ⟨j', a, ha⟩ := (hX J F c hc).2 _ (f₁ ≫ F.map (leftToMax j₁ j₂)) (f₂ ≫ F.map (rightToMax j₁ j₂)) (by simpa) simp only [Category.assoc] at ha exact Functor.ιColimitType_eq_of_map_eq_map _ _ _ (leftToMax j₁ j₂ ≫ a) (rightToMax j₁ j₂ ≫ a) (by simpa) - · obtain ⟨j, f, rfl⟩ := (hX J _ inferInstance F c hc).1 g + · obtain ⟨j, f, rfl⟩ := (hX J F c hc).1 g exact ⟨Functor.ιColimitType _ j f, rfl⟩⟩⟩ section From 1f15d03e9125d4f57aa5a28cd922d3c24f534ac1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Wed, 1 Jul 2026 07:08:50 +0200 Subject: [PATCH 286/309] min_imports --- Mathlib/CategoryTheory/Presentable/Basic.lean | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/Basic.lean b/Mathlib/CategoryTheory/Presentable/Basic.lean index ff750f2bcd5892..75c58b9f6ca4c2 100644 --- a/Mathlib/CategoryTheory/Presentable/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/Basic.lean @@ -5,12 +5,8 @@ Authors: Joël Riou -/ module -public import Mathlib.CategoryTheory.Adjunction.Limits public import Mathlib.CategoryTheory.Limits.Constructions.EventuallyConstant -public import Mathlib.CategoryTheory.Limits.Preserves.Ulift -public import Mathlib.CategoryTheory.Limits.Types.Filtered public import Mathlib.CategoryTheory.Presentable.IsCardinalFiltered -public import Mathlib.SetTheory.Cardinal.HasCardinalLT /-! # Presentable objects From fa7ab19e6b670340b0684d53222be9bbb4adc880 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Wed, 1 Jul 2026 07:18:28 +0200 Subject: [PATCH 287/309] added docstrings --- .../Presentable/CardinalFilteredPresentation.lean | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean b/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean index 1ce67dbf3060bc..cfaea70ce4c809 100644 --- a/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean +++ b/Mathlib/CategoryTheory/Presentable/CardinalFilteredPresentation.lean @@ -5,10 +5,9 @@ Authors: Joël Riou -/ module -public import Mathlib.CategoryTheory.ObjectProperty.Small +public import Mathlib.CategoryTheory.Generator.StrongGenerator public import Mathlib.CategoryTheory.Presentable.Limits public import Mathlib.CategoryTheory.Presentable.Retracts -public import Mathlib.CategoryTheory.Generator.StrongGenerator /-! # Presentable generators @@ -41,6 +40,10 @@ variable {C : Type u} [Category.{v} C] namespace Limits.ColimitPresentation +/-- If an object `X` admits a presentation `p` as a colimit of +a functor `p.diag : J ⥤ C` with values in `κ`-presentable objects, +then `X` is `κ'`-presentable if `κ ≤ κ'` and the cardinality +of `Arrow J` is `< κ'`. -/ lemma isCardinalPresentable {X : C} {J : Type w} [SmallCategory J] (p : ColimitPresentation J X) (κ : Cardinal.{w}) [Fact κ.IsRegular] (h : ∀ (j : J), IsCardinalPresentable (p.diag.obj j) κ) [LocallySmall.{w} C] @@ -58,6 +61,11 @@ namespace ObjectProperty variable {P : ObjectProperty C} +/-- If an object `X` admits a presentation `p : P.ColimitsOfShape J X` +as a colimit of a functor `p.diag : J ⥤ C` with values in objects +satisfying a property `P` such that `P ≤ isCardinalPresentable C κ`, +then `X` is `κ'`-presentable if `κ ≤ κ'` and the cardinality +of `Arrow J` is `< κ'`. -/ lemma ColimitOfShape.isCardinalPresentable {X : C} {J : Type w} [SmallCategory J] (p : P.ColimitOfShape J X) {κ : Cardinal.{w}} [Fact κ.IsRegular] (hP : P ≤ isCardinalPresentable C κ) [LocallySmall.{w} C] From cf411c99d6bae5a3386799a3f4e7cce3fecd6024 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= <37772949+joelriou@users.noreply.github.com> Date: Wed, 1 Jul 2026 11:15:37 +0200 Subject: [PATCH 288/309] Update Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean Co-authored-by: Dagur Asgeirsson --- Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean index ada92c9bb66c38..c094ed28ed4c23 100644 --- a/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean @@ -160,7 +160,7 @@ lemma le_φ (B : Set X) : B ≤ φ Y m B := by hasCardinalLT_of_finite _ _ (IsRegular.aleph0_le Fact.out)⟩ refine Set.subset_iUnion _ ⟨C, hC⟩ (Or.inl ?_) simp only [Set.mem_image, Subtype.exists, exists_and_right, exists_eq_right] - refine ⟨hb, @hC' ⟨b, hb⟩ (by simp)⟩ + exact ⟨hb, @hC' ⟨b, hb⟩ (by simp)⟩ · simp include h₀ hA hY in From 8c6e1a18b1c6604f6669977757ccc482c871774b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= <37772949+joelriou@users.noreply.github.com> Date: Wed, 1 Jul 2026 11:16:10 +0200 Subject: [PATCH 289/309] Update Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean Co-authored-by: Dagur Asgeirsson --- Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean index c094ed28ed4c23..6106639da6eb0a 100644 --- a/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean @@ -22,8 +22,8 @@ cardinals `κ₁ < κ₂`, this condition can be described in different ways: (iv) for any `κ₁`-directed partially ordered type `X` and any subset `A` of `X` of cardinality `< κ₂`, there exists a `κ₁`-directed subset `B` of `X` containing `A` that is of cardinality `< κ₂`. -This is Theorem 2.11 in the book by Adámek and Rosický (TODO @joelriou). Here, -we take (i) as the definition. +The equivalence of these conditions (i)-(iv) is Theorem 2.11 in the book by Adámek and Rosický +(TODO @joelriou). Here, we take (i) as the definition. ## References * [Adámek, J. and Rosický, J., *Locally presentable and accessible categories*][Adamek_Rosicky_1994] From 509198520011d1b1751c61ff46d563b19d8a1436 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Wed, 1 Jul 2026 11:20:05 +0200 Subject: [PATCH 290/309] better docstring --- Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean index 6106639da6eb0a..a91fc233a85a08 100644 --- a/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean @@ -23,7 +23,8 @@ cardinals `κ₁ < κ₂`, this condition can be described in different ways: of cardinality `< κ₂`, there exists a `κ₁`-directed subset `B` of `X` containing `A` that is of cardinality `< κ₂`. The equivalence of these conditions (i)-(iv) is Theorem 2.11 in the book by Adámek and Rosický -(TODO @joelriou). Here, we take (i) as the definition. +((i) → (iii) → (iv) are proven below, (ii) → (i) is obvious; the rest is TODO @joelriou). +Here, we take (i) as the definition. ## References * [Adámek, J. and Rosický, J., *Locally presentable and accessible categories*][Adamek_Rosicky_1994] From 95dfd697b8455e74d49d70dd5654f451c5b271fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Wed, 1 Jul 2026 11:22:00 +0200 Subject: [PATCH 291/309] better docstring --- Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean index a91fc233a85a08..1fe915d41331d6 100644 --- a/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean @@ -23,8 +23,9 @@ cardinals `κ₁ < κ₂`, this condition can be described in different ways: of cardinality `< κ₂`, there exists a `κ₁`-directed subset `B` of `X` containing `A` that is of cardinality `< κ₂`. The equivalence of these conditions (i)-(iv) is Theorem 2.11 in the book by Adámek and Rosický -((i) → (iii) → (iv) are proven below, (ii) → (i) is obvious; the rest is TODO @joelriou). -Here, we take (i) as the definition. +((i) → (iii) is `exists_cofinal_of_isCardinalAccessibleCategory_cardinalDirectedPoset`, +(iii) → (iv) is `exists_isCardinalFiltered_set_of_exists_cofinal`, (ii) → (i) is obvious; +the rest is TODO @joelriou). Here, we take (i) as the definition. ## References * [Adámek, J. and Rosický, J., *Locally presentable and accessible categories*][Adamek_Rosicky_1994] From 4999bd79ad1d9d67fc13500ebf16bc6e803d243c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Wed, 1 Jul 2026 11:35:21 +0200 Subject: [PATCH 292/309] feat(CategoryTheory/Presentably): equivalence between the definitions of sharply small regular cardinals --- .../CategoryTheory/Comma/CardinalArrow.lean | 9 + Mathlib/CategoryTheory/Presentable/Basic.lean | 25 +- .../Presentable/SharplyLT/Basic.lean | 297 +++++++++++++++++- 3 files changed, 319 insertions(+), 12 deletions(-) diff --git a/Mathlib/CategoryTheory/Comma/CardinalArrow.lean b/Mathlib/CategoryTheory/Comma/CardinalArrow.lean index b1f67c4c554b52..0202e114ad487b 100644 --- a/Mathlib/CategoryTheory/Comma/CardinalArrow.lean +++ b/Mathlib/CategoryTheory/Comma/CardinalArrow.lean @@ -114,4 +114,13 @@ lemma hasCardinalLT_of_hasCardinalLT_arrow HasCardinalLT C κ := h.of_injective (fun X ↦ Arrow.mk (𝟙 X)) (fun _ _ h ↦ congr_arg Comma.left h) +lemma hasCardinalLT_arrow_iff_of_isThin (C : Type u) [Category.{v} C] + [Quiver.IsThin C] (κ : Cardinal.{w}) (hκ : Cardinal.aleph0 ≤ κ) : + HasCardinalLT (Arrow C) κ ↔ HasCardinalLT C κ := + ⟨hasCardinalLT_of_hasCardinalLT_arrow, fun h ↦ + (hasCardinalLT_prod hκ h h).of_injective (fun f ↦ (f.left, f.right)) + (fun f g h ↦ + Arrow.ext (congr_arg _root_.Prod.fst h) (congr_arg _root_.Prod.snd h) + (by subsingleton))⟩ + end CategoryTheory diff --git a/Mathlib/CategoryTheory/Presentable/Basic.lean b/Mathlib/CategoryTheory/Presentable/Basic.lean index f1d14fbe781e7c..2000d37f6c1626 100644 --- a/Mathlib/CategoryTheory/Presentable/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/Basic.lean @@ -110,13 +110,13 @@ end section -variable (F : C ⥤ D) - /-- A functor is accessible relative to a universe `w` if it is `κ`-accessible for some regular `κ : Cardinal.{w}`. -/ @[pp_with_univ] -class IsAccessible : Prop where - exists_cardinal : ∃ (κ : Cardinal.{w}) (_ : Fact κ.IsRegular), IsCardinalAccessible F κ +class IsAccessible (F : C ⥤ D) : Prop where + exists_cardinal (F) : ∃ (κ : Cardinal.{w}) (_ : Fact κ.IsRegular), IsCardinalAccessible F κ + +variable (F : C ⥤ D) lemma isAccessible_of_isCardinalAccessible (κ : Cardinal.{w}) [Fact κ.IsRegular] [IsCardinalAccessible F κ] : IsAccessible.{w} F where @@ -344,18 +344,27 @@ end section -variable (C) (κ : Cardinal.{w}) [Fact κ.IsRegular] - /-- A category has `κ`-filtered colimits if it has colimits of shape `J` for any `κ`-filtered category `J`. -/ -class HasCardinalFilteredColimits : Prop where - hasColimitsOfShape (J : Type w) [SmallCategory J] [IsCardinalFiltered J κ] : +class HasCardinalFilteredColimits + (C : Type u₁) [Category.{v₁} C] (κ : Cardinal.{w}) [Fact κ.IsRegular] : Prop where + hasColimitsOfShape (C) (κ) (J : Type w) [SmallCategory J] [IsCardinalFiltered J κ] : HasColimitsOfShape J C := by intros; infer_instance attribute [instance] HasCardinalFilteredColimits.hasColimitsOfShape +variable (C) (κ : Cardinal.{w}) [Fact κ.IsRegular] + instance [HasColimitsOfSize.{w, w} C] : HasCardinalFilteredColimits.{w} C κ where +variable {κ} in +lemma HasCardinalFilteredColimits.of_le + [HasCardinalFilteredColimits C κ] {κ' : Cardinal.{w}} [Fact κ'.IsRegular] (h : κ ≤ κ') : + HasCardinalFilteredColimits C κ' where + hasColimitsOfShape J _ _ := by + have := IsCardinalFiltered.of_le J h + exact HasCardinalFilteredColimits.hasColimitsOfShape C κ J + end end CategoryTheory diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean index 1fe915d41331d6..28b92cc9ee4558 100644 --- a/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean @@ -5,8 +5,10 @@ Authors: Joël Riou -/ module +public import Mathlib.CategoryTheory.ObjectProperty.ColimitsCardinalClosure public import Mathlib.CategoryTheory.Presentable.CardinalDirectedPoset public import Mathlib.CategoryTheory.Presentable.Dense +public import Mathlib.CategoryTheory.Presentable.Directed public import Mathlib.Order.TransfiniteIteration /-! @@ -22,10 +24,9 @@ cardinals `κ₁ < κ₂`, this condition can be described in different ways: (iv) for any `κ₁`-directed partially ordered type `X` and any subset `A` of `X` of cardinality `< κ₂`, there exists a `κ₁`-directed subset `B` of `X` containing `A` that is of cardinality `< κ₂`. -The equivalence of these conditions (i)-(iv) is Theorem 2.11 in the book by Adámek and Rosický -((i) → (iii) is `exists_cofinal_of_isCardinalAccessibleCategory_cardinalDirectedPoset`, -(iii) → (iv) is `exists_isCardinalFiltered_set_of_exists_cofinal`, (ii) → (i) is obvious; -the rest is TODO @joelriou). Here, we take (i) as the definition. +The equivalence of these conditions (i)-(iv) is Theorem 2.11 in the book by Adámek and Rosický. +Here, we take (i) as the definition, and the equivalences between the various definitions +is stated as `Cardinal.SharplyLT.tfae`. ## References * [Adámek, J. and Rosický, J., *Locally presentable and accessible categories*][Adamek_Rosicky_1994] @@ -260,6 +261,294 @@ public lemma exists_isCardinalFiltered_set_of_exists_cofinal (h₀ : κ₁ < κ end + +section + +variable (hκ : κ₁ < κ₂) + (hκ' : ∀ {X : Type w} [PartialOrder X] [IsCardinalFiltered X κ₁] + (A : Set X) (_ : HasCardinalLT A κ₂), + ∃ (B : Set X), A ⊆ B ∧ IsCardinalFiltered B κ₁ ∧ HasCardinalLT B κ₂) + +variable (κ₁ κ₂) in +def IsCardinalFilteredAndHasCardinalLT + (J : Type w) [PartialOrder J] (A : Set J) : Prop := + IsCardinalFiltered A κ₁ ∧ HasCardinalLT A κ₂ + +namespace IsCardinalFilteredAndHasCardinalLT + +variable (κ₁ κ₂) {C : Type u} [Category.{v} C] {X : C} + {J : Type w} [PartialOrder J] + (p : (isCardinalPresentable C κ₁).ColimitOfShape J X) + +variable [IsCardinalAccessibleCategory C κ₁] + +instance (A : Subtype (IsCardinalFilteredAndHasCardinalLT κ₁ κ₂ J)) : + HasColimit ((Subtype.mono_coe A.val).functor ⋙ p.diag) := by + have : IsCardinalFiltered (Subtype A.val) κ₁ := A.prop.1 + infer_instance + +abbrev singleton (j : J) : Subtype (IsCardinalFilteredAndHasCardinalLT κ₁ κ₂ J) := + ⟨{j}, by + letI : OrderTop ({j} : Set J) := + { top := ⟨j, by simp⟩ + le_top := by simp } + exact isCardinalFiltered_of_hasTerminal _ _, + hasCardinalLT_of_finite _ _ (IsRegular.aleph0_le Fact.out)⟩ + +abbrev pair {j j' : J} (h : j ≤ j') : + Subtype (IsCardinalFilteredAndHasCardinalLT κ₁ κ₂ J) := + ⟨{j, j'}, by + letI : OrderTop ({j, j'} : Set J) := + { top := ⟨j', by simp⟩ + le_top := by aesop } + apply isCardinalFiltered_of_hasTerminal, + hasCardinalLT_of_finite _ _ (IsRegular.aleph0_le Fact.out)⟩ + +lemma le_pair {j j' : J} (h : j ≤ j') : + singleton κ₁ κ₂ j ≤ pair κ₁ κ₂ h := by + rw [Subtype.mk_le_mk] + simp + +lemma le_pair' {j j' : J} (h : j ≤ j') : + singleton κ₁ κ₂ j' ≤ pair κ₁ κ₂ h := by + rw [Subtype.mk_le_mk] + simp + +noncomputable abbrev colimit + (A : Subtype (IsCardinalFilteredAndHasCardinalLT κ₁ κ₂ J)) : C := + Limits.colimit ((Subtype.mono_coe A.val).functor ⋙ p.diag) + +noncomputable abbrev colimit.ι + (A : Subtype (IsCardinalFilteredAndHasCardinalLT κ₁ κ₂ J)) (a : J) (ha : a ∈ A.val) : + p.diag.obj a ⟶ colimit κ₁ κ₂ p A := + Limits.colimit.ι ((Subtype.mono_coe A.val).functor ⋙ p.diag) ⟨a, ha⟩ + +omit [Fact κ₂.IsRegular] in +@[reassoc (attr := simp)] +lemma colimit.w (A : Subtype (IsCardinalFilteredAndHasCardinalLT κ₁ κ₂ J)) + {a b : J} (hab : a ≤ b) (ha : a ∈ A.val) (hb : b ∈ A.val) : + p.diag.map (homOfLE hab) ≫ colimit.ι κ₁ κ₂ p A b hb = colimit.ι κ₁ κ₂ p A a ha := + Limits.colimit.w ((Subtype.mono_coe A.val).functor ⋙ p.diag) + (j := ⟨a, ha⟩) (j' := ⟨b, hb⟩) (homOfLE hab) + +set_option backward.defeqAttrib.useBackward true in +noncomputable def colimit.map + {A₁ A₂ : Subtype (IsCardinalFilteredAndHasCardinalLT κ₁ κ₂ J)} (hA : A₁ ≤ A₂) : + colimit κ₁ κ₂ p A₁ ⟶ colimit κ₁ κ₂ p A₂ := + colimit.desc _ (Cocone.mk _ + { app j := colimit.ι κ₁ κ₂ p A₂ j.val (hA j.prop) + naturality j₁ j₂ f := by + simpa using! colimit.w κ₁ κ₂ p A₂ (leOfHom f) (hA j₁.prop) (hA j₂.prop) }) + +omit [Fact κ₂.IsRegular] in +@[reassoc (attr := simp)] +lemma colimit.ι_map {A₁ A₂ : Subtype (IsCardinalFilteredAndHasCardinalLT κ₁ κ₂ J)} + (hA : A₁ ≤ A₂) (j : J) (hj : j ∈ A₁.val) : + colimit.ι κ₁ κ₂ p A₁ j hj ≫ colimit.map κ₁ κ₂ p hA = colimit.ι κ₁ κ₂ p A₂ j (hA hj) := + colimit.ι_desc .. + +omit [Fact κ₂.IsRegular] in +@[ext] +lemma colimit.hom_ext + {A : Subtype (IsCardinalFilteredAndHasCardinalLT κ₁ κ₂ J)} {T : C} + {φ₁ φ₂ : colimit κ₁ κ₂ p A ⟶ T} + (h : ∀ (j : J) (hj : j ∈ A.val), colimit.ι κ₁ κ₂ p A j hj ≫ φ₁ = + colimit.ι κ₁ κ₂ p A j hj ≫ φ₂) : + φ₁ = φ₂ := by + ext + apply h + +set_option backward.defeqAttrib.useBackward true in +noncomputable def colimit.π + (A : Subtype (IsCardinalFilteredAndHasCardinalLT κ₁ κ₂ J)) : colimit κ₁ κ₂ p A ⟶ X := + colimit.desc _ (Cocone.mk _ + { app a := by exact p.ι.app a + naturality _ _ _ := by simpa using p.ι.naturality _ }) + +omit [Fact κ₂.IsRegular] in +@[reassoc (attr := simp)] +lemma colimit.ι_π + (A : Subtype (IsCardinalFilteredAndHasCardinalLT κ₁ κ₂ J)) (a : J) (ha : a ∈ A.val) : + colimit.ι κ₁ κ₂ p A a ha ≫ colimit.π κ₁ κ₂ p A = p.ι.app a := + colimit.ι_desc .. + +omit [Fact κ₂.IsRegular] in +@[reassoc (attr := simp)] +lemma colimit.map_π {A₁ A₂ : Subtype (IsCardinalFilteredAndHasCardinalLT κ₁ κ₂ J)} (hA : A₁ ≤ A₂) : + colimit.map κ₁ κ₂ p hA ≫ colimit.π κ₁ κ₂ p A₂ = colimit.π κ₁ κ₂ p A₁ := by + ext + simp + +@[simps] +noncomputable def functor : + Subtype (IsCardinalFilteredAndHasCardinalLT κ₁ κ₂ J) ⥤ C where + obj A := colimit κ₁ κ₂ p A + map f := colimit.map κ₁ κ₂ p f.le + map_id _ := by ext; simp + map_comp f g := by ext; simp + +set_option backward.defeqAttrib.useBackward true in +@[simps] +noncomputable def cocone : Cocone (functor κ₁ κ₂ p) where + pt := X + ι.app j := colimit.π κ₁ κ₂ p j + +namespace isColimit + +variable {κ₁ κ₂ p} (s : Cocone (functor κ₁ κ₂ p)) + +set_option backward.defeqAttrib.useBackward true in +@[simps] +noncomputable def coconeDesc : Cocone p.diag where + pt := s.pt + ι.app j := colimit.ι _ _ _ _ _ (by simp) ≫ s.ι.app (singleton κ₁ κ₂ j) + ι.naturality j j' f := by + simpa [← s.w (homOfLE (le_pair κ₁ κ₂ (leOfHom f))), + ← s.w (homOfLE (le_pair' κ₁ κ₂ (leOfHom f)))] + using! colimit.w_assoc .. + +noncomputable def desc : X ⟶ s.pt := p.isColimit.desc (coconeDesc s) + +set_option backward.defeqAttrib.useBackward true in +@[reassoc (attr := simp)] +lemma fac (j : J) : + dsimp% p.ι.app j ≫ desc s = + colimit.ι _ _ _ _ _ (by simp) ≫ s.ι.app (singleton κ₁ κ₂ j) := + p.isColimit.fac (coconeDesc s) j + +set_option backward.defeqAttrib.useBackward true in +@[reassoc] +lemma fac' (A : Subtype (IsCardinalFilteredAndHasCardinalLT κ₁ κ₂ J)) : + colimit.π κ₁ κ₂ p A ≫ desc s = s.ι.app A := by + ext j hj + let φ : singleton κ₁ κ₂ j ⟶ A := homOfLE (by + rw [Subtype.mk_le_mk] + simpa) + simp [colimit.ι_π_assoc, fac, ← s.w φ] + +end isColimit + +open isColimit in +set_option backward.defeqAttrib.useBackward true in +noncomputable def isColimit : IsColimit (cocone κ₁ κ₂ p) where + desc s := desc s + fac s A := fac' s A + uniq s m hm := + p.isColimit.hom_ext (fun j ↦ by simp [fac s j, ← hm]) + +variable {κ₁ κ₂} in +include hκ' in +lemma isCardinalFiltered_subtype [IsCardinalFiltered J κ₁] : + IsCardinalFiltered (Subtype (IsCardinalFilteredAndHasCardinalLT κ₁ κ₂ J)) κ₂ := + isCardinalFiltered_preorder _ _ (fun K f hK ↦ by + rw [← hasCardinalLT_iff_cardinal_mk_lt] at hK + obtain ⟨B, hB₁, hB₂, hB₃⟩ := hκ' (⋃ (k : K), (f k).val) + (hasCardinalLT_iUnion _ hK (fun k ↦ (f k).prop.2)) + exact ⟨⟨B, hB₂, hB₃⟩, fun k ↦ (Set.subset_iUnion _ k).trans hB₁⟩) + +end IsCardinalFilteredAndHasCardinalLT + +variable (C : Type u) [Category.{v} C] + +variable (κ₁ κ₂) in +abbrev generator : ObjectProperty C := + (isCardinalPresentable C κ₁).colimitsCardinalClosure κ₂ + +include hκ in +lemma generator_le_isCardinalPresentable [LocallySmall.{w} C] : + generator κ₁ κ₂ C ≤ isCardinalPresentable C κ₂ := + ObjectProperty.colimitsCardinalClosure_le _ _ + (fun _ _ hJ ↦ isClosedUnderColimitsOfShape_isCardinalPresentable C hJ) + (isCardinalPresentable_monotone _ hκ.le) + +open IsCardinalFilteredAndHasCardinalLT in +include hκ hκ' in +lemma isCardinalFilteredGenerator + [IsCardinalAccessibleCategory C κ₁] : + (generator κ₁ κ₂ C).IsCardinalFilteredGenerator κ₂ where + le_isCardinalPresentable := generator_le_isCardinalPresentable hκ C + exists_colimitsOfShape X := by + have hκ₁ := isCardinalFilteredGenerator_isCardinalPresentable C κ₁ + obtain ⟨J, _, _, ⟨p⟩⟩ : + ∃ (J : Type w) (_ : PartialOrder J) (_ : IsCardinalFiltered J κ₁), + Nonempty ((isCardinalPresentable C κ₁).ColimitOfShape J X) := by + obtain ⟨J₀, _, _, ⟨p₀⟩⟩ := hκ₁.exists_colimitsOfShape X + obtain ⟨J, _, _, F, _⟩ := IsCardinalFiltered.exists_cardinal_directed J₀ κ₁ + exact ⟨_, _, inferInstance, ⟨p₀.reindex F⟩⟩ + refine ⟨Subtype (IsCardinalFilteredAndHasCardinalLT κ₁ κ₂ J), inferInstance, + isCardinalFiltered_subtype hκ', + ⟨{ diag := _, ι := _, isColimit := isColimit κ₁ κ₂ p, prop_diag_obj A := ?_ }⟩⟩ + have : (generator κ₁ κ₂ C).IsClosedUnderColimitsOfShape (Subtype A.val) := by + apply ObjectProperty.isClosedUnderColimitsOfShape_colimitsCardinalClosure + rw [hasCardinalLT_arrow_iff_of_isThin _ _ (IsRegular.aleph0_le Fact.out)] + exact A.prop.2 + exact ObjectProperty.prop_colimit _ _ + (fun ⟨a, ha⟩ ↦ ObjectProperty.le_colimitsCardinalClosure _ _ _ + (p.prop_diag_obj a)) + +include hκ hκ' in +lemma isCardinalAccessibleCategory' + (C : Type u) [Category.{v} C] [IsCardinalAccessibleCategory C κ₁] : + IsCardinalAccessibleCategory C κ₂ where + toHasCardinalFilteredColimits := .of_le C hκ.le + exists_generator := ⟨_, inferInstance, isCardinalFilteredGenerator hκ hκ' C⟩ + +end + +lemma tfae (h : κ₁ < κ₂) : + List.TFAE [SharplyLT κ₁ κ₂, + IsCardinalAccessibleCategory (CardinalDirectedPoset κ₁) κ₂, + ∀ (C : Type (w + 1)) [Category.{w} C] [IsCardinalAccessibleCategory C κ₁], + IsCardinalAccessibleCategory C κ₂, + ∀ (X : Type w) (_ : HasCardinalLT X κ₂), + ∃ (A : Set (CardinalDirectedPoset.SetCardinalLT κ₁ X)), HasCardinalLT A κ₂ ∧ IsCofinal A, + ∀ ⦃X : Type w⦄ [PartialOrder X] [IsCardinalFiltered X κ₁] (A : Set X) + (_ : HasCardinalLT A κ₂), + ∃ (B : Set X), A ⊆ B ∧ IsCardinalFiltered B κ₁ ∧ HasCardinalLT B κ₂] := by + tfae_have 1 ↔ 2 := + ⟨fun h ↦ h.isCardinalAccessible_cardinalDirectedPoset, fun _ ↦ ⟨h, inferInstance⟩⟩ + tfae_have 3 → 2 := fun h' ↦ h' _ + tfae_have 2 → 4 := fun _ X hX ↦ + exists_cofinal_of_isCardinalAccessibleCategory_cardinalDirectedPoset h.le hX + tfae_have 4 → 5 := fun h' X _ _ A hA ↦ + exists_isCardinalFiltered_set_of_exists_cofinal h h' _ hA + tfae_have 5 → 3 := fun h' C _ _ ↦ isCardinalAccessibleCategory' h (fun A hA ↦ h' A hA) C + tfae_finish + +lemma exists_cofinal (h : SharplyLT κ₁ κ₂) + {X : Type w} (hX : HasCardinalLT X κ₂) : + ∃ (A : Set (CardinalDirectedPoset.SetCardinalLT κ₁ X)), + HasCardinalLT A κ₂ ∧ IsCofinal A := by + have := (tfae h.lt).out 1 3 + exact this.1 h.isCardinalAccessible_cardinalDirectedPoset X hX + +lemma of_exists_cofinal (h₀ : κ₁ < κ₂) + (h : ∀ (X : Type w) (_ : HasCardinalLT X κ₂), + ∃ (A : Set (CardinalDirectedPoset.SetCardinalLT κ₁ X)), + HasCardinalLT A κ₂ ∧ IsCofinal A) : + SharplyLT κ₁ κ₂ := + ((tfae h₀).out 3 0).1 h + +lemma exists_isCardinalFiltered_set (h : SharplyLT κ₁ κ₂) + {X : Type w} [PartialOrder X] [IsCardinalFiltered X κ₁] + (A : Set X) (hA : HasCardinalLT A κ₂) : + ∃ (B : Set X), A ⊆ B ∧ IsCardinalFiltered B κ₁ ∧ HasCardinalLT B κ₂ := by + have := (tfae h.lt).out 1 4 + exact this.1 h.isCardinalAccessible_cardinalDirectedPoset A hA + +lemma isCardinalAccessibleCategory (h : SharplyLT κ₁ κ₂) + (C : Type u) [Category.{v} C] [IsCardinalAccessibleCategory C κ₁] : + IsCardinalAccessibleCategory C κ₂ := + isCardinalAccessibleCategory' h.lt h.exists_isCardinalFiltered_set C + +lemma trans (h₁₂ : SharplyLT κ₁ κ₂) {κ₃ : Cardinal.{w}} [Fact κ₃.IsRegular] + (h₂₃ : SharplyLT κ₂ κ₃) : + SharplyLT κ₁ κ₃ where + lt := h₁₂.lt.trans h₂₃.lt + isCardinalAccessible_cardinalDirectedPoset := by + have := h₁₂.isCardinalAccessible_cardinalDirectedPoset + exact h₂₃.isCardinalAccessibleCategory _ + end SharplyLT end Cardinal From 908028ef77f6b567a91f9d057ab649ba70cba5b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Wed, 1 Jul 2026 13:54:10 +0200 Subject: [PATCH 293/309] wip --- Mathlib.lean | 1 + .../Presentable/SolutionSetCondition.lean | 50 +++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 Mathlib/CategoryTheory/Presentable/SolutionSetCondition.lean diff --git a/Mathlib.lean b/Mathlib.lean index ff49b998f216bb..7ec4cca5cb5689 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -3277,6 +3277,7 @@ public import Mathlib.CategoryTheory.Presentable.LocallyPresentable public import Mathlib.CategoryTheory.Presentable.OrthogonalReflection public import Mathlib.CategoryTheory.Presentable.Presheaf public import Mathlib.CategoryTheory.Presentable.Retracts +public import Mathlib.CategoryTheory.Presentable.SolutionSetCondition public import Mathlib.CategoryTheory.Presentable.StrongGenerator public import Mathlib.CategoryTheory.Presentable.Type public import Mathlib.CategoryTheory.Products.Associator diff --git a/Mathlib/CategoryTheory/Presentable/SolutionSetCondition.lean b/Mathlib/CategoryTheory/Presentable/SolutionSetCondition.lean new file mode 100644 index 00000000000000..0f5a26c703a21d --- /dev/null +++ b/Mathlib/CategoryTheory/Presentable/SolutionSetCondition.lean @@ -0,0 +1,50 @@ +/- +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.Presentable.Dense +public import Mathlib.CategoryTheory.Adjunction.AdjointFunctorTheorems + +/-! +# Accessible functor satisfy the solution set condition + +-/ + +@[expose] public section + +universe w + +namespace CategoryTheory + + +variable {C D : Type*} [Category* C] [Category* D] (F : C ⥤ D) + +-- when the uniformization theorem and the accessibility of comma categories +-- enters mathlib, the assumption can be changed +attribute [local instance] IsFiltered.nonempty in +lemma SolutionSetCondition.of_isCardinalAccessible + (κ : Cardinal.{w}) [Fact κ.IsRegular] + [∀ (Y : D), IsCardinalAccessibleCategory (StructuredArrow Y F) κ] : + SolutionSetCondition.{w} F := by + intro Y + obtain ⟨P, _, hP⟩ := ObjectProperty.EssentiallySmall.exists_small.{w} + (isCardinalPresentable (StructuredArrow Y F) κ) + let ι := Shrink.{w} (Subtype P) + let f (i : ι) : Subtype P := (equivShrink.{w} _).symm i + have hf : Function.Surjective f := (equivShrink.{w} _).symm.surjective + refine ⟨ι, fun i ↦ (f i).val.right, fun i ↦ (f i).val.hom, + fun X g ↦ ?_⟩ + obtain ⟨Z, ⟨α⟩⟩ : + ∃ (Z : Subtype P), Nonempty (Z.val ⟶ StructuredArrow.mk g) := by + let E := (CostructuredArrow (isCardinalPresentable _ κ).ι ((StructuredArrow.mk g))) + have : IsFiltered E := isFiltered_of_isCardinalFiltered _ κ + let γ : E := Classical.arbitrary _ + obtain ⟨α, hα, ⟨e⟩⟩ := hP.le _ γ.left.property + exact ⟨⟨α, hα⟩, ⟨e.inv ≫ γ.hom⟩⟩ + obtain ⟨i, rfl⟩ := hf Z + exact ⟨i, α.right, StructuredArrow.w α⟩ + +end CategoryTheory From 2a2ef188e9bef3dd44a94d55e58bc427cfbb24dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Wed, 1 Jul 2026 15:03:57 +0200 Subject: [PATCH 294/309] wip --- Mathlib.lean | 1 + .../Presentable/IsDiscrete.lean | 66 +++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 Mathlib/CategoryTheory/Presentable/IsDiscrete.lean diff --git a/Mathlib.lean b/Mathlib.lean index ff49b998f216bb..923b275e340979 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -3272,6 +3272,7 @@ public import Mathlib.CategoryTheory.Presentable.Directed public import Mathlib.CategoryTheory.Presentable.EssentiallyLarge public import Mathlib.CategoryTheory.Presentable.Finite public import Mathlib.CategoryTheory.Presentable.IsCardinalFiltered +public import Mathlib.CategoryTheory.Presentable.IsDiscrete public import Mathlib.CategoryTheory.Presentable.Limits public import Mathlib.CategoryTheory.Presentable.LocallyPresentable public import Mathlib.CategoryTheory.Presentable.OrthogonalReflection diff --git a/Mathlib/CategoryTheory/Presentable/IsDiscrete.lean b/Mathlib/CategoryTheory/Presentable/IsDiscrete.lean new file mode 100644 index 00000000000000..7c7c1fadea5b33 --- /dev/null +++ b/Mathlib/CategoryTheory/Presentable/IsDiscrete.lean @@ -0,0 +1,66 @@ +/- +Copyright (c) 2026 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.Presentable.LocallyPresentable + +/-! # Presentable objects in discrete categories + +-/ + +universe w v u + +namespace CategoryTheory + +open Limits + +variable {C : Type*} [Category* C] [IsDiscrete C] + +namespace IsDiscrete + +attribute [local instance] IsFiltered.nonempty + +protected instance (priority := low) isCardinalPresentable + (X : C) (κ : Cardinal.{w}) [Fact κ.IsRegular] : + IsCardinalPresentable X κ := + .mk (fun J _ _ F c hc ↦ by + have := isFiltered_of_isCardinalFiltered J κ + refine ⟨fun g ↦ ?_, fun j f₁ f₂ _ ↦ ⟨j, 𝟙 j, by subsingleton⟩⟩ + obtain rfl := IsDiscrete.eq_of_hom g + let j : J := Classical.arbitrary _ + exact ⟨j, eqToHom (IsDiscrete.eq_of_hom (c.ι.app j)).symm, by subsingleton⟩) + +set_option backward.defeqAttrib.useBackward true in +protected instance (priority := low) isCardinalAccessible + {D : Type*} [Category* D] + (F : C ⥤ D) (κ : Cardinal.{w}) [Fact κ.IsRegular] : + F.IsCardinalAccessible κ where + preservesColimitOfShape J _ _ := ⟨fun {K} ↦ ⟨fun {c} hc ↦ ⟨by + have := isFiltered_of_isCardinalFiltered J κ + let j : J := Classical.arbitrary _ + have : IsIso ((F.mapCocone c).ι.app j) := by + dsimp; infer_instance + exact Functor.IsEventuallyConstantFrom.isColimitOfIsIso (i₀ := j) + (fun _ _ ↦ by dsimp; infer_instance) _⟩⟩⟩ + +instance (priority := low) (κ : Cardinal.{w}) [Fact κ.IsRegular] + [Subsingleton C] [Nonempty C] : + IsCardinalLocallyPresentable C κ where + has_colimits_of_shape J := ⟨fun F ↦ + ⟨Cocone.mk (Classical.arbitrary C) + { app _ := eqToHom (by subsingleton) }, + { desc _ := eqToHom (by subsingleton) }⟩ ⟩ + exists_generator := by + let X : C := Classical.arbitrary _ + refine ⟨.ofObj (fun (_ : PUnit.{w + 1}) ↦ X), inferInstance, + fun _ _ ↦ IsDiscrete.isCardinalPresentable _ _, + fun Y ↦ ⟨Discrete PUnit.{w + 1}, inferInstance, ?_, sorry⟩⟩ + obtain rfl := Subsingleton.elim X Y + sorry + +end IsDiscrete + +end CategoryTheory From 795cc43edf295f1e3759b0b7986936692c753644 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Wed, 1 Jul 2026 15:17:51 +0200 Subject: [PATCH 295/309] wip --- .../Presentable/IsDiscrete.lean | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/IsDiscrete.lean b/Mathlib/CategoryTheory/Presentable/IsDiscrete.lean index 7c7c1fadea5b33..227187ae52c14c 100644 --- a/Mathlib/CategoryTheory/Presentable/IsDiscrete.lean +++ b/Mathlib/CategoryTheory/Presentable/IsDiscrete.lean @@ -9,9 +9,14 @@ public import Mathlib.CategoryTheory.Presentable.LocallyPresentable /-! # Presentable objects in discrete categories +The purpose of this file is to show that a category with a single +object and a single morphism is locally presentable. + -/ -universe w v u +@[expose] public section + +universe w namespace CategoryTheory @@ -46,6 +51,16 @@ protected instance (priority := low) isCardinalAccessible exact Functor.IsEventuallyConstantFrom.isColimitOfIsIso (i₀ := j) (fun _ _ ↦ by dsimp; infer_instance) _⟩⟩⟩ +instance (priority := low) (κ : Cardinal.{w}) [Fact κ.IsRegular] + [Subsingleton C] [Nonempty C] : + IsCardinalFiltered C κ where + nonempty_cocone F _ := + ⟨Cocone.mk (Classical.arbitrary _) + { app _ := eqToHom (by subsingleton) }⟩ + +instance (α : Type*) [Preorder α] [Subsingleton α] : IsDiscrete α where + eq_of_hom _ := by subsingleton + instance (priority := low) (κ : Cardinal.{w}) [Fact κ.IsRegular] [Subsingleton C] [Nonempty C] : IsCardinalLocallyPresentable C κ where @@ -57,9 +72,12 @@ instance (priority := low) (κ : Cardinal.{w}) [Fact κ.IsRegular] let X : C := Classical.arbitrary _ refine ⟨.ofObj (fun (_ : PUnit.{w + 1}) ↦ X), inferInstance, fun _ _ ↦ IsDiscrete.isCardinalPresentable _ _, - fun Y ↦ ⟨Discrete PUnit.{w + 1}, inferInstance, ?_, sorry⟩⟩ + fun Y ↦ ?_⟩ obtain rfl := Subsingleton.elim X Y - sorry + exact ⟨PUnit.{w + 1}, inferInstance, inferInstance, + { diag := (Functor.const _).obj X + ι := 𝟙 _ + isColimit.desc _ := eqToHom (by subsingleton) }, fun _ ↦ ⟨⟨⟩⟩⟩ end IsDiscrete From 31412bf647e2c8e49d87d39561e7389e0b9e88d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 2 Jul 2026 09:31:33 +0200 Subject: [PATCH 296/309] added Dagur as author --- Mathlib/CategoryTheory/Presentable/SolutionSetCondition.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Presentable/SolutionSetCondition.lean b/Mathlib/CategoryTheory/Presentable/SolutionSetCondition.lean index 0f5a26c703a21d..1b4f52ced504d1 100644 --- a/Mathlib/CategoryTheory/Presentable/SolutionSetCondition.lean +++ b/Mathlib/CategoryTheory/Presentable/SolutionSetCondition.lean @@ -1,7 +1,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 +Authors: Joël Riou, Dagur Asgeirsson -/ module From 87997e6fd72e358d97aefe53b63bbb4dc48c04d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Thu, 2 Jul 2026 10:09:34 +0200 Subject: [PATCH 297/309] cleaning up --- .../CategoryTheory/ObjectProperty/Small.lean | 19 ++++++++++++++++ .../Presentable/SolutionSetCondition.lean | 22 ++++++------------- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/Mathlib/CategoryTheory/ObjectProperty/Small.lean b/Mathlib/CategoryTheory/ObjectProperty/Small.lean index b78a4eb6bc8e70..f2a8189732d657 100644 --- a/Mathlib/CategoryTheory/ObjectProperty/Small.lean +++ b/Mathlib/CategoryTheory/ObjectProperty/Small.lean @@ -41,6 +41,17 @@ lemma Small.of_le {P Q : ObjectProperty C} [ObjectProperty.Small.{w} Q] (h : P ObjectProperty.Small.{w} P := small_of_injective (Subtype.map_injective h Function.injective_id) +lemma Small.exists_eq_ofObj (P : ObjectProperty C) [ObjectProperty.Small.{w} P] : + ∃ (ι : Type w) (X : ι → C), P = .ofObj X := + ⟨Shrink.{w} (Subtype P), fun i ↦ ((equivShrink _).symm i).val, + le_antisymm (fun X hX ↦ by + rw [ofObj_iff] + exact ⟨equivShrink _ ⟨X, hX⟩, by simp⟩) (by + rw [ofObj_le_iff] + intro i + obtain ⟨X, rfl⟩ := (equivShrink _).surjective i + simpa using X.prop)⟩ + instance (P : ObjectProperty C) [ObjectProperty.Small.{w} P] : ObjectProperty.Small.{w} P.op := small_of_injective P.subtypeOpEquiv.injective @@ -141,6 +152,14 @@ lemma EssentiallySmall.exists_small (P : ObjectProperty C) [P.IsClosedUnderIsomo obtain ⟨Q, _, hQ₁, hQ₂⟩ := exists_small_le P exact ⟨Q, inferInstance, le_antisymm hQ₂ (by rwa [isoClosure_le_iff])⟩ +lemma EssentiallySmall.exists_eq_isoClosure_ofObj + (P : ObjectProperty C) [P.IsClosedUnderIsomorphisms] + [ObjectProperty.EssentiallySmall.{w} P] : + ∃ (ι : Type w) (X : ι → C), P = (ObjectProperty.ofObj X).isoClosure := by + obtain ⟨P₀, _, h⟩ := exists_small.{w} P + obtain ⟨ι, X, rfl⟩ := Small.exists_eq_ofObj.{w} P₀ + exact ⟨ι, X, h⟩ + lemma EssentiallySmall.of_le {P Q : ObjectProperty C} [ObjectProperty.EssentiallySmall.{w} Q] (h : P ≤ Q) : ObjectProperty.EssentiallySmall.{w} P where diff --git a/Mathlib/CategoryTheory/Presentable/SolutionSetCondition.lean b/Mathlib/CategoryTheory/Presentable/SolutionSetCondition.lean index 1b4f52ced504d1..3c765c82aa1a3c 100644 --- a/Mathlib/CategoryTheory/Presentable/SolutionSetCondition.lean +++ b/Mathlib/CategoryTheory/Presentable/SolutionSetCondition.lean @@ -19,7 +19,6 @@ universe w namespace CategoryTheory - variable {C D : Type*} [Category* C] [Category* D] (F : C ⥤ D) -- when the uniformization theorem and the accessibility of comma categories @@ -30,21 +29,14 @@ lemma SolutionSetCondition.of_isCardinalAccessible [∀ (Y : D), IsCardinalAccessibleCategory (StructuredArrow Y F) κ] : SolutionSetCondition.{w} F := by intro Y - obtain ⟨P, _, hP⟩ := ObjectProperty.EssentiallySmall.exists_small.{w} + obtain ⟨ι, X₀, h⟩ := ObjectProperty.EssentiallySmall.exists_eq_isoClosure_ofObj.{w} (isCardinalPresentable (StructuredArrow Y F) κ) - let ι := Shrink.{w} (Subtype P) - let f (i : ι) : Subtype P := (equivShrink.{w} _).symm i - have hf : Function.Surjective f := (equivShrink.{w} _).symm.surjective - refine ⟨ι, fun i ↦ (f i).val.right, fun i ↦ (f i).val.hom, + refine ⟨ι, fun i ↦ (X₀ i).right, fun i ↦ (X₀ i).hom, fun X g ↦ ?_⟩ - obtain ⟨Z, ⟨α⟩⟩ : - ∃ (Z : Subtype P), Nonempty (Z.val ⟶ StructuredArrow.mk g) := by - let E := (CostructuredArrow (isCardinalPresentable _ κ).ι ((StructuredArrow.mk g))) - have : IsFiltered E := isFiltered_of_isCardinalFiltered _ κ - let γ : E := Classical.arbitrary _ - obtain ⟨α, hα, ⟨e⟩⟩ := hP.le _ γ.left.property - exact ⟨⟨α, hα⟩, ⟨e.inv ≫ γ.hom⟩⟩ - obtain ⟨i, rfl⟩ := hf Z - exact ⟨i, α.right, StructuredArrow.w α⟩ + let E := CostructuredArrow (isCardinalPresentable _ κ).ι (StructuredArrow.mk g) + have : IsFiltered E := isFiltered_of_isCardinalFiltered _ κ + let γ : E := Classical.arbitrary _ + obtain ⟨_, ⟨i⟩, ⟨e⟩⟩ := h.le _ γ.left.property + exact ⟨i, _, StructuredArrow.w (e.inv ≫ γ.hom)⟩ end CategoryTheory From 93ef62cf0061d12036ecc65ee3a7d6e4ec50fd10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 3 Jul 2026 15:27:08 +0200 Subject: [PATCH 298/309] cleaning up --- .../Presentable/SharplyLT/Basic.lean | 73 ++++++++++++++----- 1 file changed, 56 insertions(+), 17 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean index 6c087ae4a19b2a..ae9e4c0c0026fe 100644 --- a/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean @@ -25,7 +25,8 @@ cardinals `κ₁ < κ₂`, this condition can be described in different ways: that is of cardinality `< κ₂`. The equivalence of these conditions (i)-(iv) is Theorem 2.11 in the book by Adámek and Rosický. Here, we take (i) as the definition, and the equivalences between the various definitions -is stated as `Cardinal.SharplyLT.tfae`. +is obtained in the lemma `Cardinal.SharplyLT.tfae`. In particular, using (ii), +we show that `Cardinal.SharplyLT` is transitive. ## References * [Adámek, J. and Rosický, J., *Locally presentable and accessible categories*][Adamek_Rosicky_1994] @@ -269,6 +270,8 @@ variable (hκ : κ₁ < κ₂) ∃ (B : Set X), A ⊆ B ∧ IsCardinalFiltered B κ₁ ∧ HasCardinalLT B κ₂) variable (κ₁ κ₂) in +/-- Given a partially ordered type `J`, this is the type +of subsets of `J` that are `κ₁`-directed and of cardinality `< κ₂`. -/ def IsCardinalFilteredAndHasCardinalLT (J : Type w) [PartialOrder J] (A : Set J) : Prop := IsCardinalFiltered A κ₁ ∧ HasCardinalLT A κ₂ @@ -286,6 +289,8 @@ instance (A : Subtype (IsCardinalFilteredAndHasCardinalLT κ₁ κ₂ J)) : have : IsCardinalFiltered (Subtype A.val) κ₁ := A.prop.1 infer_instance +/-- The singleton `{j}`, as a term in +`IsCardinalFilteredAndHasCardinalLT κ₁ κ₂ J`. -/ abbrev singleton (j : J) : Subtype (IsCardinalFilteredAndHasCardinalLT κ₁ κ₂ J) := ⟨{j}, by letI : OrderTop ({j} : Set J) := @@ -294,6 +299,8 @@ abbrev singleton (j : J) : Subtype (IsCardinalFilteredAndHasCardinalLT κ₁ κ exact isCardinalFiltered_of_hasTerminal _ _, hasCardinalLT_of_finite _ _ (IsRegular.aleph0_le Fact.out)⟩ +/-- A pair `{j ≤ j'}`, as a term in +`IsCardinalFilteredAndHasCardinalLT κ₁ κ₂ J`. -/ abbrev pair {j j' : J} (h : j ≤ j') : Subtype (IsCardinalFilteredAndHasCardinalLT κ₁ κ₂ J) := ⟨{j, j'}, by @@ -313,10 +320,15 @@ lemma le_pair' {j j' : J} (h : j ≤ j') : rw [Subtype.mk_le_mk] simp +/-- Given a presentation `p` of `X : C` as a colimit indexed by a partially +ordered type `J` of `κ₁`-presentable objects and `A` a subset of `J` +that is `κ₁`-directed and of cardinality `< κ₂`, this is +the colimit of the restriction of the diagram `p.diag` to `A`. -/ noncomputable abbrev colimit (A : Subtype (IsCardinalFilteredAndHasCardinalLT κ₁ κ₂ J)) : C := Limits.colimit ((Subtype.mono_coe A.val).functor ⋙ p.diag) +/-- The inclusions in `colimit`. -/ noncomputable abbrev colimit.ι (A : Subtype (IsCardinalFilteredAndHasCardinalLT κ₁ κ₂ J)) (a : J) (ha : a ∈ A.val) : p.diag.obj a ⟶ colimit κ₁ κ₂ p A := @@ -331,6 +343,7 @@ lemma colimit.w (A : Subtype (IsCardinalFilteredAndHasCardinalLT κ₁ κ₂ J)) (j := ⟨a, ha⟩) (j' := ⟨b, hb⟩) (homOfLE hab) set_option backward.defeqAttrib.useBackward true in +/-- The functoriality of `colimimt` with respect to the subset `A`. -/ noncomputable def colimit.map {A₁ A₂ : Subtype (IsCardinalFilteredAndHasCardinalLT κ₁ κ₂ J)} (hA : A₁ ≤ A₂) : colimit κ₁ κ₂ p A₁ ⟶ colimit κ₁ κ₂ p A₂ := @@ -358,6 +371,8 @@ lemma colimit.hom_ext apply h set_option backward.defeqAttrib.useBackward true in +/-- As `X` is the colimit of a diagram `p.diag`, this is the induced morphism +`colimit κ₁ κ₂ p A ⟶ X` from the colimit of the restriction of this diagram to `A`. -/ noncomputable def colimit.π (A : Subtype (IsCardinalFilteredAndHasCardinalLT κ₁ κ₂ J)) : colimit κ₁ κ₂ p A ⟶ X := colimit.desc _ (Cocone.mk _ @@ -378,6 +393,10 @@ lemma colimit.map_π {A₁ A₂ : Subtype (IsCardinalFilteredAndHasCardinalLT κ ext simp +/-- Given a presentation `p` of `X : C` as a colimit indexed by a partially +ordered type `J` of `κ₁`-presentable objects, this is the functor which sends +a subset `A` of `J` that is `κ₁`-directed and of cardinality `< κ₂` to the +colimit of the restriction to `A` of the diagram `p.diag`. -/ @[simps] noncomputable def functor : Subtype (IsCardinalFilteredAndHasCardinalLT κ₁ κ₂ J) ⥤ C where @@ -387,8 +406,9 @@ noncomputable def functor : map_comp f g := by ext; simp set_option backward.defeqAttrib.useBackward true in +/-- The cocone for `functor κ₁ κ₂ p` with point `X`. -/ @[simps] -noncomputable def cocone : Cocone (functor κ₁ κ₂ p) where +noncomputable def cocone : Cocone (functor κ₁ κ₂ p) where pt := X ι.app j := colimit.π κ₁ κ₂ p j @@ -397,6 +417,7 @@ namespace isColimit variable {κ₁ κ₂ p} (s : Cocone (functor κ₁ κ₂ p)) set_option backward.defeqAttrib.useBackward true in +/-- Auxiliary definition for `isColimit`. -/ @[simps] noncomputable def coconeDesc : Cocone p.diag where pt := s.pt @@ -406,6 +427,7 @@ noncomputable def coconeDesc : Cocone p.diag where ← s.w (homOfLE (le_pair' κ₁ κ₂ (leOfHom f)))] using! colimit.w_assoc .. +/-- Auxiliary definition for `isColimit`. -/ noncomputable def desc : X ⟶ s.pt := p.isColimit.desc (coconeDesc s) set_option backward.defeqAttrib.useBackward true in @@ -429,6 +451,10 @@ end isColimit open isColimit in set_option backward.defeqAttrib.useBackward true in +/-- Given a presentation `p` of `X : C` as a colimit indexed by a partially +ordered type `J` of `κ₁`-presentable objects, `X` is also the colimit +of all the colimits of the restrictions of the diagram `p.diag` +to the subsets `A` of `J` that are `κ₁`-directed and of cardinality `< κ₂`. -/ noncomputable def isColimit : IsColimit (cocone κ₁ κ₂ p) where desc s := desc s fac s A := fac' s A @@ -450,7 +476,11 @@ end IsCardinalFilteredAndHasCardinalLT variable (C : Type u) [Category.{v} C] variable (κ₁ κ₂) in -abbrev generator : ObjectProperty C := +/-- This is the closure of `κ₁`-presentable objects in category `C` with respect +to colimits indexed by categories `J` such that `Arrow J` is of cardinality `κ₂`. +When `C` is `κ₁`-accessible and `κ₁` is sharply smaller than `κ₂`, then any +object of `C` is a `κ₂`-filtered colimit of objects in this closure. -/ +public abbrev generator : ObjectProperty C := (isCardinalPresentable C κ₁).colimitsCardinalClosure κ₂ include hκ in @@ -462,7 +492,7 @@ lemma generator_le_isCardinalPresentable [LocallySmall.{w} C] : open IsCardinalFilteredAndHasCardinalLT in include hκ hκ' in -lemma isCardinalFilteredGenerator +lemma isCardinalFilteredGenerator' [IsCardinalAccessibleCategory C κ₁] : (generator κ₁ κ₂ C).IsCardinalFilteredGenerator κ₂ where le_isCardinalPresentable := generator_le_isCardinalPresentable hκ C @@ -486,22 +516,24 @@ lemma isCardinalFilteredGenerator (p.prop_diag_obj a)) include hκ hκ' in +/-- This is the implication (iv) → (ii) in the characterizations +of `SharplyLT κ₁ κ₂` in the docstring of this file. -/ lemma isCardinalAccessibleCategory' (C : Type u) [Category.{v} C] [IsCardinalAccessibleCategory C κ₁] : IsCardinalAccessibleCategory C κ₂ where toHasCardinalFilteredColimits := .of_le C hκ.le - exists_generator := ⟨_, inferInstance, isCardinalFilteredGenerator hκ hκ' C⟩ + exists_generator := ⟨_, inferInstance, isCardinalFilteredGenerator' hκ hκ' C⟩ end -lemma tfae (h : κ₁ < κ₂) : +public lemma tfae (h : κ₁ < κ₂) : List.TFAE [SharplyLT κ₁ κ₂, - IsCardinalAccessibleCategory (CardinalDirectedPoset κ₁) κ₂, - ∀ (C : Type (w + 1)) [Category.{w} C] [IsCardinalAccessibleCategory C κ₁], + /- (i) -/ IsCardinalAccessibleCategory (CardinalDirectedPoset κ₁) κ₂, + /- (ii) -/ ∀ (C : Type (w + 1)) [Category.{w} C] [IsCardinalAccessibleCategory C κ₁], IsCardinalAccessibleCategory C κ₂, - ∀ (X : Type w) (_ : HasCardinalLT X κ₂), + /- (iii) -/ ∀ (X : Type w) (_ : HasCardinalLT X κ₂), ∃ (A : Set (CardinalDirectedPoset.SetCardinalLT κ₁ X)), HasCardinalLT A κ₂ ∧ IsCofinal A, - ∀ ⦃X : Type w⦄ [PartialOrder X] [IsCardinalFiltered X κ₁] (A : Set X) + /- (iv) -/ ∀ ⦃X : Type w⦄ [PartialOrder X] [IsCardinalFiltered X κ₁] (A : Set X) (_ : HasCardinalLT A κ₂), ∃ (B : Set X), A ⊆ B ∧ IsCardinalFiltered B κ₁ ∧ HasCardinalLT B κ₂] := by tfae_have 1 ↔ 2 := @@ -514,33 +546,40 @@ lemma tfae (h : κ₁ < κ₂) : tfae_have 5 → 3 := fun h' C _ _ ↦ isCardinalAccessibleCategory' h (fun A hA ↦ h' A hA) C tfae_finish -lemma exists_cofinal (h : SharplyLT κ₁ κ₂) +public lemma exists_cofinal (h : SharplyLT κ₁ κ₂) {X : Type w} (hX : HasCardinalLT X κ₂) : ∃ (A : Set (CardinalDirectedPoset.SetCardinalLT κ₁ X)), HasCardinalLT A κ₂ ∧ IsCofinal A := by have := (tfae h.lt).out 1 3 exact this.1 h.isCardinalAccessible_cardinalDirectedPoset X hX -lemma of_exists_cofinal (h₀ : κ₁ < κ₂) +public lemma of_exists_cofinal (h₀ : κ₁ < κ₂) (h : ∀ (X : Type w) (_ : HasCardinalLT X κ₂), ∃ (A : Set (CardinalDirectedPoset.SetCardinalLT κ₁ X)), HasCardinalLT A κ₂ ∧ IsCofinal A) : SharplyLT κ₁ κ₂ := ((tfae h₀).out 3 0).1 h -lemma exists_isCardinalFiltered_set (h : SharplyLT κ₁ κ₂) +public lemma exists_isCardinalFiltered_set (h : SharplyLT κ₁ κ₂) {X : Type w} [PartialOrder X] [IsCardinalFiltered X κ₁] (A : Set X) (hA : HasCardinalLT A κ₂) : ∃ (B : Set X), A ⊆ B ∧ IsCardinalFiltered B κ₁ ∧ HasCardinalLT B κ₂ := by have := (tfae h.lt).out 1 4 exact this.1 h.isCardinalAccessible_cardinalDirectedPoset A hA -lemma isCardinalAccessibleCategory (h : SharplyLT κ₁ κ₂) +public lemma isCardinalFilteredGenerator (h : SharplyLT κ₁ κ₂) + (C : Type u) [Category.{v} C] + [IsCardinalAccessibleCategory C κ₁] : + (generator κ₁ κ₂ C).IsCardinalFilteredGenerator κ₂ := + isCardinalFilteredGenerator' h.lt (h.exists_isCardinalFiltered_set) C + +public lemma isCardinalAccessibleCategory (h : SharplyLT κ₁ κ₂) (C : Type u) [Category.{v} C] [IsCardinalAccessibleCategory C κ₁] : - IsCardinalAccessibleCategory C κ₂ := - isCardinalAccessibleCategory' h.lt h.exists_isCardinalFiltered_set C + IsCardinalAccessibleCategory C κ₂ where + toHasCardinalFilteredColimits := .of_le C h.le + exists_generator := ⟨_, inferInstance, h.isCardinalFilteredGenerator C⟩ -lemma trans (h₁₂ : SharplyLT κ₁ κ₂) {κ₃ : Cardinal.{w}} [Fact κ₃.IsRegular] +public lemma trans (h₁₂ : SharplyLT κ₁ κ₂) {κ₃ : Cardinal.{w}} [Fact κ₃.IsRegular] (h₂₃ : SharplyLT κ₂ κ₃) : SharplyLT κ₁ κ₃ where lt := h₁₂.lt.trans h₂₃.lt From ce1c966dbe90b55a2ab5a87e3b74643dc55cd695 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 3 Jul 2026 16:41:05 +0200 Subject: [PATCH 299/309] min_imports --- Mathlib/CategoryTheory/Comma/CardinalArrow.lean | 4 +--- Mathlib/CategoryTheory/Presentable/Basic.lean | 4 ---- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/Mathlib/CategoryTheory/Comma/CardinalArrow.lean b/Mathlib/CategoryTheory/Comma/CardinalArrow.lean index 0202e114ad487b..8c3a8df7e69dfa 100644 --- a/Mathlib/CategoryTheory/Comma/CardinalArrow.lean +++ b/Mathlib/CategoryTheory/Comma/CardinalArrow.lean @@ -5,10 +5,8 @@ Authors: Joël Riou -/ module -public import Mathlib.CategoryTheory.Comma.Arrow -public import Mathlib.CategoryTheory.FinCategory.Basic public import Mathlib.CategoryTheory.EssentiallySmall -public import Mathlib.Data.Set.Finite.Basic +public import Mathlib.CategoryTheory.FinCategory.Basic public import Mathlib.SetTheory.Cardinal.HasCardinalLT /-! diff --git a/Mathlib/CategoryTheory/Presentable/Basic.lean b/Mathlib/CategoryTheory/Presentable/Basic.lean index 2000d37f6c1626..0cb3f0aba089a9 100644 --- a/Mathlib/CategoryTheory/Presentable/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/Basic.lean @@ -5,12 +5,8 @@ Authors: Joël Riou -/ module -public import Mathlib.CategoryTheory.Adjunction.Limits public import Mathlib.CategoryTheory.Limits.Constructions.EventuallyConstant -public import Mathlib.CategoryTheory.Limits.Preserves.Ulift -public import Mathlib.CategoryTheory.Limits.Types.Filtered public import Mathlib.CategoryTheory.Presentable.IsCardinalFiltered -public import Mathlib.SetTheory.Cardinal.HasCardinalLT /-! # Presentable objects From 7a7d17bbdb144c382b388867a65397480db6b88c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 3 Jul 2026 17:41:15 +0200 Subject: [PATCH 300/309] wip --- .../Presentable/Uniformization.lean | 70 ++++++++++++++----- 1 file changed, 51 insertions(+), 19 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/Uniformization.lean b/Mathlib/CategoryTheory/Presentable/Uniformization.lean index 9a1e2ec24d46a3..96e9af77ff7ed0 100644 --- a/Mathlib/CategoryTheory/Presentable/Uniformization.lean +++ b/Mathlib/CategoryTheory/Presentable/Uniformization.lean @@ -47,10 +47,8 @@ namespace IsCardinalAccessibleCategory variable {C : Type u} [Category.{v} C] {D : Type u'} [Category.{v'} D] - lemma uniformization' - (F : C ⥤ D) - {κ₁ κ₂ : Cardinal.{w}} [Fact κ₁.IsRegular] [Fact κ₂.IsRegular] + (F : C ⥤ D) {κ₁ κ₂ : Cardinal.{w}} [Fact κ₁.IsRegular] [Fact κ₂.IsRegular] [IsCardinalAccessibleCategory C κ₁] [IsCardinalAccessibleCategory D κ₁] [F.IsCardinalAccessible κ₁] (hκ : κ₁.SharplyLT κ₂) (hF : isCardinalPresentable C κ₁ ≤ (isCardinalPresentable D κ₂).inverseImage F) : @@ -109,22 +107,6 @@ lemma uniformization_of_small (fun X hX ↦ isCardinalPresentable_monotone _ h₂.le _ (hκ₀ i _ (ObjectProperty.prop_map_obj _ _ hX)))⟩ -lemma uniformization_pair (F₁ F₂ : C ⥤ D) - [IsAccessibleCategory.{w} C] [IsAccessibleCategory.{w} D] - [Functor.IsAccessible.{w} F₁] [Functor.IsAccessible.{w} F₂] : - ∃ (κ : Cardinal.{w}) (_ : Fact κ.IsRegular), - IsCardinalAccessibleCategory C κ ∧ - IsCardinalAccessibleCategory D κ ∧ - F₁.IsCardinalAccessible κ ∧ F₂.IsCardinalAccessible κ ∧ - isCardinalPresentable C κ ≤ (isCardinalPresentable D κ).inverseImage F₁ ∧ - isCardinalPresentable C κ ≤ (isCardinalPresentable D κ).inverseImage F₂ := by - let F (i : Fin 2) : C ⥤ D := match i with | 0 => F₁ | 1 => F₂ - have (i : Fin 2) : Functor.IsAccessible.{w} (F i) := match i with - | 0 => by assumption - | 1 => by assumption - obtain ⟨κ, _, h₁, h₂, h₃, h₄⟩ := uniformization_of_small F - exact ⟨κ, inferInstance, h₁, h₂, h₃ 0, h₃ 1, h₄ 0, h₄ 1⟩ - lemma uniformization (F : C ⥤ D) [IsAccessibleCategory.{w} C] [IsAccessibleCategory.{w} D] [Functor.IsAccessible.{w} F] : @@ -136,6 +118,56 @@ lemma uniformization (F : C ⥤ D) obtain ⟨κ, _, h₁, h₂, h₃, h₄⟩ := uniformization_of_small (fun (_ : Fin 1) ↦ F) exact ⟨κ, inferInstance, h₁, h₂, h₃ 0, h₄ 0⟩ +lemma uniformization_pair + {C₁ C₂ D₁ D₂ : Type*} [Category* C₁] [Category* C₂] [Category* D₁] [Category* D₂] + (F₁ : C₁ ⥤ D₁) (F₂ : C₂ ⥤ D₂) + [IsAccessibleCategory.{w} C₁] [IsAccessibleCategory.{w} C₂] + [IsAccessibleCategory.{w} D₁] [IsAccessibleCategory.{w} D₂] + [Functor.IsAccessible.{w} F₁] [Functor.IsAccessible.{w} F₂] : + ∃ (κ : Cardinal.{w}) (_ : Fact κ.IsRegular), + IsCardinalAccessibleCategory C₁ κ ∧ IsCardinalAccessibleCategory D₁ κ ∧ + IsCardinalAccessibleCategory C₂ κ ∧ IsCardinalAccessibleCategory D₂ κ ∧ + F₁.IsCardinalAccessible κ ∧ F₂.IsCardinalAccessible κ ∧ + isCardinalPresentable _ κ ≤ (isCardinalPresentable _ κ).inverseImage F₁ ∧ + isCardinalPresentable _ κ ≤ (isCardinalPresentable _ κ).inverseImage F₂ := by + obtain ⟨κ, _, _, _, _, _, _, _⟩ : + ∃ (κ : Cardinal.{w}) (_ : Fact κ.IsRegular), + IsCardinalAccessibleCategory C₁ κ ∧ IsCardinalAccessibleCategory D₁ κ ∧ + IsCardinalAccessibleCategory C₂ κ ∧ IsCardinalAccessibleCategory D₂ κ ∧ + F₁.IsCardinalAccessible κ ∧ F₂.IsCardinalAccessible κ := by + obtain ⟨κ₁, _, _⟩ := IsAccessibleCategory.exists_cardinal C₁ + obtain ⟨κ₁', _, _⟩ := IsAccessibleCategory.exists_cardinal D₁ + obtain ⟨κ₁'', _, _⟩ := Functor.IsAccessible.exists_cardinal F₁ + obtain ⟨κ₂, _, _⟩ := IsAccessibleCategory.exists_cardinal C₂ + obtain ⟨κ₂', _, _⟩ := IsAccessibleCategory.exists_cardinal D₂ + obtain ⟨κ₂'', _, _⟩ := Functor.IsAccessible.exists_cardinal F₂ + obtain ⟨α₁, _, h₁, h₁', h₁''⟩ := Cardinal.SharplyLT.exists_of_triple κ₁ κ₁' κ₁'' + obtain ⟨α₂, _, h₂, h₂', h₂''⟩ := Cardinal.SharplyLT.exists_of_triple κ₂ κ₂' κ₂'' + obtain ⟨κ, _, hκ₁, hκ₂⟩ := Cardinal.SharplyLT.exists_of_pair α₁ α₂ + exact ⟨κ, inferInstance, + (h₁.trans hκ₁).isCardinalAccessibleCategory C₁, + (h₁'.trans hκ₁).isCardinalAccessibleCategory D₁, + (h₂.trans hκ₂).isCardinalAccessibleCategory C₂, + (h₂'.trans hκ₂).isCardinalAccessibleCategory D₂, + Functor.isCardinalAccessible_of_le _ (h₁''.trans hκ₁).le, + Functor.isCardinalAccessible_of_le _ (h₂''.trans hκ₂).le⟩ + obtain ⟨κ₁, _, hκ₁⟩ := + ObjectProperty.le_isCardinalPresentable.{w} ((isCardinalPresentable C₁ κ).map F₁) + obtain ⟨κ₂, _, hκ₂⟩ := + ObjectProperty.le_isCardinalPresentable.{w} ((isCardinalPresentable C₂ κ).map F₂) + obtain ⟨κ', _, hκ, hκ₁', hκ₂'⟩ := Cardinal.SharplyLT.exists_of_triple κ κ₁ κ₂ + refine ⟨κ', inferInstance, hκ.isCardinalAccessibleCategory _, + hκ.isCardinalAccessibleCategory _, hκ.isCardinalAccessibleCategory _, + hκ.isCardinalAccessibleCategory _, + Functor.isCardinalAccessible_of_le _ hκ.le, + Functor.isCardinalAccessible_of_le _ hκ.le, + uniformization' _ hκ (fun X₁ hX₁ ↦ ?_), + uniformization' _ hκ (fun X₂ hX₂ ↦ ?_)⟩ + · have := hκ₁ _ (ObjectProperty.prop_map_obj _ F₁ hX₁) + exact isCardinalPresentable_of_le _ hκ₁'.le + · have := hκ₂ _ (ObjectProperty.prop_map_obj _ F₂ hX₂) + exact isCardinalPresentable_of_le _ hκ₂'.le + end IsCardinalAccessibleCategory end CategoryTheory From bb8319933e34dbc4e6cf105cfb61779a86b3edd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= <37772949+joelriou@users.noreply.github.com> Date: Fri, 3 Jul 2026 17:41:56 +0200 Subject: [PATCH 301/309] Update Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean Co-authored-by: smorel394 <67864981+smorel394@users.noreply.github.com> --- Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean index ae9e4c0c0026fe..26604c69c47682 100644 --- a/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean @@ -343,7 +343,7 @@ lemma colimit.w (A : Subtype (IsCardinalFilteredAndHasCardinalLT κ₁ κ₂ J)) (j := ⟨a, ha⟩) (j' := ⟨b, hb⟩) (homOfLE hab) set_option backward.defeqAttrib.useBackward true in -/-- The functoriality of `colimimt` with respect to the subset `A`. -/ +/-- The functoriality of `colimit` with respect to the subset `A`. -/ noncomputable def colimit.map {A₁ A₂ : Subtype (IsCardinalFilteredAndHasCardinalLT κ₁ κ₂ J)} (hA : A₁ ≤ A₂) : colimit κ₁ κ₂ p A₁ ⟶ colimit κ₁ κ₂ p A₂ := From 8d82a45b031af0ff0d22e21541160794568aaa76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= <37772949+joelriou@users.noreply.github.com> Date: Fri, 3 Jul 2026 17:42:06 +0200 Subject: [PATCH 302/309] Update Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean Co-authored-by: smorel394 <67864981+smorel394@users.noreply.github.com> --- Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean index 26604c69c47682..e8b8ae2208da1c 100644 --- a/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean @@ -477,7 +477,7 @@ variable (C : Type u) [Category.{v} C] variable (κ₁ κ₂) in /-- This is the closure of `κ₁`-presentable objects in category `C` with respect -to colimits indexed by categories `J` such that `Arrow J` is of cardinality `κ₂`. +to colimits indexed by categories `J` such that `Arrow J` is of cardinality < `κ₂`. When `C` is `κ₁`-accessible and `κ₁` is sharply smaller than `κ₂`, then any object of `C` is a `κ₂`-filtered colimit of objects in this closure. -/ public abbrev generator : ObjectProperty C := From 4228b2bedbdad702499c9de129ff202942c28df1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= <37772949+joelriou@users.noreply.github.com> Date: Fri, 3 Jul 2026 17:42:17 +0200 Subject: [PATCH 303/309] Update Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean Co-authored-by: smorel394 <67864981+smorel394@users.noreply.github.com> --- Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean index e8b8ae2208da1c..0f10ab535a9524 100644 --- a/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean @@ -476,7 +476,7 @@ end IsCardinalFilteredAndHasCardinalLT variable (C : Type u) [Category.{v} C] variable (κ₁ κ₂) in -/-- This is the closure of `κ₁`-presentable objects in category `C` with respect +/-- This is the closure of `κ₁`-presentable objects in the category `C` with respect to colimits indexed by categories `J` such that `Arrow J` is of cardinality < `κ₂`. When `C` is `κ₁`-accessible and `κ₁` is sharply smaller than `κ₂`, then any object of `C` is a `κ₂`-filtered colimit of objects in this closure. -/ From 4e417bead0a072b9e2cdb1b51d294cb891b34d72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 3 Jul 2026 17:48:15 +0200 Subject: [PATCH 304/309] better docstrings --- .../Presentable/SharplyLT/Basic.lean | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean index 0f10ab535a9524..000d49f239ad77 100644 --- a/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean @@ -479,7 +479,8 @@ variable (κ₁ κ₂) in /-- This is the closure of `κ₁`-presentable objects in the category `C` with respect to colimits indexed by categories `J` such that `Arrow J` is of cardinality < `κ₂`. When `C` is `κ₁`-accessible and `κ₁` is sharply smaller than `κ₂`, then any -object of `C` is a `κ₂`-filtered colimit of objects in this closure. -/ +object of `C` is a `κ₂`-filtered colimit of objects in this closure, +see `Cardinal.SharplyLT.isCardinalFilteredGenerator` below. -/ public abbrev generator : ObjectProperty C := (isCardinalPresentable C κ₁).colimitsCardinalClosure κ₂ @@ -492,6 +493,11 @@ lemma generator_le_isCardinalPresentable [LocallySmall.{w} C] : open IsCardinalFilteredAndHasCardinalLT in include hκ hκ' in +/-- This is part of the proof of the implication (iv) → (ii) in the +characterizations of `SharplyLT κ₁ κ₂` in the docstring of this file. +See the lemma `Cardinal.SharplyLT.isCardinalFilteredGenerator` for the +version of this lemma with the assumption `SharplyLT κ₁ κ₂` instead of the +condition (iv). -/ lemma isCardinalFilteredGenerator' [IsCardinalAccessibleCategory C κ₁] : (generator κ₁ κ₂ C).IsCardinalFilteredGenerator κ₂ where @@ -517,7 +523,10 @@ lemma isCardinalFilteredGenerator' include hκ hκ' in /-- This is the implication (iv) → (ii) in the characterizations -of `SharplyLT κ₁ κ₂` in the docstring of this file. -/ +of `SharplyLT κ₁ κ₂` in the docstring of this file. +See the lemma `Cardinal.SharplyLT.isCardinalAccessibleCategory` +for the version of the lemma with the assumption `SharplyLT κ₁ κ₂` +instead of the condition (iv). -/ lemma isCardinalAccessibleCategory' (C : Type u) [Category.{v} C] [IsCardinalAccessibleCategory C κ₁] : IsCardinalAccessibleCategory C κ₂ where @@ -568,8 +577,7 @@ public lemma exists_isCardinalFiltered_set (h : SharplyLT κ₁ κ₂) exact this.1 h.isCardinalAccessible_cardinalDirectedPoset A hA public lemma isCardinalFilteredGenerator (h : SharplyLT κ₁ κ₂) - (C : Type u) [Category.{v} C] - [IsCardinalAccessibleCategory C κ₁] : + (C : Type u) [Category.{v} C] [IsCardinalAccessibleCategory C κ₁] : (generator κ₁ κ₂ C).IsCardinalFilteredGenerator κ₂ := isCardinalFilteredGenerator' h.lt (h.exists_isCardinalFiltered_set) C From d4614899c29f4ceb8794dec42a5e0e38d70bed41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 3 Jul 2026 17:54:39 +0200 Subject: [PATCH 305/309] better syntax --- Mathlib/CategoryTheory/Presentable/Uniformization.lean | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/Uniformization.lean b/Mathlib/CategoryTheory/Presentable/Uniformization.lean index 96e9af77ff7ed0..22b6d6d46f016b 100644 --- a/Mathlib/CategoryTheory/Presentable/Uniformization.lean +++ b/Mathlib/CategoryTheory/Presentable/Uniformization.lean @@ -151,10 +151,8 @@ lemma uniformization_pair (h₂'.trans hκ₂).isCardinalAccessibleCategory D₂, Functor.isCardinalAccessible_of_le _ (h₁''.trans hκ₁).le, Functor.isCardinalAccessible_of_le _ (h₂''.trans hκ₂).le⟩ - obtain ⟨κ₁, _, hκ₁⟩ := - ObjectProperty.le_isCardinalPresentable.{w} ((isCardinalPresentable C₁ κ).map F₁) - obtain ⟨κ₂, _, hκ₂⟩ := - ObjectProperty.le_isCardinalPresentable.{w} ((isCardinalPresentable C₂ κ).map F₂) + obtain ⟨κ₁, _, hκ₁⟩ := ((isCardinalPresentable C₁ κ).map F₁).le_isCardinalPresentable + obtain ⟨κ₂, _, hκ₂⟩ := ((isCardinalPresentable C₂ κ).map F₂).le_isCardinalPresentable obtain ⟨κ', _, hκ, hκ₁', hκ₂'⟩ := Cardinal.SharplyLT.exists_of_triple κ κ₁ κ₂ refine ⟨κ', inferInstance, hκ.isCardinalAccessibleCategory _, hκ.isCardinalAccessibleCategory _, hκ.isCardinalAccessibleCategory _, From 7ad240b79da02d7e982430e247afa6a9a0e5b898 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 3 Jul 2026 20:30:42 +0200 Subject: [PATCH 306/309] fix --- Mathlib/CategoryTheory/Limits/Comma.lean | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/Mathlib/CategoryTheory/Limits/Comma.lean b/Mathlib/CategoryTheory/Limits/Comma.lean index f287ee70a0e5cb..d466ee5bc80337 100644 --- a/Mathlib/CategoryTheory/Limits/Comma.lean +++ b/Mathlib/CategoryTheory/Limits/Comma.lean @@ -169,28 +169,6 @@ noncomputable def coconeOfPreservesIsColimit [PreservesColimit (F ⋙ fst L R) L IsColimit (coconeOfPreserves F t₁ c₂) := fstSndJointlyReflectColimit t₁ t₂ -set_option backward.defeqAttrib.useBackward true in -def fstSndJointlyReflectColimit {F : J ⥤ Comma L R} {c : Cocone F} - [PreservesColimit (F ⋙ fst _ _) L] - (h₁ : IsColimit ((fst _ _).mapCocone c)) - (h₂ : IsColimit ((snd _ _).mapCocone c)) : - IsColimit c where - desc s := - { left := h₁.desc ((fst _ _).mapCocone s) - right := h₂.desc ((snd _ _).mapCocone s) - w := (isColimitOfPreserves L h₁).hom_ext (fun j ↦ by - simp [← Functor.map_comp_assoc, ← Functor.map_comp, - dsimp% h₁.fac ((fst _ _).mapCocone s) j, - dsimp% h₂.fac ((snd _ _).mapCocone s) j]) } - fac s j := by - ext - · exact h₁.fac ((fst _ _).mapCocone s) j - · exact h₂.fac ((snd _ _).mapCocone s) j - uniq s m hm := by - ext - · exact h₁.uniq ((fst _ _).mapCocone s) _ (fun j ↦ by simp [← hm]) - · exact h₂.uniq ((snd _ _).mapCocone s) _ (fun j ↦ by simp [← hm]) - instance hasLimit (F : J ⥤ Comma L R) [HasLimit (F ⋙ fst L R)] [HasLimit (F ⋙ snd L R)] [PreservesLimit (F ⋙ snd L R) R] : HasLimit F := HasLimit.mk ⟨_, coneOfPreservesIsLimit _ (limit.isLimit _) (limit.isLimit _)⟩ From 09ddf8281b235b8cff94e0772597996afaeb9e74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 3 Jul 2026 20:33:07 +0200 Subject: [PATCH 307/309] fix --- Mathlib/CategoryTheory/Presentable/Comma.lean | 48 +------------------ 1 file changed, 1 insertion(+), 47 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/Comma.lean b/Mathlib/CategoryTheory/Presentable/Comma.lean index 9639023d47a786..6143a2dc2d94c8 100644 --- a/Mathlib/CategoryTheory/Presentable/Comma.lean +++ b/Mathlib/CategoryTheory/Presentable/Comma.lean @@ -6,6 +6,7 @@ Authors: Joël Riou module public import Mathlib.CategoryTheory.Presentable.Dense +public import Mathlib.CategoryTheory.Presentable.PreservesCardinalPresentable public import Mathlib.CategoryTheory.Presentable.LocallyPresentable public import Mathlib.CategoryTheory.Limits.Comma public import Mathlib.CategoryTheory.Limits.Final @@ -25,53 +26,6 @@ namespace CategoryTheory open Limits --- to be moved -set_option backward.isDefEq.respectTransparency false in -set_option backward.defeqAttrib.useBackward true in -open IsFiltered in -lemma IsCardinalPresentable.mk - {C : Type*} [Category* C] {X : C} {κ : Cardinal.{w}} [Fact κ.IsRegular] - (h : ∀ (J : Type w) (_ : Category.{w} J) (_ : IsCardinalFiltered J κ) - (F : J ⥤ C) (c : Cocone F) (_ : IsColimit c), - (∀ (g : X ⟶ c.pt), ∃ (j : J) (f : X ⟶ F.obj j), f ≫ c.ι.app j = g) ∧ - (∀ (j : J) (f₁ f₂ : X ⟶ F.obj j) (_ : f₁ ≫ c.ι.app j = f₂ ≫ c.ι.app j), - ∃ (j' : J) (a : j ⟶ j'), f₁ ≫ F.map a = f₂ ≫ F.map a)) : - IsCardinalPresentable X κ where - preservesColimitOfShape J _ _ := - ⟨fun {F} ↦ ⟨fun {c} hc ↦ by - have := isFiltered_of_isCardinalFiltered J κ - rw [Types.isColimit_iff_coconeTypesIsColimit] - refine ⟨fun f₁ f₂ hf ↦ ?_, fun g ↦ ?_⟩ - · obtain ⟨j₁, f₁, rfl⟩ := Functor.ιColimitType_jointly_surjective _ f₁ - obtain ⟨j₂, f₂, rfl⟩ := Functor.ιColimitType_jointly_surjective _ f₂ - dsimp at f₁ f₂ hf - obtain ⟨j', a, ha⟩ := (h J _ inferInstance F c hc).2 _ (f₁ ≫ F.map (leftToMax j₁ j₂)) - (f₂ ≫ F.map (rightToMax j₁ j₂)) (by simpa) - simp only [Category.assoc] at ha - exact Functor.ιColimitType_eq_of_map_eq_map _ _ _ - (leftToMax j₁ j₂ ≫ a) (rightToMax j₁ j₂ ≫ a) (by simpa) - · obtain ⟨j, f, rfl⟩ := (h J _ inferInstance F c hc).1 g - exact ⟨Functor.ιColimitType _ j f, rfl⟩⟩⟩ - -namespace Functor - -variable {C D : Type*} [Category* C] [Category* D] - --- to be moved -class PreservesCardinalPresentable - (F : C ⥤ D) (κ : Cardinal.{w}) [Fact κ.IsRegular] : Prop where - le_inverseImage_isCardinalPresentable (F κ) : - isCardinalPresentable C κ ≤ (isCardinalPresentable D κ).inverseImage F - -export PreservesCardinalPresentable (le_inverseImage_isCardinalPresentable) - -instance (F : C ⥤ D) (κ : Cardinal.{w}) [Fact κ.IsRegular] (X : C) - [IsCardinalPresentable X κ] [F.PreservesCardinalPresentable κ] : - IsCardinalPresentable (F.obj X) κ := - le_inverseImage_isCardinalPresentable F κ _ (by assumption) - -end Functor - namespace Comma variable {C₁ : Type u₁} [Category.{v₁} C₁] {C₂ : Type u₂} [Category.{v₂} C₂] From 73951d424c9c18fc92ba063ac697a50959096252 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 3 Jul 2026 20:46:33 +0200 Subject: [PATCH 308/309] wip --- Mathlib/CategoryTheory/Presentable/Comma.lean | 54 +++++++++++++++++-- .../Presentable/SolutionSetCondition.lean | 2 +- .../Presentable/Uniformization.lean | 9 ++-- 3 files changed, 55 insertions(+), 10 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/Comma.lean b/Mathlib/CategoryTheory/Presentable/Comma.lean index 6143a2dc2d94c8..c77205d501725a 100644 --- a/Mathlib/CategoryTheory/Presentable/Comma.lean +++ b/Mathlib/CategoryTheory/Presentable/Comma.lean @@ -6,7 +6,7 @@ Authors: Joël Riou module public import Mathlib.CategoryTheory.Presentable.Dense -public import Mathlib.CategoryTheory.Presentable.PreservesCardinalPresentable +public import Mathlib.CategoryTheory.Presentable.Uniformization public import Mathlib.CategoryTheory.Presentable.LocallyPresentable public import Mathlib.CategoryTheory.Limits.Comma public import Mathlib.CategoryTheory.Limits.Final @@ -26,16 +26,18 @@ namespace CategoryTheory open Limits +variable {C₁ : Type u₁} [Category.{v₁} C₁] {C₂ : Type u₂} [Category.{v₂} C₂] + {D : Type u₃} [Category.{v₃} D] + namespace Comma -variable {C₁ : Type u₁} [Category.{v₁} C₁] {C₂ : Type u₂} [Category.{v₂} C₂] - {D : Type u₃} [Category.{v₃} D] (F₁ : C₁ ⥤ D) (F₂ : C₂ ⥤ D) - (κ : Cardinal.{w}) [Fact κ.IsRegular] +variable (F₁ : C₁ ⥤ D) (F₂ : C₂ ⥤ D) section -variable [F₁.IsCardinalAccessible κ] +variable (κ : Cardinal.{w}) [Fact κ.IsRegular] [HasCardinalFilteredColimits C₁ κ] [HasCardinalFilteredColimits C₂ κ] + [F₁.IsCardinalAccessible κ] instance : HasCardinalFilteredColimits (Comma F₁ F₂) κ where hasColimitsOfShape J _ _ := by @@ -54,6 +56,10 @@ instance : (Comma.snd F₁ F₂).IsCardinalAccessible κ where end +section + +variable (κ : Cardinal.{w}) [Fact κ.IsRegular] + set_option backward.isDefEq.respectTransparency false in set_option backward.defeqAttrib.useBackward true in open IsFiltered in @@ -398,6 +404,44 @@ instance : (Comma.snd F₁ F₂).PreservesCardinalPresentable κ where simp only [Comma.isCardinalPresentable_iff] at hf tauto +end + +section + +variable [IsAccessibleCategory.{w} C₁] [IsAccessibleCategory.{w} C₂] + [Functor.IsAccessible.{w} F₁] [Functor.IsAccessible.{w} F₂] + [IsAccessibleCategory.{w} D] + +instance test : IsAccessibleCategory.{w} (Comma F₁ F₂) := by + obtain ⟨κ, _, _, _, _, _, _, _, _, _⟩ := + IsCardinalAccessibleCategory.uniformization_pair F₁ F₂ + exact ⟨κ, inferInstance, inferInstance⟩ + +instance : Functor.IsAccessible.{w} (Comma.fst F₁ F₂) := by + obtain ⟨κ, _, _, _, _, _, _, _, _, _⟩ := + IsCardinalAccessibleCategory.uniformization_pair F₁ F₂ + exact ⟨κ, inferInstance, inferInstance⟩ + +instance : Functor.IsAccessible.{w} (Comma.snd F₁ F₂) := by + obtain ⟨κ, _, _, _, _, _, _, _, _, _⟩ := + IsCardinalAccessibleCategory.uniformization_pair F₁ F₂ + exact ⟨κ, inferInstance, inferInstance⟩ + +end + end Comma +namespace CostructuredArrow + +variable + [IsAccessibleCategory.{w} C₁] [IsAccessibleCategory.{w} C₂] (F : C₁ ⥤ C₂) + [Functor.IsAccessible.{w} F] (Y : C₂) + +instance : IsAccessibleCategory.{w} (CostructuredArrow F Y) := by + change IsAccessibleCategory.{w} (Comma _ _) + --apply Comma.test + sorry + +end CostructuredArrow + end CategoryTheory diff --git a/Mathlib/CategoryTheory/Presentable/SolutionSetCondition.lean b/Mathlib/CategoryTheory/Presentable/SolutionSetCondition.lean index 3c765c82aa1a3c..b39347c467e0c1 100644 --- a/Mathlib/CategoryTheory/Presentable/SolutionSetCondition.lean +++ b/Mathlib/CategoryTheory/Presentable/SolutionSetCondition.lean @@ -26,7 +26,7 @@ variable {C D : Type*} [Category* C] [Category* D] (F : C ⥤ D) attribute [local instance] IsFiltered.nonempty in lemma SolutionSetCondition.of_isCardinalAccessible (κ : Cardinal.{w}) [Fact κ.IsRegular] - [∀ (Y : D), IsCardinalAccessibleCategory (StructuredArrow Y F) κ] : + [∀ (Y : D), IsCardinalAccessibleCategory.{w} (StructuredArrow Y F) κ] : SolutionSetCondition.{w} F := by intro Y obtain ⟨ι, X₀, h⟩ := ObjectProperty.EssentiallySmall.exists_eq_isoClosure_ofObj.{w} diff --git a/Mathlib/CategoryTheory/Presentable/Uniformization.lean b/Mathlib/CategoryTheory/Presentable/Uniformization.lean index 22b6d6d46f016b..b1253057b517cb 100644 --- a/Mathlib/CategoryTheory/Presentable/Uniformization.lean +++ b/Mathlib/CategoryTheory/Presentable/Uniformization.lean @@ -6,6 +6,7 @@ Authors: Joël Riou module public import Mathlib.CategoryTheory.Presentable.SharplyLT.Lemmas +public import Mathlib.CategoryTheory.Presentable.PreservesCardinalPresentable /-! # The uniformization theorem @@ -128,8 +129,8 @@ lemma uniformization_pair IsCardinalAccessibleCategory C₁ κ ∧ IsCardinalAccessibleCategory D₁ κ ∧ IsCardinalAccessibleCategory C₂ κ ∧ IsCardinalAccessibleCategory D₂ κ ∧ F₁.IsCardinalAccessible κ ∧ F₂.IsCardinalAccessible κ ∧ - isCardinalPresentable _ κ ≤ (isCardinalPresentable _ κ).inverseImage F₁ ∧ - isCardinalPresentable _ κ ≤ (isCardinalPresentable _ κ).inverseImage F₂ := by + F₁.PreservesCardinalPresentable κ ∧ + F₂.PreservesCardinalPresentable κ := by obtain ⟨κ, _, _, _, _, _, _, _⟩ : ∃ (κ : Cardinal.{w}) (_ : Fact κ.IsRegular), IsCardinalAccessibleCategory C₁ κ ∧ IsCardinalAccessibleCategory D₁ κ ∧ @@ -159,8 +160,8 @@ lemma uniformization_pair hκ.isCardinalAccessibleCategory _, Functor.isCardinalAccessible_of_le _ hκ.le, Functor.isCardinalAccessible_of_le _ hκ.le, - uniformization' _ hκ (fun X₁ hX₁ ↦ ?_), - uniformization' _ hκ (fun X₂ hX₂ ↦ ?_)⟩ + ⟨uniformization' _ hκ (fun X₁ hX₁ ↦ ?_)⟩, + ⟨uniformization' _ hκ (fun X₂ hX₂ ↦ ?_)⟩⟩ · have := hκ₁ _ (ObjectProperty.prop_map_obj _ F₁ hX₁) exact isCardinalPresentable_of_le _ hκ₁'.le · have := hκ₂ _ (ObjectProperty.prop_map_obj _ F₂ hX₂) From b0f61e2fa47a31e318c694fe655697d14e687f60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Riou?= Date: Fri, 3 Jul 2026 21:04:29 +0200 Subject: [PATCH 309/309] wip --- Mathlib/CategoryTheory/Presentable/Basic.lean | 3 + Mathlib/CategoryTheory/Presentable/Comma.lean | 67 +++++++++++++++++-- .../Presentable/IsDiscrete.lean | 9 +++ .../Presentable/SolutionSetCondition.lean | 11 ++- 4 files changed, 78 insertions(+), 12 deletions(-) diff --git a/Mathlib/CategoryTheory/Presentable/Basic.lean b/Mathlib/CategoryTheory/Presentable/Basic.lean index a5ae5c3748e867..96769b61ee0d70 100644 --- a/Mathlib/CategoryTheory/Presentable/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/Basic.lean @@ -118,6 +118,9 @@ lemma isAccessible_of_isCardinalAccessible (κ : Cardinal.{w}) [Fact κ.IsRegula [IsCardinalAccessible F κ] : IsAccessible.{w} F where exists_cardinal := ⟨κ, inferInstance, inferInstance⟩ +instance : IsAccessible.{w} (𝟭 C) := + ⟨.aleph0, Cardinal.fact_isRegular_aleph0, inferInstance⟩ + instance {E : Type u₃} [Category.{v₃} E] (F : C ⥤ D) (G : D ⥤ E) [IsAccessible.{w} F] [IsAccessible.{w} G] : IsAccessible.{w} (F ⋙ G) := by obtain ⟨κF, _, _⟩ := IsAccessible.exists_cardinal (F := F) diff --git a/Mathlib/CategoryTheory/Presentable/Comma.lean b/Mathlib/CategoryTheory/Presentable/Comma.lean index c77205d501725a..9b9244bcb904e5 100644 --- a/Mathlib/CategoryTheory/Presentable/Comma.lean +++ b/Mathlib/CategoryTheory/Presentable/Comma.lean @@ -6,6 +6,7 @@ Authors: Joël Riou module public import Mathlib.CategoryTheory.Presentable.Dense +public import Mathlib.CategoryTheory.Presentable.IsDiscrete public import Mathlib.CategoryTheory.Presentable.Uniformization public import Mathlib.CategoryTheory.Presentable.LocallyPresentable public import Mathlib.CategoryTheory.Limits.Comma @@ -431,17 +432,71 @@ end end Comma +namespace Arrow + +variable [IsAccessibleCategory.{w} D] + +instance : IsAccessibleCategory.{w} (Arrow D) := + inferInstanceAs (IsAccessibleCategory.{w} (Comma _ _)) + +instance : Functor.IsAccessible.{w} (Arrow.leftFunc : Arrow D ⥤ D) := + inferInstanceAs (Functor.IsAccessible.{w} (Comma.fst _ _)) + +instance : Functor.IsAccessible.{w} (Arrow.rightFunc : Arrow D ⥤ D) := + inferInstanceAs (Functor.IsAccessible.{w} (Comma.snd _ _)) + +end Arrow + namespace CostructuredArrow variable - [IsAccessibleCategory.{w} C₁] [IsAccessibleCategory.{w} C₂] (F : C₁ ⥤ C₂) - [Functor.IsAccessible.{w} F] (Y : C₂) + [IsAccessibleCategory.{w} C₁] [IsAccessibleCategory.{w} C₂] + (F : C₁ ⥤ C₂) [Functor.IsAccessible.{w} F] (Y : C₂) -instance : IsAccessibleCategory.{w} (CostructuredArrow F Y) := by - change IsAccessibleCategory.{w} (Comma _ _) - --apply Comma.test - sorry +instance : IsAccessibleCategory.{w} (CostructuredArrow F Y) := + inferInstanceAs (IsAccessibleCategory.{w} (Comma _ _)) + +instance : Functor.IsAccessible.{w} (CostructuredArrow.proj F Y) := + inferInstanceAs (Functor.IsAccessible.{w} (Comma.fst _ _)) end CostructuredArrow +namespace StructuredArrow + +variable + [IsAccessibleCategory.{w} C₁] [IsAccessibleCategory.{w} C₂] + (F : C₁ ⥤ C₂) [Functor.IsAccessible.{w} F] (X : C₂) + +instance : IsAccessibleCategory.{w} (StructuredArrow X F) := + inferInstanceAs (IsAccessibleCategory.{w} (Comma _ _)) + +instance : Functor.IsAccessible.{w} (StructuredArrow.proj X F) := + inferInstanceAs (Functor.IsAccessible.{w} (Comma.snd _ _)) + +end StructuredArrow + +namespace Over + +variable [IsAccessibleCategory.{w} D] (Y : D) + +instance : IsAccessibleCategory.{w} (Over Y) := + inferInstanceAs (IsAccessibleCategory.{w} (CostructuredArrow _ _)) + +instance : Functor.IsAccessible.{w} (Over.forget Y) := + inferInstanceAs (Functor.IsAccessible.{w} (CostructuredArrow.proj _ _)) + +end Over + +namespace Under + +variable [IsAccessibleCategory.{w} D] (X : D) + +instance : IsAccessibleCategory.{w} (Under X) := + inferInstanceAs (IsAccessibleCategory.{w} (StructuredArrow _ _)) + +instance : Functor.IsAccessible.{w} (Under.forget X) := + inferInstanceAs (Functor.IsAccessible.{w} (StructuredArrow.proj _ _)) + +end Under + end CategoryTheory diff --git a/Mathlib/CategoryTheory/Presentable/IsDiscrete.lean b/Mathlib/CategoryTheory/Presentable/IsDiscrete.lean index 227187ae52c14c..06919407740f83 100644 --- a/Mathlib/CategoryTheory/Presentable/IsDiscrete.lean +++ b/Mathlib/CategoryTheory/Presentable/IsDiscrete.lean @@ -51,6 +51,11 @@ protected instance (priority := low) isCardinalAccessible exact Functor.IsEventuallyConstantFrom.isColimitOfIsIso (i₀ := j) (fun _ _ ↦ by dsimp; infer_instance) _⟩⟩⟩ +instance (priority := low) + {D : Type*} [Category* D] (F : C ⥤ D) : + Functor.IsAccessible.{w} F := + ⟨.aleph0, Cardinal.fact_isRegular_aleph0, inferInstance⟩ + instance (priority := low) (κ : Cardinal.{w}) [Fact κ.IsRegular] [Subsingleton C] [Nonempty C] : IsCardinalFiltered C κ where @@ -79,6 +84,10 @@ instance (priority := low) (κ : Cardinal.{w}) [Fact κ.IsRegular] ι := 𝟙 _ isColimit.desc _ := eqToHom (by subsingleton) }, fun _ ↦ ⟨⟨⟩⟩⟩ +instance (priority := low) [Subsingleton C] [Nonempty C] : + IsLocallyPresentable.{w} C := + ⟨.aleph0, Cardinal.fact_isRegular_aleph0, inferInstance⟩ + end IsDiscrete end CategoryTheory diff --git a/Mathlib/CategoryTheory/Presentable/SolutionSetCondition.lean b/Mathlib/CategoryTheory/Presentable/SolutionSetCondition.lean index b39347c467e0c1..b3ea7db90ceb49 100644 --- a/Mathlib/CategoryTheory/Presentable/SolutionSetCondition.lean +++ b/Mathlib/CategoryTheory/Presentable/SolutionSetCondition.lean @@ -5,7 +5,7 @@ Authors: Joël Riou, Dagur Asgeirsson -/ module -public import Mathlib.CategoryTheory.Presentable.Dense +public import Mathlib.CategoryTheory.Presentable.Comma public import Mathlib.CategoryTheory.Adjunction.AdjointFunctorTheorems /-! @@ -19,16 +19,15 @@ universe w namespace CategoryTheory -variable {C D : Type*} [Category* C] [Category* D] (F : C ⥤ D) +variable {C D : Type*} [Category* C] [Category* D] --- when the uniformization theorem and the accessibility of comma categories --- enters mathlib, the assumption can be changed attribute [local instance] IsFiltered.nonempty in lemma SolutionSetCondition.of_isCardinalAccessible - (κ : Cardinal.{w}) [Fact κ.IsRegular] - [∀ (Y : D), IsCardinalAccessibleCategory.{w} (StructuredArrow Y F) κ] : + [IsAccessibleCategory.{w} C] [IsAccessibleCategory.{w} D] + (F : C ⥤ D) [Functor.IsAccessible.{w} F] : SolutionSetCondition.{w} F := by intro Y + obtain ⟨κ, _, _⟩ := IsAccessibleCategory.exists_cardinal.{w} (StructuredArrow Y F) obtain ⟨ι, X₀, h⟩ := ObjectProperty.EssentiallySmall.exists_eq_isoClosure_ofObj.{w} (isCardinalPresentable (StructuredArrow Y F) κ) refine ⟨ι, fun i ↦ (X₀ i).right, fun i ↦ (X₀ i).hom,