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: tensor products of coalgebras #11975

Closed
wants to merge 50 commits into from

Conversation

101damnations
Copy link
Collaborator

@101damnations 101damnations commented Apr 7, 2024

Given two R-coalgebras M, N, we can define a natural comultiplication map
Δ : M ⊗[R] N → (M ⊗[R] N) ⊗[R] (M ⊗[R] N) and counit map ε : M ⊗[R] N → R induced by the comultiplication and counit maps of M and N. These Δ, ε are declared as linear maps in TensorProduct.instCoalgebraStruct in Mathlib.RingTheory.Coalgebra.Basic.

In this PR we show that Δ, ε satisfy the axioms of a coalgebra, and also define other data in the monoidal structure on R-coalgebras, like the tensor product of two coalgebra morphisms as a coalgebra morphism.


We keep the linear maps underlying Δ, ε and other definitions in this PR syntactically equal to the corresponding definitions for tensor products of modules in the hope that this makes life easier. However, to fill in Prop fields, we use the API in #11974. That PR defines the monoidal category structure on coalgebras induced by an equivalence with comonoid objects in the category of modules, CoalgebraCat.instMonoidalCategoryAux, but we do not declare this as an instance - we just use it to prove things in this PR and #11976.

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

section

variable {R M N P Q : Type u} [CommRing R]
Copy link
Member

Choose a reason for hiding this comment

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

This is the big downside of doing everything via the categorical API; it forces universe monomorphism.

Copy link
Member

Choose a reason for hiding this comment

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

(I note that https://github.com/ImperialCollegeLondon/FLT/blob/main/FLT/for_mathlib/Coalgebra/TensorProduct.lean contains a more direct approach without going via category theory, which preserves universe polymorphism)

Copy link
Collaborator Author

@101damnations 101damnations May 11, 2024

Choose a reason for hiding this comment

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

Yeah that is a shame but I'd been hoping it's not too much of an issue in practice. I like the idea of getting non-category-theory library API using category theory (but only in proofs so for the most part you can't tell)... and I thought this was worth the drawback of universe monomorphism. But I'm aware of the other formalisation. Do you think it's more suited to mathlib?

Copy link
Member

Choose a reason for hiding this comment

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

I think the category-free version is more suited, yes. I'm glad to see you removed the "I'll close my PRs" section of your comment; the categorical API is still worth having, just not for the purpose of obtaining this instance.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Okay. yeah I guess I could just close this one and remove the second half of #11974 (or actually just replace that PR with the equivalence CoalgebraCat R ≌ Comon_ (ModuleCat R)). And base the others on the category-free instance when it exists.

Copy link
Contributor

Choose a reason for hiding this comment

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

After talking to Amelia, I am quite keen to merge this after the merge-conflict is resolved. We will, of course, when it is ready, provide the universe generalization enabled by doing this non-categorically, but this PR is blocking important work that Amelia is doing, and I don't want to block ongoing work for generalisations that aren't quite ready to merge.

Copy link
Member

Choose a reason for hiding this comment

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

I am quite keen to merge this after the merge-conflict is resolved.

note there is still a dependent PR

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There is, sorry about this - if it's indeed ok to proceed with these 2 PRs I'm going to refactor the dependent PR to use CoalgebraCat R ≌ Comon_ (ModuleCat R). I'm at a workshop so didn't finish that yet, but I have a free afternoon today.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Modulo CI I've hopefully finished refactoring this and #11974 to use comonoid objects instead of monoid objects. But fixing the second half of Mathlib.Algebra.Category.Coalgebra.ComonEquivalence gave me the impression the code is quite brittle. I'm sorry this situation is a bit of a mess - it could all have been avoided if I'd made a Zulip thread asking for advice about 2 months ago so I've learnt my lesson. If it ultimately doesn't get merged, or it gets merged and then gets entirely replaced, I won't be offended haha

@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-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 Sep 4, 2024
@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 Sep 4, 2024
@kim-em
Copy link
Contributor

kim-em commented Sep 9, 2024

bors d+

@mathlib-bors
Copy link
Contributor

mathlib-bors bot commented Sep 9, 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.

@101damnations
Copy link
Collaborator Author

bors r+

mathlib-bors bot pushed a commit that referenced this pull request Sep 10, 2024
Given two `R`-coalgebras `M, N`, we can define a natural comultiplication map 
`Δ : M ⊗[R] N → (M ⊗[R] N) ⊗[R] (M ⊗[R] N)` and counit map `ε : M ⊗[R] N → R` induced by the comultiplication and counit maps of `M` and `N`. These `Δ, ε` are declared as linear maps in `TensorProduct.instCoalgebraStruct` in `Mathlib.RingTheory.Coalgebra.Basic`.

In this PR we show that `Δ, ε` satisfy the axioms of a coalgebra, and also define other data in the monoidal structure on `R`-coalgebras, like the tensor product of two coalgebra morphisms as a coalgebra morphism.



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

mathlib-bors bot commented Sep 10, 2024

Build failed (retrying...):

mathlib-bors bot pushed a commit that referenced this pull request Sep 10, 2024
Given two `R`-coalgebras `M, N`, we can define a natural comultiplication map 
`Δ : M ⊗[R] N → (M ⊗[R] N) ⊗[R] (M ⊗[R] N)` and counit map `ε : M ⊗[R] N → R` induced by the comultiplication and counit maps of `M` and `N`. These `Δ, ε` are declared as linear maps in `TensorProduct.instCoalgebraStruct` in `Mathlib.RingTheory.Coalgebra.Basic`.

In this PR we show that `Δ, ε` satisfy the axioms of a coalgebra, and also define other data in the monoidal structure on `R`-coalgebras, like the tensor product of two coalgebra morphisms as a coalgebra morphism.



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

mathlib-bors bot commented Sep 10, 2024

Build failed:

@sgouezel
Copy link
Contributor

bors r+

@github-actions github-actions bot added the ready-to-merge This PR has been sent to bors. label Sep 10, 2024
mathlib-bors bot pushed a commit that referenced this pull request Sep 10, 2024
Given two `R`-coalgebras `M, N`, we can define a natural comultiplication map 
`Δ : M ⊗[R] N → (M ⊗[R] N) ⊗[R] (M ⊗[R] N)` and counit map `ε : M ⊗[R] N → R` induced by the comultiplication and counit maps of `M` and `N`. These `Δ, ε` are declared as linear maps in `TensorProduct.instCoalgebraStruct` in `Mathlib.RingTheory.Coalgebra.Basic`.

In this PR we show that `Δ, ε` satisfy the axioms of a coalgebra, and also define other data in the monoidal structure on `R`-coalgebras, like the tensor product of two coalgebra morphisms as a coalgebra morphism.



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

mathlib-bors bot commented Sep 10, 2024

Canceled.

@eric-wieser
Copy link
Member

bors merge

mathlib-bors bot pushed a commit that referenced this pull request Sep 10, 2024
Given two `R`-coalgebras `M, N`, we can define a natural comultiplication map 
`Δ : M ⊗[R] N → (M ⊗[R] N) ⊗[R] (M ⊗[R] N)` and counit map `ε : M ⊗[R] N → R` induced by the comultiplication and counit maps of `M` and `N`. These `Δ, ε` are declared as linear maps in `TensorProduct.instCoalgebraStruct` in `Mathlib.RingTheory.Coalgebra.Basic`.

In this PR we show that `Δ, ε` satisfy the axioms of a coalgebra, and also define other data in the monoidal structure on `R`-coalgebras, like the tensor product of two coalgebra morphisms as a coalgebra morphism.



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

mathlib-bors bot commented Sep 10, 2024

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title feat: tensor products of coalgebras [Merged by Bors] - feat: tensor products of coalgebras Sep 10, 2024
@mathlib-bors mathlib-bors bot closed this Sep 10, 2024
@mathlib-bors mathlib-bors bot deleted the coalgtensorproduct branch September 10, 2024 17:17
bjoernkjoshanssen pushed a commit that referenced this pull request Sep 11, 2024
Given two `R`-coalgebras `M, N`, we can define a natural comultiplication map 
`Δ : M ⊗[R] N → (M ⊗[R] N) ⊗[R] (M ⊗[R] N)` and counit map `ε : M ⊗[R] N → R` induced by the comultiplication and counit maps of `M` and `N`. These `Δ, ε` are declared as linear maps in `TensorProduct.instCoalgebraStruct` in `Mathlib.RingTheory.Coalgebra.Basic`.

In this PR we show that `Δ, ε` satisfy the axioms of a coalgebra, and also define other data in the monoidal structure on `R`-coalgebras, like the tensor product of two coalgebra morphisms as a coalgebra morphism.



Co-authored-by: Eric Wieser <[email protected]>
Co-authored-by: Amelia Livingston <[email protected]>
mathlib-bors bot pushed a commit that referenced this pull request Sep 14, 2024
Monoidal category structure on coalgebras, using the definitions in `Mathlib.RingTheory.Coalgebra.TensorProduct` added in #11975 



Co-authored-by: Eric Wieser <[email protected]>
Co-authored-by: Amelia Livingston <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
delegated 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.

8 participants