Skip to content

[Merged by Bors] - feat(Algebra/Category/Grp/Ulift): the universe lifting functor for commutative additive groups preserves colimits#20417

Closed
smorel394 wants to merge 41 commits intomasterfrom
SM.uliftPreservesColimits
Closed

[Merged by Bors] - feat(Algebra/Category/Grp/Ulift): the universe lifting functor for commutative additive groups preserves colimits#20417
smorel394 wants to merge 41 commits intomasterfrom
SM.uliftPreservesColimits

Conversation

@smorel394
Copy link
Copy Markdown
Collaborator

@smorel394 smorel394 commented Jan 3, 2025

Prove that the functor AddCommGrp.ulift preserves all colimits, hence creates small colimits. (This also finished the proof that it is an exact functor.)

Method: Suppose that we have a functor K : J ⥤ AddCommGrp.{u} (with J any category), a
colimit cocone c of K and a cocone lc of K ⋙ uliftFunctor.{u v}. We want to
construct a morphism of cocones uliftFunctor.mapCocone c → lc witnessing the fact
that uliftFunctor.mapCocone c is also a colimit cocone, but we have no direct way
to do this. The idea is to use that AddCommGrp.{max v u} has a small cogenerator,
which is just the additive (rational) circle ℚ / ℤ, so any abelian group of
any size can be recovered from its morphisms into ℚ / ℤ. More precisely, the functor
sending an abelian group A to its dual A →+ ℚ / ℤ is fully faithful, if we consider
the dual as a (right) module over the endomorphism ring of ℚ / ℤ. So an abelian
group C is totally determined by the restriction of the coyoneda
functor A ↦ (C →+ A) to the category of abelian groups at a smaller universe level.
We do not develop this totally here but do a direct construction. Every time we have
a morphism from lc.pt into ℚ / ℤ, or more generally into any small abelian group
A, we can construct a cocone of K ⋙ uliftFunctor by sticking ULift A at the
cocone point (this is CategoryTheory.Limits.Cocone.extensions), and this cocone is
actually made up of u-small abelian groups, hence gives a cocone of K. Using
the universal property of c, we get a morphism c.pt →+ A. So we have constructed
a map (lc.pt →+ A) → (c.pt →+ A), and it is easy to prove that it is compatible with
postcomposition of morphisms of small abelian groups. To actually get the
morphism c.pt →+ lc.pt, we apply this to the canonical embedding of lc.pt into
Π (_ : lc.pt →+ ℚ / ℤ), ℚ / ℤ (this group is not small but is a product of small
groups, so our construction extends). To show that the image of c.pt in this product
is contained in that of lc.pt, we use the compatibility with postcomposition and the
fact that we can detect elements of the image just by applying morphisms from
Π (_ : lc.pt →+ ℚ / ℤ), ℚ / ℤ to ℚ / ℤ.


Open in Gitpod

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 3, 2025

PR summary 1abc6e6424

Import changes exceeding 2%

% File
+82.71% Mathlib.Algebra.Category.Grp.Ulift

Import changes for modified files

Dependency changes

File Base Count Head Count Change
Mathlib.Algebra.Category.Grp.Ulift 827 1511 +684 (+82.71%)
Import changes for all files
Files Import difference
Mathlib.Algebra.Category.Grp.Ulift 684

Declarations diff

+ Quot.desc_quotQuotUliftAddEquiv
+ instance : CreatesColimitsOfSize.{w, u} uliftFunctor.{v, u}
+ instance : PreservesColimitsOfSize.{w', w} uliftFunctor.{v, u}
+ quotQuotUliftAddEquiv
+ quotToQuotUlift
+ quotToQuotUlift_ι
+ quotUliftToQuot
+ quotUliftToQuot_ι

You can run this locally as follows
## summary with just the declaration names:
./scripts/declarations_diff.sh <optional_commit>

## more verbose report:
./scripts/declarations_diff.sh long <optional_commit>

The doc-module for script/declarations_diff.sh contains some details about this script.


Increase in tech debt: (relative, absolute) = (3.00, 0.00)
Current number Change Type
1417 3 erw

Current commit 1abc6e6424
Reference commit 1b34e3c465

You can run this locally as

./scripts/technical-debt-metrics.sh pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

@mathlib4-dependent-issues-bot mathlib4-dependent-issues-bot added the blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) label Jan 3, 2025
@joelriou
Copy link
Copy Markdown
Contributor

joelriou commented Jan 3, 2025

This is a very nice result. In the case of colimits of types, with Markus Himmel, we had used a kind of similar argument, where ℚ/ℤ was replaced by the type with two elements Bool (see https://leanprover-community.github.io/mathlib4_docs/Mathlib/CategoryTheory/Limits/Types.html#CategoryTheory.Limits.Types.isColimit_iff_bijective_desc).

It would be great if you could refactor the file Algebra.Category.Grp.Colimits where the colimit of F : J ⥤ Ab is constructed, by generalizing the definition of ColimitType F to the case J : Type u, [Category.{v} J], and F : J ⥤ Ab.{w} (or whichever permutation of the universes names your prefer), and show there the basic result that if ColimitType F is w-small, then we have a colimit in Ab.{w}. Then, maybe in a separate file so as to reduce imports, you could obtain a statement like isColimit_iff_bijective_desc for abelian groups instead of types. For the reverse implication, if c : Cocone F is a colimit cocone, we have a canonical (heterogeneous universe) additive map desc : ColimitType F →+ c.pt, and by both universal properties, it induces a bijection after the application of the "functor" ? →+ A for any A : Ab.{w}, and by using A := ℚ/ℤ as you do, we get that desc is a bijection. It would follow a hasColimit_iff_small_colimitType lemma, and the preservation of colimits by uliftFunctor could be deduced. With this structure, I believe your result would integrate more with mathlib.

@smorel394
Copy link
Copy Markdown
Collaborator Author

This is a very nice result. In the case of colimits of types, with Markus Himmel, we had used a kind of similar argument, where ℚ/ℤ was replaced by the type with two elements Bool (see https://leanprover-community.github.io/mathlib4_docs/Mathlib/CategoryTheory/Limits/Types.html#CategoryTheory.Limits.Types.isColimit_iff_bijective_desc).

It would be great if you could refactor the file Algebra.Category.Grp.Colimits where the colimit of F : J ⥤ Ab is constructed, by generalizing the definition of ColimitType F to the case J : Type u, [Category.{v} J], and F : J ⥤ Ab.{w} (or whichever permutation of the universes names your prefer), and show there the basic result that if ColimitType F is w-small, then we have a colimit in Ab.{w}. Then, maybe in a separate file so as to reduce imports, you could obtain a statement like isColimit_iff_bijective_desc for abelian groups instead of types. For the reverse implication, if c : Cocone F is a colimit cocone, we have a canonical (heterogeneous universe) additive map desc : ColimitType F →+ c.pt, and by both universal properties, it induces a bijection after the application of the "functor" ? →+ A for any A : Ab.{w}, and by using A := ℚ/ℤ as you do, we get that desc is a bijection. It would follow a hasColimit_iff_small_colimitType lemma, and the preservation of colimits by uliftFunctor could be deduced. With this structure, I believe your result would integrate more with mathlib.

#20474 for the first step.

@smorel394
Copy link
Copy Markdown
Collaborator Author

Wouldn't it also make sense to rewrite CategoryTheory.Limits.Preserves.Ulift similarly? At the moment, it redoes the proof that Types.uliftFunctor preserves all colimits from scratch (of course, the strategy is the same, but it's slightly hidden because it uses subsets instead of maps into Bool) instead of applying isColimit_iff_bijective_desc, which would be much more straightforward and would avoid duplication of work.

@smorel394
Copy link
Copy Markdown
Collaborator Author

Wouldn't it also make sense to rewrite CategoryTheory.Limits.Preserves.Ulift similarly? At the moment, it redoes the proof that Types.uliftFunctor preserves all colimits from scratch (of course, the strategy is the same, but it's slightly hidden because it uses subsets instead of maps into Bool) instead of applying isColimit_iff_bijective_desc, which would be much more straightforward and would avoid duplication of work.

I did it as a warmup for groups: #20508

@smorel394
Copy link
Copy Markdown
Collaborator Author

#20512 does another necessary step, the fact that a morphism of abelian groups is bijective if and only the dual morphism between CharacterModules is bijective.

@smorel394
Copy link
Copy Markdown
Collaborator Author

#20522 (which depends on #20512 and the small #20416) proves isColimit_iff_bijective_desc and hasColimit_iff_small_quot (in a new file called BigColimits, for lack of a more imaginative name). After this the current PR becomes very easy (I can just follow the model of #20508).

@leanprover-community-bot-assistant leanprover-community-bot-assistant added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Jan 7, 2025
@mathlib4-dependent-issues-bot mathlib4-dependent-issues-bot removed the blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) label Jan 9, 2025
@leanprover-community-bot-assistant leanprover-community-bot-assistant removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Jan 9, 2025
@mathlib4-dependent-issues-bot mathlib4-dependent-issues-bot added the blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) label Jan 9, 2025
@smorel394
Copy link
Copy Markdown
Collaborator Author

And we're done! I updated the proof here to use the lemmas in Algebra.Category.Grp.LargeColimits.

@mathlib4-dependent-issues-bot mathlib4-dependent-issues-bot removed the blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) label Jan 20, 2025
Copy link
Copy Markdown
Member

@jcommelin jcommelin left a comment

Choose a reason for hiding this comment

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

Thanks 🎉

bors merge

@ghost ghost added the ready-to-merge This PR has been sent to bors. label Jan 22, 2025
mathlib-bors bot pushed a commit that referenced this pull request Jan 22, 2025
…mmutative additive groups preserves colimits (#20417)

Prove that the functor `AddCommGrp.ulift` preserves all colimits, hence creates small colimits. (This also finished the proof that it is an exact functor.)

Method: Suppose that we have a functor `K : J ⥤ AddCommGrp.{u}` (with `J` any category), a
colimit cocone `c` of `K` and a cocone `lc` of `K ⋙ uliftFunctor.{u v}`. We want to
construct a morphism of cocones `uliftFunctor.mapCocone c → lc` witnessing the fact
that `uliftFunctor.mapCocone c` is also a colimit cocone, but we have no direct way
to do this. The idea is to use that `AddCommGrp.{max v u}` has a small cogenerator,
which is just the additive (rational) circle `ℚ / ℤ`, so any abelian group of
any size can be recovered from its morphisms into `ℚ / ℤ`. More precisely, the functor
sending an abelian group `A` to its dual `A →+ ℚ / ℤ` is fully faithful, *if* we consider
the dual as a (right) module over the endomorphism ring of `ℚ / ℤ`. So an abelian
group `C` is totally determined by the restriction of the coyoneda
functor `A ↦ (C →+ A)` to the category of abelian groups at a smaller universe level.
We do not develop this totally here but do a direct construction. Every time we have
a morphism from `lc.pt` into `ℚ / ℤ`, or more generally into any small abelian group
`A`, we can construct a cocone of `K ⋙ uliftFunctor` by sticking `ULift A` at the
cocone point (this is `CategoryTheory.Limits.Cocone.extensions`), and this cocone is
actually made up of `u`-small abelian groups, hence gives a cocone of `K`. Using
the universal property of `c`, we get a morphism `c.pt →+ A`. So we have constructed
a map `(lc.pt →+ A) → (c.pt →+ A)`, and it is easy to prove that it is compatible with
postcomposition of morphisms of small abelian groups. To actually get the
morphism `c.pt →+ lc.pt`, we apply this to the canonical embedding of `lc.pt` into
`Π (_ : lc.pt →+ ℚ / ℤ), ℚ / ℤ` (this group is not small but is a product of small
groups, so our construction extends). To show that the image of `c.pt` in this product
is contained in that of `lc.pt`, we use the compatibility with postcomposition and the
fact that we can detect elements of the image just by applying morphisms from
`Π (_ : lc.pt →+ ℚ / ℤ), ℚ / ℤ` to `ℚ / ℤ`.

- [x] depends on: #20416
- [x] depends on: #20512
- [x] depends on: #20522
@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Jan 22, 2025

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title feat(Algebra/Category/Grp/Ulift): the universe lifting functor for commutative additive groups preserves colimits [Merged by Bors] - feat(Algebra/Category/Grp/Ulift): the universe lifting functor for commutative additive groups preserves colimits Jan 22, 2025
@mathlib-bors mathlib-bors bot closed this Jan 22, 2025
@mathlib-bors mathlib-bors bot deleted the SM.uliftPreservesColimits branch January 22, 2025 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

large-import Automatically added label for PRs with a significant increase in transitive imports ready-to-merge This PR has been sent to bors. t-category-theory Category theory

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants