Skip to content

Bimodule#478

Merged
JacquesCarette merged 15 commits intoagda:masterfrom
tillrampe:bimodule
Jul 3, 2025
Merged

Bimodule#478
JacquesCarette merged 15 commits intoagda:masterfrom
tillrampe:bimodule

Conversation

@tillrampe
Copy link
Contributor

This pull request defines bimodules between monads and bimodulehomomorphisms (cf. Shulman - Framed Bicategories and Monoidal Fibrations, Ch. 11). This is part of a larger project constructing a bicategory of monads and bimodules.

@@ -0,0 +1,99 @@
{-# OPTIONS --without-K --safe --lossy-unification #-}
Copy link
Collaborator

Choose a reason for hiding this comment

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

is --lossy-unification (still) crucial?

actionˡ : F ∘₁ T M₁ ⇒₂ F
actionʳ : T M₂ ∘₁ F ⇒₂ F

assoc : actionʳ ∘ᵥ (T M₂ ▷ actionˡ) ∘ᵥ associator.from ≈ actionˡ ∘ᵥ (actionʳ ◁ T M₁)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since you use Extras you might as well use Shorthands too.

actionʳ : T M₂ ∘₁ F ⇒₂ F

assoc : actionʳ ∘ᵥ (T M₂ ▷ actionˡ) ∘ᵥ associator.from ≈ actionˡ ∘ᵥ (actionʳ ◁ T M₁)
sym-assoc : actionˡ ∘ᵥ (actionʳ ◁ T M₁) ∘ᵥ associator.to ≈ actionʳ ∘ᵥ (T M₂ ▷ actionˡ)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since you use this version that is "definitionally symmetric", it might be useful to have a BimoduleHelper that lets users elide the items that are derivable.

where
open Monad M

record Bimodulehomomorphism {M₁ M₂ : Monad 𝒞} (B₁ B₂ : Bimodule M₁ M₂) : Set (ℓ ⊔ e) where
Copy link
Collaborator

Choose a reason for hiding this comment

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

I know that for smaller things, the objects and morphisms are all defined in the same file, but I think that for Bimodule, it would make sense to split this into Bimodule/Homomorphism.agda. It could also help make typechecking faster.

→ Bimodulehomomorphism B₂ B₃ → Bimodulehomomorphism B₁ B₂ → Bimodulehomomorphism B₁ B₃
bimodule-hom-∘ {M₁} {M₂} {B₁} {B₂} {B₃} g f = record
{ α = α g ∘ᵥ α f
; linearˡ = begin
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please move both of these proofs to the where clause. Having these inline will cause a lot of noise in downstream use, as Agda is too eager to eta-expand.

{ α = α g ∘ᵥ α f
; linearˡ = begin
actionˡ B₃ ∘ᵥ (α g ∘ᵥ α f) ◁ T M₁ ≈⟨ refl⟩∘⟨ ⟺ ∘ᵥ-distr-◁ ⟩
actionˡ B₃ ∘ᵥ (α g ◁ T M₁) ∘ᵥ (α f ◁ T M₁) ≈⟨ sym-assoc₂ ⟩
Copy link
Collaborator

Choose a reason for hiding this comment

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

for a future PR: this sure looks like bicategorical versions of push and pull. Should be abstracted out!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What is the recommended way to get push and pull into scope?

Copy link
Collaborator

Choose a reason for hiding this comment

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

import Categories.Morphism.Reasoning as MR
open MR C

where C is the 1-category of interest. Is the 'vertical' category clearly visible here?

My comment here is that there should be a Category.Bicategory.Reasoning that serves the same purpose. Right now, there is a bunch of stuff in Category.Bicategory.Extras that probably belongs in such a (new) module.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is a private module MR' defined in Category.Bicategory.Extras. Do you want this but public?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Something like that, yes.

@tillrampe
Copy link
Contributor Author

This is ready for re-review.

Copy link
Collaborator

@JacquesCarette JacquesCarette left a comment

Choose a reason for hiding this comment

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

Wonderful!

@JacquesCarette JacquesCarette merged commit e9f1d62 into agda:master Jul 3, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants