-
Notifications
You must be signed in to change notification settings - Fork 67
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
Add interchange for monoidal categories #276
Conversation
No problem about twinning these commits: they really are deeply related. I'll do a more formal review later - it was mostly very clean. There were just a couple of naming things that I'd like to tweak, beyond finding ways to make those large tedious proofs less so. [I see you use the |
|
||
swapInner-natural : ∀ {W₁ X₁ Y₁ Z₁ W₂ X₂ Y₂ Z₂} | ||
{f : W₁ ⇒ W₂} {g : X₁ ⇒ X₂} | ||
{h : Y₁ ⇒ Y₂} {i : Z₁ ⇒ Z₂} → |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it fair that all of them are implicit? also, we probably should use variable
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a good question. We don't seem to have a uniform convention in the library. In the definition of natural transformations we make the maps explicit arguments, but then in concrete naturality conditions, e.g. in the definition of monoidal categories, we don't:
agda-categories/src/Categories/Category/Monoidal/Core.agda
Lines 94 to 99 in 650f1bf
unitorˡ-commute-from : CommutativeSquare (C.id ⊗₁ f) λ⇒ λ⇒ f | |
unitorˡ-commute-to : CommutativeSquare f λ⇐ λ⇐ (C.id ⊗₁ f) | |
unitorʳ-commute-from : CommutativeSquare (f ⊗₁ C.id) ρ⇒ ρ⇒ f | |
unitorʳ-commute-to : CommutativeSquare f ρ⇐ ρ⇐ (f ⊗₁ C.id) | |
assoc-commute-from : CommutativeSquare ((f ⊗₁ g) ⊗₁ h) α⇒ α⇒ (f ⊗₁ (g ⊗₁ h)) | |
assoc-commute-to : CommutativeSquare (f ⊗₁ (g ⊗₁ h)) α⇐ α⇐ ((f ⊗₁ g) ⊗₁ h) |
There,
f
, g
, h
are all implicit (via generalized variables). I think the implicit version might be easier to use, but I don't know. In any case, I can try making them generalized variables if you think that helps.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the objects (and the maps) are completely arbitrary, variables work well. I don't always use variables if the maps need to have some endpoints in common, as that gets finicky if the inference mechanism doesn't figure it out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I updated the code to use generalized variables. Let me know if it looks OK, then I'll mark this as resolved.
I've pushed a commit where I address some of @JacquesCarette's comments. I'll fix up the history once I have addressed the other issues (rebasing these changes into the two original commits). |
I know it's not fully changed, but I like where it's all heading. |
I think I addressed the remaining comments, let me know nid it looks OK. |
Thanks, this looks good to go. |
In braided monoidal categories one can define an "interchange law" (or rather an interchange map) aka the "four middle interchange". This map is used in many constructions involving braided and symmetric monoidal categories and product constructions, e.g. when defining the product of two enriched categories, or when showing that tensor products can be lifted pointwise to monoidal functors. As one would expect, the interchange is a coherent iso and the hard work is not to define the interchange map itself, but to prove its coherence properties. That's what this PR does.
The PR contains some of the most tedious proofs I've ever had the misfortune to mechanize. None of the proofs are conceptually hard (or even interesting) they can all be proved in just a few steps using string diagrams. But unfortunately, we don't have support for string diagrams in the library (yet) so the only way I knew how to do it was by hand.
The resulting proofs are not pretty. Especially the one for
swapInner-assoc
is long and ugly. If anyone wants to have a go and try to clean it up, that'd be appreciated.The PR contains two commits. I would usually separate these into different PRs, but in this case, the second commit, which shows that the tensor product of a monoidal category with a coherent interchange is a monoidal functor, is used as a motivation for the choice of coherence laws for the interchange (and referred to in a comment in the module introducing them). So the two really go hand-in-hand. Still, if desired, I can split the PR.