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

[Merged by Bors] - feat: category equivalence between coalgebras and comonoid objects #11974

Closed
wants to merge 36 commits into from

Conversation

101damnations
Copy link
Collaborator

@101damnations 101damnations commented Apr 7, 2024

Given a commutative ring R, this PR defines the equivalence of categories between R-coalgebras and comonoid objects in the category of R-modules. We then use this to set up boilerplate for the monoidal structure on R-coalgebras defined in #11975 and #11976.


Possibly everything after the equivalence of categories should be in a separate PR, but here's its explanation.
We make the definition CoalgebraCat.instMonoidalCategoryAux in this PR, which is the monoidal structure on CoalgebraCat induced by the equivalence with Comon(R-Mod), and we prove lemmas about this declaration which are essentially true by definition. But our actual 1. Coalgebra instance on a tensor product of coalgebras and 2. MonoidalCategory instance on CoalgebraCat are constructed in #11975 and #11976 respectively. We construct the instances to have simple data - i.e. the underlying linear maps are more obviously stuff from LinearAlgebra.TensorProduct.Basic. But to fill in the Prop fields in those PRs, we use CoalgebraCat.instMonoidalCategoryAux and the API in the second half of this PR.

I really don't know how necessary this roundabout approach is; I was just pleased to have got it working. The idea was to use category theory to get non-category theory API for free-ish, without performance issues or the category theory leaking through.

Open in Gitpod

@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added the blocked-by-other-PR This PR depends on another PR to Mathlib (this label is automatically managed by a bot) label Apr 7, 2024
@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Apr 16, 2024
@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label May 27, 2024
@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label May 28, 2024
@101damnations 101damnations changed the title feat: category equivalence between coalgebras and monoid objects feat: category equivalence between coalgebras and comonoid objects May 29, 2024
@101damnations 101damnations added awaiting-review t-algebra Algebra (groups, rings, fields, etc) labels May 29, 2024
@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Jun 1, 2024
@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Jun 6, 2024
@101damnations 101damnations requested a review from kbuzzard June 7, 2024 13:51
Copy link
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!

2 minor comments. Otherwise, LGTM

bors d+

@@ -103,6 +103,12 @@ theorem braiding_inv_apply {M N : ModuleCat.{u} R} (m : M) (n : N) :
set_option linter.uppercaseLean3 false in
#align Module.monoidal_category.braiding_inv_apply ModuleCat.MonoidalCategory.braiding_inv_apply

@[simp]
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure if this should be a simp lemma by default. Because the RHS is quite a long expr.

Copy link
Member

Choose a reason for hiding this comment

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

With TensorProduct open, it's ↑(tensorTensorTensorComm R ↑A ↑B ↑C ↑D) : (↑A ⊗[R] ↑B) ⊗[R] ↑C ⊗[R] ↑D →ₗ[R] (↑A ⊗[R] ↑C) ⊗[R] ↑B ⊗[R] ↑D. I think that people like Eric like this kind of expression because ext fires very well on it. It looks simpler than the left hand side as well :-) However mathlib does build without the attribute so it's not being used yet...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thank you both for the reviews! I've removed the @[simp] on this lemma but added this

@[simp]
theorem tensor_μ_apply
    {A B C D : ModuleCat R} (x : A) (y : B) (z : C) (w : D) :
    tensor_μ _ (A, B) (C, D) ((x ⊗ₜ y) ⊗ₜ (z ⊗ₜ w)) = (x ⊗ₜ z) ⊗ₜ (y ⊗ₜ w) := rfl

as a simp lemma, more in line with other API for the monoidal structure on modules.

@mathlib-bors
Copy link
Contributor

mathlib-bors bot commented Jul 5, 2024

✌️ 101damnations can now approve this pull request. To approve and merge a pull request, simply reply with bors r+. More detailed instructions are available here.

Copy link
Member

@kbuzzard kbuzzard left a comment

Choose a reason for hiding this comment

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

Thanks!

@@ -101,7 +101,8 @@ def rightUnitor (M : ModuleCat.{u} R) : ModuleCat.of R (M ⊗[R] R) ≅ M :=
(LinearEquiv.toModuleIso (TensorProduct.rid R M) : of R (M ⊗ R) ≅ of R M).trans (ofSelfIso M)
#align Module.monoidal_category.right_unitor ModuleCat.MonoidalCategory.rightUnitor

instance : MonoidalCategoryStruct (ModuleCat.{u} R) where
@[simps (config := .lemmasOnly)]
instance instMonoidalCategoryStruct : MonoidalCategoryStruct (ModuleCat.{u} R) where
Copy link
Member

Choose a reason for hiding this comment

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

What's going on here, out of interest?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's like @[simps] except it doesn't tag the resulting lemmas with simp

@@ -103,6 +103,12 @@ theorem braiding_inv_apply {M N : ModuleCat.{u} R} (m : M) (n : N) :
set_option linter.uppercaseLean3 false in
#align Module.monoidal_category.braiding_inv_apply ModuleCat.MonoidalCategory.braiding_inv_apply

@[simp]
Copy link
Member

Choose a reason for hiding this comment

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

With TensorProduct open, it's ↑(tensorTensorTensorComm R ↑A ↑B ↑C ↑D) : (↑A ⊗[R] ↑B) ⊗[R] ↑C ⊗[R] ↑D →ₗ[R] (↑A ⊗[R] ↑C) ⊗[R] ↑B ⊗[R] ↑D. I think that people like Eric like this kind of expression because ext fires very well on it. It looks simpler than the left hand side as well :-) However mathlib does build without the attribute so it's not being used yet...

Copy link

github-actions bot commented Jul 8, 2024

PR summary 715478e721

Import changes for modified files

Dependency changes

File Base Count Head Count Change
Mathlib.RingTheory.Coalgebra.Basic 770 772 +2 (+0.26%)
Import changes for all files
Files Import difference
4 files Mathlib.RingTheory.Coalgebra.Basic Mathlib.RingTheory.Coalgebra.Hom Mathlib.Algebra.Category.CoalgebraCat.Basic Mathlib.RingTheory.Coalgebra.Equiv
2
Mathlib.Algebra.Category.CoalgebraCat.ComonEquivalence 913

Declarations diff

+ associator_hom_toLinearMap
+ comonEquivalence
+ comul_tensorObj
+ comul_tensorObj_tensorObj_left
+ comul_tensorObj_tensorObj_right
+ counit_tensorObj
+ counit_tensorObj_tensorObj_left
+ counit_tensorObj_tensorObj_right
+ instCoalgebraStruct
+ instMonoidalCategoryAux
+ instMonoidalCategoryStruct
+ leftUnitor_hom_toLinearMap
+ ofComon
+ ofComonObj
+ ofComonObjCoalgebraStruct
+ op_tensor_μ
+ rightUnitor_hom_toLinearMap
+ tensorHom_toLinearMap
+ tensorObj_comul
+ tensor_μ_apply
+ tensor_μ_eq_tensorTensorTensorComm
+ toComon
+ toComonObj
+ unop_tensor_μ
+ we
- instance : MonoidalCategoryStruct (ModuleCat.{u} R)

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>

@101damnations
Copy link
Collaborator Author

bors r+

mathlib-bors bot pushed a commit that referenced this pull request Jul 16, 2024
…11974)

Given a commutative ring `R`, this PR defines the equivalence of categories between `R`-coalgebras and comonoid objects in the category of `R`-modules. We then use this to set up boilerplate for the monoidal structure on `R`-coalgebras defined in #11975 and #11976.



Co-authored-by: Eric Wieser <[email protected]>
@mathlib-bors
Copy link
Contributor

mathlib-bors bot commented Jul 16, 2024

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title feat: category equivalence between coalgebras and comonoid objects [Merged by Bors] - feat: category equivalence between coalgebras and comonoid objects Jul 16, 2024
@mathlib-bors mathlib-bors bot closed this Jul 16, 2024
@mathlib-bors mathlib-bors bot deleted the coalgmonequiv branch July 16, 2024 20:02
@adomani adomani mentioned this pull request Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
delegated t-algebra Algebra (groups, rings, fields, etc)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants