You're reading the public-facing archive of the Category Theory Zulip server.
To join the server you need an invite. Anybody can get an invite by contacting Matteo Capucci at name dot surname at gmail dot com.
For all things related to this archive refer to the same person.
I'm trying to get my head around ends and coends. I like to learn from examples, which are weirdly hard to find for this topic, but I did find one in CWM (on p. 226):
This makes a vague sort of qualitative sense to me. I don't know anything about modules, but I guess I can just replace "ring" with "field" and "module" with "vector space" and everything will be the same (except I guess the won't matter any more, because a field in this context is a commutative monoid with an extra operation defined on it, and commutative monoids are their own opposites).
However, I'm a bit confused. It makes sense to me that a module (or a vector space) is a functor from to in the sense described. But surely the tensor product of two vector spaces ought to be another vector space, which means I'd expect it also to be a functor from to . The coend "integrates out" the dependence on , so it doesn't give a functor from to but only an Abelian group. This makes it hard for me to see how the object can be the tensor product of and .
Can anyone figure out what my confusion is and help me resolve it?
Nathaniel Virgo said:
However, I'm a bit confused. It makes sense to me that a module (or a vector space) is a functor from to in the sense described. But surely the tensor product of two vector spaces ought to be another vector space, which means I'd expect it also to be a functor from to .
This is almost true. The tensor product of two -modules is not, in general, an -module! This is because the tensor kills the right module structure of the first module and the left module structure of the second module, because you want bilinearity.
In symbols: if is a -bimodule (i.e., a left -module and a right -module) and is a -bimodule, then you can form their -tensor product which has the structure of a -bimodule (notice the -module structure was killed).
If is commutative though, every left -module is also a right -module (because ), and thus carries the structure of a -bimodule. This means that the category of -modules is monoidal with respect to .
Back to the true question: why is (also this notation is extremely confusing: the I just wrote is the single, dummy object of the one-object category ) a functor ? Well, because is an -bimodule! :laughing:
In practical terms, there's an action of both on the left and the right.
If you look at the cowedge diagram, you see what it means: if you choose an element , you can use it to multiply an element on the left or on the right
Matteo Capucci said:
If you look at the cowedge diagram, you see what it means: if you choose an element , you can use it to multiply an element on the left or on the right
Yes, this is also the intuition behind opitcs as coends btw. You are taking pairs of morphisms . Now you want to depict these as a comb, so you want to interpret as ``connected'' with . But what does this mean in practice? It means, string diagrammatically, that if are connected by a wire you can put another morphism on that wire and you can slide it freely towards or towards . This means that you want to identify pairs and for whatever for which these compositions make sense and typecheck, and this is precisely what the coend does for you
(I don't know if this explanation makes things more clear or more confused, if it's the former I'm sorry D: )
Now you want this two actions to be the same, i.e. you want to homogeneize with respect to the actions of . This means imposing (+ linearity), which is what gives you the -tensor of and .
That's what the coend says. Maybe a more explicit notation would have been:
Fabrizio Genovese said:
Matteo Capucci said:
If you look at the cowedge diagram, you see what it means: if you choose an element , you can use it to multiply an element on the left or on the right
Yes, this is also the intuition behind opitcs as coends btw. You are taking pairs of morphisms . Now you want to depict these as a comb, so you want to interpret as ``connected'' with . But what does this mean in practice? It means, string diagrammatically, that if are connected by a wire you can put another morphism on that wire and you can slide it freely towards or towards . This means that you want to identify pairs and for whatever for which these compositions make sense and typecheck, and this is precisely what the coend does for you
Indeed, the structure involved is the same: a left -module is just an object with a monoidal action from !
Fabrizio Genovese said:
Yes, this is also the intuition behind opitcs as coends btw. You are taking pairs of morphisms . Now you want to depict these as a comb, so you want to interpret as ``connected'' with . But what does this mean in practice? It means, string diagrammatically, that if are connected by a wire you can put another morphism on that wire and you can slide it freely towards or towards . This means that you want to identify pairs and for whatever for which these compositions make sense and typecheck, and this is precisely what the coend does for you
This is exactly what I'm really trying to understand - I sort of get this, but I'm trying to really get a hold of the formal details. (Just on the off chance: do you know of anywhere where coends are introduced with this kind of application in mind?)
@Matteo Capucci thank you so much for this explanation, it's really helpful.
So to summarise, I should think of vector spaces not as -modules but as -bimodules. Then the coend is doing this sort of thing, to leave me with another -bimodule in the end. This makes sense to me.
(Don't ask me to say formally what this diagram is yet though.)
Yes, in a sense. The point is, when R is commutative every module is a bimodule. Just keep in mind this!
In the coend definition of profunctor optics, you have something more close to (R, S)-bimodules, that is, in general the left action is not the same as the right action, and might even come from a different ring
Not every -bimodule is an -module in the commutative sense though, just the ones for which the left and right actions agree, i.e.,
This property is preserved by this tensor product of bimodules operation.
Nathaniel Virgo said:
Fabrizio Genovese said:
Yes, this is also the intuition behind opitcs as coends btw. You are taking pairs of morphisms . Now you want to depict these as a comb, so you want to interpret as ``connected'' with . But what does this mean in practice? It means, string diagrammatically, that if are connected by a wire you can put another morphism on that wire and you can slide it freely towards or towards . This means that you want to identify pairs and for whatever for which these compositions make sense and typecheck, and this is precisely what the coend does for you
This is exactly what I'm really trying to understand - I sort of get this, but I'm trying to really get a hold of the formal details. (Just on the off chance: do you know of anywhere where coends are introduced with this kind of application in mind?)
"Profunctor optics a categorical update" has this coend flavor imho
Indeed, it does!
Anyway, see it like this: Think graphically. An optic is a comb, ok? Now you want a way to "formalize" this comb. You start noticing that if you cut the comb in half, you get two morphisms. So you may think "neat, I'll formalize the comb as a pair of morphisms". And then you have the problem I highlighted above: If you have a box living on one of the wires you split, on which side of the pair do you put it?
The coend formalization says "it doesn't matter, because we identify the pairs that can be transformed one into the other by sliding such a box."
This is probably the handwaviewst explanation of what's going on, but also the one that makes intuitively more sense in my opinion. Anyway @fosco is here and he's one of the authors of said paper, so... :smile:
The oldest paper where coend optics is written down is probably Riley's "categories of optics", but it was apparently functional programming folklore for a long time before that
I could say something on optics, but I'd rather comment on the original question posed by OP; I'll do it as soon as possible!
Nathaniel Virgo said:
Matteo Capucci thank you so much for this explanation, it's really helpful.
So to summarise, I should think of vector spaces not as -modules but as -bimodules. Then the coend is doing this sort of thing, to leave me with another -bimodule in the end. This makes sense to me.
Digressing somewhat: a good physicist named Stephen Adler wrote a book Quaternionic Quantum Mechanics and Quantum Fields, where he tried to do quantum physics using "quaternionic Hilbert spaces", which are left modules over the quaternions. He got into a big mess when he tried to tensor these, as you must when combining quantum systems. He should have used bimodules!
You can do quantum mechanics using modules over the division algebras , or , but since the quaternions are noncommutative, if you want to tensor these modules you should probably use bimodules, and then you might as well think about things like -bimodules where one division algebra acts on the left and the other acts on the right. I haven't gotten around to studying this very much yet, despite being a bit obsessed with division algebras in quantum mechanics.
Does that mean that when you combine quantum systems in this setting, the order matters?
Thinking more on the points about modules and vector spaces: does this mean there's a general theory that can be developed about ends and coends in the case where the source category is a commutative monoid? It seems like the story Matteo Capucci told only really depends on that.
So can we say that if is a commutative monoid (seen as a single-object category) and is a monoidal category, then can we generalise "every vector space is really a bimodule" to "any functor is really a functor "? Then I guess we can then define a tensor product of such functors (if it exists) by a coend, which I guess would be written
If that does work, what's the sense in which a functor is "really" a functor ? (How do we formally construct one from the other?) And does this coend construction reduce to something simpler in this case? Sorry if this is a silly question.
Nathaniel Virgo said:
I believe this should be
Matteo Capucci said:
I now realized this is very bad notation, and quite wrong, since is a morphism
Nathaniel Virgo said:
So can we say that if is a commutative monoid (seen as a single-object category) and is a monoidal category, then can we generalise "every vector space is really a bimodule" to "any functor is really a functor "?
I believe the answer to be yes, let's check. For clarity, let me call the monoid and its delooping, i.e. the one-object (the object is ) category whose only hom-set is .
A functor is the choice of an object of and an homomorphism of monoids .
We can denote the action of on as , so we say is a left action.
Now, since is commutative, , we see that is also a right action, that is, a functor picking again as the object but acting now on on the right, i.e. we write for the endomorphism induced by .
Suppose now that is monoidal. Then given , we can tensor it by putting together their target object using 's monoidal product, and then having one acting on the left and one on the right.
More precisely, we get an action of embodied by a functor . Notice that . The functor acts on objects by sending to , and on morphisms by sending to .
A bit of terminology: with an action of is called a left -module in . In other words, left -modules in are functors . Unsurprisingly, they form a category, that we could denote by . Morphisms are natural transformations. In the same vein, we get a category of right -modules in . A -bimodule in is just a left and right -module, i.e. an object of equipped with a left and right action of , i.e. a functor .
Notice that , that is, left -modules are the same thing as right -modules. Therefore, when is commutative, right and left modules are the same thing!
The last step is probably to show that you need the coend to define a functorial monoidal product in the category of bimodules, since their product otherwise ignores the actions 'in the middle', which then you need to quotient out.