Skip to content
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

refactor: generalize universes for colimits and limits in Type #7020

Closed
wants to merge 33 commits into from

Conversation

joelriou
Copy link
Collaborator

@joelriou joelriou commented Sep 7, 2023

In the category Type u and other concrete categories, there are limits and colimits indexed by categories J : Type v when [UnivLE.{v, u}]. As the universe for morphisms in J is irrelevant, there is no longer any assumption that J is a small category.


The definition of the standard colimit cocone in Type u now uses Shrink (see CategoryTheory.Limits.Types), which broke some constructions of colimits which relied a little too much on the definitional properties of this cocone. While fixing these constructions, some proofs have been cleaned up. Assumptions on universes have been generalized when appropriate.

The same should be done for the standard limit cone, but I would rather attempt at this in a separate PR...

Open in Gitpod

@joelriou joelriou added WIP Work in progress t-category-theory Category theory labels Sep 7, 2023
@joelriou joelriou changed the title feat: generalizing universes for colimits and limits in Type feat: generalize universes for colimits and limits in Type Sep 7, 2023
@joelriou joelriou added awaiting-CI and removed WIP Work in progress labels Sep 7, 2023
@joelriou joelriou added the awaiting-review The author would like community review of the PR label Sep 7, 2023
@jcommelin
Copy link
Member

How does this PR mesh with the planned refactor to use univLE? This file is still using TypeMax, although the diff in the PR doesn't seem to touch it really. I haven't thought through the question myself.

@joelriou
Copy link
Collaborator Author

joelriou commented Sep 8, 2023

My PR is orthogonal to the UnivLE refactor, which seems to be done already for limits of types in this file, but not for colimits, where the colimit cocone is constructed only in TypeMax.

Ideally, under [UnivLE.{v, u)] we should have limits and colimits in Type u indexed by categories J such that J : Type v and [Category.{w} J] for any w. Currently, there is the irrelevant assumption that w = v. My PR only removes any assumption on w, but maybe I should try to also adapt the construction of colimits under the assumption UnivLE.{v, u} rather than keeping only the TypeMax version.

@joelriou joelriou added awaiting-author A reviewer has asked the author a question or requested changes and removed awaiting-review The author would like community review of the PR labels Sep 8, 2023
@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. label Sep 12, 2023
@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. label Sep 13, 2023
@bors bors bot changed the base branch from master to ScottCarnahan/BinomialRing2 September 17, 2023 03:27
@semorrison semorrison changed the base branch from ScottCarnahan/BinomialRing2 to master September 17, 2023 12:05
@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. label Sep 21, 2023
@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. label Oct 5, 2023
@joelriou joelriou added the awaiting-review The author would like community review of the PR label Oct 6, 2023
@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added merge-conflict The PR has a merge conflict with master, and needs manual merging. and removed merge-conflict The PR has a merge conflict with master, and needs manual merging. labels Oct 16, 2023
@alreadydone
Copy link
Contributor

alreadydone commented Oct 24, 2023

There probably isn't much benefit to be garnered from this approach, so closing.

@alreadydone alreadydone reopened this Oct 24, 2023
@alreadydone
Copy link
Contributor

Sorry, I meant to close my own PR 😅

Copy link
Contributor

@alreadydone alreadydone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the generalizations made in this PR, but there are now merge conflicts. Also, I think many UnivLE.{v,u} can be replaced by Small.{u} J, and UnivLE is only really needed in HasLimits/HasLimitsOfSize instances, and Small is enough for HasLimitsOfShape. Do you think this is a good idea, and would you mind doing it?

Mathlib/Algebra/Category/Ring/FilteredColimits.lean Outdated Show resolved Hide resolved
Comment on lines -399 to -444
--porting note: @[simp] was removed because the linter said it was useless
theorem Colimit.ι_map_apply {F G : J ⥤ TypeMax.{v, u}} (α : F ⟶ G) (j : J) (x : F.obj j) :
colim.{v, v}.map α (colimit.ι F j x) = colimit.ι G j (α.app j x) :=
congr_fun (colimit.ι_map α j) x
#align category_theory.limits.types.colimit.ι_map_apply CategoryTheory.Limits.Types.Colimit.ι_map_apply

@[simp]
theorem Colimit.w_apply' {F : J ⥤ Type v} {j j' : J} {x : F.obj j} (f : j ⟶ j') :
colimit.ι F j' (F.map f x) = colimit.ι F j x :=
congr_fun (colimit.w F f) x
#align category_theory.limits.types.colimit.w_apply' CategoryTheory.Limits.Types.Colimit.w_apply'

@[simp]
theorem Colimit.ι_desc_apply' (F : J ⥤ Type v) (s : Cocone F) (j : J) (x : F.obj j) :
colimit.desc F s (colimit.ι F j x) = s.ι.app j x :=
congr_fun (colimit.ι_desc s j) x
#align category_theory.limits.types.colimit.ι_desc_apply' CategoryTheory.Limits.Types.Colimit.ι_desc_apply'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we change these to #noaligns, or we don't care?

variable [HasColimitsOfShape J TopCat.{v}]
variable [UnivLE.{u', v}]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change? I think it's now less general?

@joelriou joelriou added awaiting-author A reviewer has asked the author a question or requested changes and removed awaiting-review The author would like community review of the PR labels Oct 24, 2023
@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. label Oct 25, 2023
@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. label Oct 26, 2023
@joelriou joelriou closed this Nov 30, 2023
@joelriou
Copy link
Collaborator Author

I am closing this as @alreadydone may have found a better approach.

mathlib-bors bot pushed a commit that referenced this pull request Jan 6, 2024
Rescuing and porting my [old proof](https://leanprover.zulipchat.com/#narrow/stream/217875-Is-there-code-for-X.3F/topic/tensor.20products.20commute.20with.20direct.20limits/near/275178330) now that @dagurtomas created a file for it. Also includes some universe generalizations in the file Limits/Types which overlap with @joelriou's #7020.



Co-authored-by: Junyan Xu <junyanxu.math@gmail.com>
mathlib-bors bot pushed a commit that referenced this pull request Mar 12, 2024
This is a smaller version of #7020. Before this PR, for limits, we gave instances for small indexing categories, but for colimits, we gave instances for `TypeMax`. This PR changes so that we give instances for small indexing categories in both cases. This is more general and also more uniform.

Co-authored-by: Joël Riou <rioujoel@gmail.com>
kbuzzard pushed a commit that referenced this pull request Mar 12, 2024
This is a smaller version of #7020. Before this PR, for limits, we gave instances for small indexing categories, but for colimits, we gave instances for `TypeMax`. This PR changes so that we give instances for small indexing categories in both cases. This is more general and also more uniform.

Co-authored-by: Joël Riou <rioujoel@gmail.com>
dagurtomas pushed a commit that referenced this pull request Mar 22, 2024
This is a smaller version of #7020. Before this PR, for limits, we gave instances for small indexing categories, but for colimits, we gave instances for `TypeMax`. This PR changes so that we give instances for small indexing categories in both cases. This is more general and also more uniform.

Co-authored-by: Joël Riou <rioujoel@gmail.com>
utensil pushed a commit that referenced this pull request Mar 26, 2024
This is a smaller version of #7020. Before this PR, for limits, we gave instances for small indexing categories, but for colimits, we gave instances for `TypeMax`. This PR changes so that we give instances for small indexing categories in both cases. This is more general and also more uniform.

Co-authored-by: Joël Riou <rioujoel@gmail.com>
Louddy pushed a commit that referenced this pull request Apr 15, 2024
This is a smaller version of #7020. Before this PR, for limits, we gave instances for small indexing categories, but for colimits, we gave instances for `TypeMax`. This PR changes so that we give instances for small indexing categories in both cases. This is more general and also more uniform.

Co-authored-by: Joël Riou <rioujoel@gmail.com>
uniwuni pushed a commit that referenced this pull request Apr 19, 2024
This is a smaller version of #7020. Before this PR, for limits, we gave instances for small indexing categories, but for colimits, we gave instances for `TypeMax`. This PR changes so that we give instances for small indexing categories in both cases. This is more general and also more uniform.

Co-authored-by: Joël Riou <rioujoel@gmail.com>
callesonne pushed a commit that referenced this pull request Apr 22, 2024
This is a smaller version of #7020. Before this PR, for limits, we gave instances for small indexing categories, but for colimits, we gave instances for `TypeMax`. This PR changes so that we give instances for small indexing categories in both cases. This is more general and also more uniform.

Co-authored-by: Joël Riou <rioujoel@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-author A reviewer has asked the author a question or requested changes merge-conflict The PR has a merge conflict with master, and needs manual merging. t-category-theory Category theory
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants