-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat(CategoryTheory): presheaves of types which preserve a limit #32725
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
joelriou
wants to merge
6
commits into
leanprover-community:master
Choose a base branch
from
joelriou:cardinal-cocontinuous-3
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+190
−0
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2d683f0
fix
joelriou f20063e
Update Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/Presheaf…
joelriou ff223a2
Merge remote-tracking branch 'origin/master' into cardinal-cocontinuo…
joelriou 4b342af
Merge remote-tracking branch 'origin/master' into cardinal-cocontinuo…
joelriou 29f3ddd
abbrev
joelriou d666851
Merge remote-tracking branch 'origin/master' into cardinal-cocontinuo…
joelriou File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
152 changes: 152 additions & 0 deletions
152
Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/Presheaf.lean
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,152 @@ | ||
| /- | ||
| Copyright (c) 2025 Joël Riou. All rights reserved. | ||
| Released under Apache 2.0 license as described in the file LICENSE. | ||
| Authors: Joël Riou | ||
| -/ | ||
| module | ||
|
|
||
| public import Mathlib.CategoryTheory.ObjectProperty.FunctorCategory.PreservesLimits | ||
| public import Mathlib.CategoryTheory.ObjectProperty.Local | ||
| public import Mathlib.CategoryTheory.Limits.FunctorCategory.Basic | ||
| public import Mathlib.CategoryTheory.Limits.Types.Colimits | ||
| public import Mathlib.CategoryTheory.Limits.Types.Limits | ||
| public import Mathlib.CategoryTheory.ShrinkYoneda | ||
|
|
||
| /-! | ||
| # Presheaves of types which preserves a limit | ||
|
|
||
| Let `F : J ⥤ Cᵒᵖ` be a functor. We show that a presheaf `P : Cᵒᵖ ⥤ Type w` | ||
| preserves the limit of `F` iff `P` is a local object with respect to a suitable | ||
| family of morphisms in `Cᵒᵖ ⥤ Type w` (this family contains `1` or `0` morphism | ||
| depending on whether the limit of `F` exists or not). | ||
|
|
||
| -/ | ||
|
|
||
| @[expose] public section | ||
|
|
||
| universe w w' v v' u u' | ||
|
|
||
| namespace CategoryTheory | ||
|
|
||
| open Limits Opposite | ||
|
|
||
| namespace Presheaf | ||
|
|
||
| section | ||
|
|
||
| variable {C : Type u} [Category.{v} C] | ||
| {J : Type u'} [Category.{v'} J] [LocallySmall.{w} C] | ||
| {F : J ⥤ Cᵒᵖ} (c : Cone F) {c' : Cocone (F.leftOp ⋙ shrinkYoneda.{w})} | ||
| (hc : IsLimit c) (hc' : IsColimit c') (P : Cᵒᵖ ⥤ Type w) | ||
|
|
||
| set_option backward.isDefEq.respectTransparency false in | ||
| variable {P} in | ||
| /-- Let `F : J ⥤ Cᵒᵖ` be a functor, `c'` a colimit cocone for `F.leftOp ⋙ shrinkYoneda.{w}`. | ||
| For any `P : Cᵒᵖ ⥤ Type w`, this is the bijection between `c'.pt ⟶ P` and the type | ||
| of sections of `F ⋙ P`. -/ | ||
| @[simps -isSimp symm_apply apply_coe] | ||
| noncomputable def coconeCompShrinkYonedaHomEquiv : | ||
| (c'.pt ⟶ P) ≃ (F ⋙ P).sections where | ||
| toFun f := | ||
| { val j := shrinkYonedaEquiv (c'.ι.app (op j) ≫ f) | ||
| property {X X'} g := by | ||
| have h₁ := c'.w g.op | ||
| dsimp at h₁ ⊢ | ||
| rw [← h₁, Category.assoc] | ||
| conv_rhs => rw [shrinkYonedaEquiv_comp] | ||
| rw [shrinkYonedaEquiv_shrinkYoneda_map] | ||
| apply map_shrinkYonedaEquiv } | ||
| invFun s := hc'.desc (Cocone.mk _ | ||
| { app j := shrinkYonedaEquiv.symm (s.val j.unop) | ||
| naturality j₁ j₂ f := by | ||
| rw [← s.property f.unop] | ||
| dsimp | ||
| rw [shrinkYonedaEquiv_symm_map, Category.comp_id] }) | ||
| left_inv f := hc'.hom_ext (by simp) | ||
| right_inv u := by ext; simp | ||
|
|
||
| /-- Let `F : J ⥤ Cᵒᵖ` be a functor, `c'` a colimit cocone for `F.leftOp ⋙ shrinkYoneda.{w}`. | ||
| For any cone `c` for `F`, this is the canonical natural transformation | ||
| `c'.pt ⟶ shrinkYoneda.{w}.obj c.pt.unop`. -/ | ||
| noncomputable def coconePtToShrinkYoneda : | ||
| c'.pt ⟶ shrinkYoneda.{w}.obj c.pt.unop := | ||
| hc'.desc (shrinkYoneda.{w}.mapCocone (coconeLeftOpOfCone c)) | ||
|
|
||
| set_option backward.isDefEq.respectTransparency false in | ||
| variable {P} in | ||
| @[reassoc] | ||
| lemma coconePtToShrinkYoneda_comp (x : P.obj c.pt) : | ||
| coconePtToShrinkYoneda c hc' ≫ shrinkYonedaEquiv.symm x = | ||
| (coconeCompShrinkYonedaHomEquiv hc').symm | ||
| (Types.sectionOfCone (P.mapCone c) x) := by | ||
| refine hc'.hom_ext (fun j ↦ ?_) | ||
| dsimp [coconePtToShrinkYoneda, coconeCompShrinkYonedaHomEquiv_symm_apply] | ||
| rw [hc'.fac_assoc, hc'.fac] | ||
| exact (shrinkYonedaEquiv_symm_map _ _).symm | ||
|
|
||
| set_option backward.isDefEq.respectTransparency false in | ||
| lemma nonempty_isLimit_mapCone_iff : | ||
| Nonempty (IsLimit (P.mapCone c)) ↔ | ||
| (MorphismProperty.single (coconePtToShrinkYoneda c hc')).isLocal P := by | ||
| rw [Types.isLimit_iff_bijective_sectionOfCone, | ||
| MorphismProperty.isLocal_single_iff_bijective, | ||
| ← Function.Bijective.of_comp_iff' (coconeCompShrinkYonedaHomEquiv hc').symm.bijective, | ||
| ← Function.Bijective.of_comp_iff _ shrinkYonedaEquiv.bijective] | ||
| convert Iff.rfl using 2 | ||
| ext : 1 | ||
| simp [← coconePtToShrinkYoneda_comp] | ||
|
|
||
| variable {c} | ||
|
|
||
| include hc in | ||
| lemma preservesLimit_eq_isLocal_single : | ||
| ObjectProperty.preservesLimit F = | ||
| (MorphismProperty.single (coconePtToShrinkYoneda c hc')).isLocal := by | ||
| ext P | ||
| rw [← nonempty_isLimit_mapCone_iff c hc' P] | ||
| exact ⟨fun _ ↦ ⟨isLimitOfPreserves P hc⟩, | ||
| fun ⟨h⟩ ↦ preservesLimit_of_preserves_limit_cone hc h⟩ | ||
|
|
||
| variable (F) [Small.{w} J] | ||
|
|
||
| /-- Auxiliary definition for `Presheaf.preservesLimitHomFamily`. -/ | ||
| noncomputable abbrev preservesLimitHomFamilySrc := | ||
| colimit (F.leftOp ⋙ shrinkYoneda) | ||
|
|
||
| /-- Auxiliary definition for `Presheaf.preservesLimitHomFamily`. -/ | ||
| noncomputable abbrev preservesLimitHomFamilyTgt (h : PLift (HasLimit F)) := | ||
| letI := h.down | ||
| shrinkYoneda.obj (limit F).unop | ||
|
|
||
| /-- Let `F : J ⥤ Cᵒᵖ` be a functor. This is the family of morphisms | ||
| which consists of the single morphism | ||
| `colimit (F.leftOp ⋙ shrinkYoneda) ⟶ shrinkYoneda.obj (limit F).unop` | ||
| if `F` has a limit, or is the empty family otherwise. -/ | ||
| noncomputable abbrev preservesLimitHomFamily (h : PLift (HasLimit F)) : | ||
| preservesLimitHomFamilySrc F ⟶ preservesLimitHomFamilyTgt F h := | ||
| letI := h.down | ||
| coconePtToShrinkYoneda (limit.cone F) (colimit.isColimit _) | ||
|
joelriou marked this conversation as resolved.
|
||
|
|
||
| lemma preservesLimit_eq_isLocal : | ||
| ObjectProperty.preservesLimit F = | ||
| (MorphismProperty.ofHoms (preservesLimitHomFamily F)).isLocal := by | ||
| ext G | ||
| by_cases hF : HasLimit F | ||
| · rw [preservesLimit_eq_isLocal_single (limit.isLimit F) (colimit.isColimit _)] | ||
| convert Iff.rfl | ||
| ext _ _ f | ||
| exact ⟨fun ⟨_⟩ ↦ ⟨⟨⟩⟩, fun ⟨_⟩ ↦ ⟨⟨hF⟩⟩⟩ | ||
| · exact ⟨fun _ _ _ _ ⟨h⟩ ↦ (hF h.down).elim, | ||
| fun _ ↦ ⟨fun hc ↦ (hF ⟨_, hc⟩).elim⟩⟩ | ||
|
|
||
| lemma preservesLimitsOfShape_eq_isLocal : | ||
| ObjectProperty.preservesLimitsOfShape J = | ||
| (⨆ (F : J ⥤ Cᵒᵖ), MorphismProperty.ofHoms (preservesLimitHomFamily F)).isLocal := by | ||
| simp only [ObjectProperty.preservesLimitsOfShape_eq_iSup, | ||
| MorphismProperty.isLocal_iSup, preservesLimit_eq_isLocal] | ||
|
|
||
| end | ||
|
|
||
| end Presheaf | ||
|
|
||
| end CategoryTheory | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a few questions/suggestions for this one
CategoryTheory.Limits.Types.Yonedais a good target (because it contains the similar construction I link below).LocallySmall+shrinkYonedaversion of the existing CategoryTheory.Limits.compCoyonedaSectionsEquiv, so the docstring should at least reference this? (Though it is not the exact same construction).CategoryTheory.Limits.compCoyonedaSectionsEquiv, perhaps this should instead first be stated as an equivalence with natural transformations from the constant functor (droppingc'from the parameters) to a composition withshrinkYoneda, and then maybe for the result in this file you can work with composing this with an equivalence between morphisms out ofc'.ptand natural transformations out of a constant functor in that case?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion, but I do not see any relation with
compCoyonedaSectionsEquiv. AsIsColimitappears in all the definitions, I do not think it would make sense to break the coconec'into two variables.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, but can you still move that part (say up to l. 83) to the file
CategoryTheory.Limits.Types.Yoneda(or a new file underCategoryTheory/Limits/Typesif there are import increase issues)? It has pretty low discoverability withinObjectProperty/.