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'd like to understand how profunctors compose. (Mostly just for the sake of learning at this stage.) When I read about composition of profunctors I find it's defined in terms of coends, which in turn are defined through a universal property. I'm sure I'll understand that one day, but for now it’s too many abstractions to absorb at once, and I'm wondering if it's possible for someone to describe how profunctor composition works mechanically.
Specifically: I suppose I have a profunctor from C to D (or is it from D to C?) I can think of this as being a category containing all the objects and morphisms from C and D disjointly, together with additional "heteromorphisms" from objects of C to objects of D, which have to compose with the C-morphisms and the D-morphisms. (The definition of a profunctor as a functor from is analogous to the definition of a hom-functor, except that now it maps an object in C and an object in D to the set of heteromorphisms between them.)
If I have two profunctors, say from C to D and D to E, viewed as things that construct categories in this way, then I guess I could just make a new category containing all the morphisms from all three categories and both profunctors, but then I need to have a rule for how the first profunctor’s heteromorphisms compose with the second profunctor’s ones. The obvious choice is just to say that there are no equations - if I have and , then is just the formal composition , it's not equal to any other composition of heteromorphisms. Then I could just take all those formal compositions and form a new profunctor from C to E. Is that what the business with coends ends up achieving? Or is it something else?
That’s my guess at horizontal composition, but there is vertical composition as well. My guess is that if you take the above situation and you do start adding equations, then you get a new profunctor from C to E that looks kind of like a subset of the old one. Then vertical composition would be something like an inclusion relation, similar to vertical composition in Rel. Is this guess anywhere near correct?
Profunctor (horizontal) composition should be the usual composition of relations, one level up in the catification hierarchy.
That is, if you have a relation and a relation , you get a relation by defining
Now are akin to coends, is akin to the monoidal product of the enriching category (e.g. in ) and obviously profunctors are akin to relations. Voilà: let and , then you get by defining
(I switched the covariant and contravariant places in the profunctors just to stress the similarity with relations, ofc this is equivalent to the standard convention)
Regarding vertical composition, I'm not aware of this structure. There is an obvious 2-categorical structure on given by natural transformations, but those work as usual.
In some sense you can also think of a profunctor as a "generalised matrix". To do that you consider a -matrix valued in as a function . Then profunctor composition is similar to matrix multiplication :
I am not sure what you mean by vertical composition.
The previous answers fit together, since relations (between finite sets at least) compose like matrices over the boolean ring
I understood (maybe incorrectly?) that categories and profunctors form a 2-category in the same way that categories and functors form a 2-category. In the latter case, natural transformations are the vertical composition of functors, so there should be something analogous for profunctors. That is, if I have two profunctors from C to D, there should be some notion of morphism between them.
Anyway my question is just whether the definition in terms of coends works out to the same as the mechanical picture I sketched.
(My situation is analogous to that of someone who sort of vaguely understands the definition of a categorial product, and who has guessed that the product in Set might be given by the Cartesian product, but who isn't sure and needs a bit of a hint.)
Oh okay. In fact categories and profunctors form a bicategory (aka weak 2-category) since composition of profunctors is associative only up to isomorphism. Vertical composition of profunctors is also given by natural transformations.
Thanks, that's useful information.
I'm not sure if this makes any sense to anyone but me, but here's what a natural transformation looks like in the mental picture I'm trying to draw. I'm thinking of a profunctor as something like this. It's a category containing C and D as subcategories, together with morphisms from objects c, c' of C to objects d, d' of D. (There are also morphisms from c' to d and c to d', but I haven't drawn them.) image.png
To avoid clutter, let's draw the het-sets like this:
image.png The red arrow is a function which just represents the composition rule,
Then a natural transformation between two profunctors is just another set of functions, such that the red and blue arrows form a commuting square below.
image.png
Probably this is all just obvious to someone with more experience, but I find these kinds of pictures help me to get a better feel for the concepts, at least while they're still new.
So that covers vertical composition - great! - can we draw something similar for horizontal composition? (I think so, and I think I have a good idea what it is - the only stumbling block is not being sure about what the coend integral notation does in this picture.)
(with many thanks to my wife for letting me borrow her iPad and stylus. It was pretty intuitive and painless to draw and share those diagrams - maybe a nice tip for anyone who has access to one.)
@Nathaniel Virgo: I think a good intuition for the coend notation is existential quantification
so if you take profunctors and , their composite is defined as , which you can read as
and it's clear from the existential formulation that this corresponds to something that looks like composition
(the arrows are reversed compared to how they appear in the coend because of the variance)
(I see this is essentially what @Matteo Capucci says, scrolling back — I'm just using instead of )
If I have two profunctors, say from C to D and D to E, viewed as things that construct categories in this way, then I guess I could just make a new category containing all the morphisms from all three categories and both profunctors, but then I need to have a rule for how the first profunctor’s heteromorphisms compose with the second profunctor’s ones. The obvious choice is just to say that there are no equations - if I have and , then is just the formal composition , it's not equal to any other composition of heteromorphisms. Then I could just take all those formal compositions and form a new profunctor from C to E. Is that what the business with coends ends up achieving? Or is it something else?
You'll have equations corresponding to the category structure of . You want to quotient out the formal compositions by the equivalence relation generated by:
if , , , are "heteromorphisms", and is a morphism in such that and , then you equate the formal compositions and .
Nathanael Arkor said:
Nathaniel Virgo: I think a good intuition for the coend notation is existential quantification
so if you take profunctors and , their composite is defined as , which you can read as
This is useful but seems not to tell the whole story - tells me whether there exists a heteromorphism from to or not, but to go from relations to categories this should change from a Boolean value to a set. The place I'm stuck is in the details of how to make that transition.
Thomas Read said:
You'll have equations corresponding to the category structure of . You want to quotient out the formal compositions by the equivalence relation generated by:
if , , , are "heteromorphisms", and is a morphism in such that and , then you equate the formal compositions and .
This is the kind of mechanical explanation I was hoping for! Does have to be an isomorphism or is it really for any morphism? I will have to think a bit about why things have to be defined this way. (Any insight appreciated.)
to go from relations to categories this should change from a Boolean value to a set
instead of thinking of as true or false, you can think of it as quantifying all those elements for which it is true
Nathaniel Virgo said:
This is the kind of mechanical explanation I was hoping for! Does have to be an isomorphism or is it really for any morphism? I will have to think a bit about why things have to be defined this way. (Any insight appreciated.)
Any morphism
I imagine someone else can tell us about properties of the bicategory of profunctors that make it really convincing that this is the right definition.
Intuitively I guess you want to use all the data from , not just the objects or even just the isomorphisms.
One point is that hom functors are identities with respect to horizontal composition - if you defined horizontal composition differently you probably wouldn't be able to find an identity.
If you think of a profunctor as a functor - essentially by currying - then composition is given by composing with the left Kan extension along the Yoneda embedding :
temp.pdf
And the identity is the Yonead embedding.
Said like that it might seem obscure but when you look at the diagram it make a lot of sense.
You have two functors and and you want to get a functor .
To do that you need a to get a functor from . The "obvious" choice is the left Kan extension along the Yoneda lemma.
(Any insight appreciated.)
The elements of an adjacency matrix for a graph count the paths from one vertex to another. The elements of a profunctor are the sets of heteromorphisms from one object to another rather than just the number of them. To compose the adjacency matrices of two bipartite graphs, you multiply their adjacency matrices. To compose two profunctors, you do matrix multiplication, but where multiplication is all pairwise compositions and addition is union.
Great, this is pretty perfect. When we combine Mike Stay's argument above with Thomas Read's point about hom-functors being the identity, we get the complete picture. (Modulo me actually understanding coends properly and seeing why they yield this construction, but that's a task for later.)
The important point is that addition is union, but not disjoint union - some paths are considered equal to others. If we want to have this
(image drawn in Keynote because the iPad needs charging)
then it pretty much forces us to say that whenever we have a set of paths like this that commute
...
then we have to consider them equal to each other.
:grinning: those diagrams are great
I don't understand things here fully yet, but answering this question might help me: why do we use coends and not ends?
Also, is there an analogous notion of composition (or even a whole separate analogous definition of profunctors—coprofunctors? procofunctors?) that uses ends for composition instead? (I'm guessing there's also a chance products become coproducts to make things work out?) (Obviously we could just dualize everything in sight, but I'm wondering if there's a nontrivial version that just uses some of the dual concepts.)
This is suggested by the fact that we can define composition for relations in a couple different (nonstandard) ways.
(More generally, I wonder what characterizes the compositions that are categorifiable, if not all; and if there's a generic prescription for categorification of these definitions, about which we might hope to prove that it produces some sort of "coherence", instead of just being a heuristic analogy that we check works out in each case.)
tangent: one reason for me to be a little doubtful from the outset, though (before knowing what I'm doing—I'm just spitballing at this point) is that if the use coends is tied to the use of products, then there are a couple product structures "baked in" to the notion of a category that might determine it. For one, composition of ordinary arrows is a mapping from the product of hom's, and (more directly relevant here) hom is a bifunctor from the product of a category with its op, from which we analogize to conceptualize profunctors as yielding "heteromorphisms" as above. So, potentially, if it does lead down that rabbit hole...who's up for defining "cocategories" that either 1) involve a "cocomposition" (equivalently, "mposition", of course) that somehow use coproducts of homs instead of products, and/or 2) have a structure somehow given by a "cohom" functor involving the coproduct of a category with its op? :)
ends are like universal quantification, rather than existential quantification
This is suggested by the fact that we can define composition for relations in a couple different (nonstandard) ways.
can you suggest a definition of relational composition that uses universal quantification?
that if the use coends is tied to the use of products
if the product you're referring to is the one in the composition coend formula, this corresponds to the tensor product in the enriching category
also, cocategories are a thing: https://ncatlab.org/nlab/show/cocategory :)
More generally, I wonder what characterizes the compositions that are categorifiable, if not all
I think the general opinion (here at least) is that we would like most concepts to be categorifiable :)
but there isn't a general technique for doing it in most cases
there are some results along those lines, say for "linear algebraic theories" (https://arxiv.org/abs/1002.0879)
so, for instance, I could try just replacing existential quantification: .
Okay, I'm seeing now that that doesn't have identities! Swapping out the and for an or, or replacing the connective, say with an if or an iff, seems at first glance to produce similar problems.
This makes me suspect that the standard composition for Rel is actually quite special, and might be determined in some way by the very demand that we produce a "categorical" composition (associative, identities) on relations. Is that the case, somehow? Is the standard composition the only such elementary composition we could have on relations?
if the product you're referring to is the one in the composition coend formula, this corresponds to the tensor product in the enriching category
so, are coends specially tied to the tensor bifunctor in a way that ends aren't? (I know the bare definition for coends, but have no intuition on how they work, or—in particular—why a coend actually works here and an end doesn't, besides vague analogy. Maybe I just need to draw out the arrows and find out that they face similar problems as the decategorified case!)
I really support the feeling that the dualities of category theory should always be "completed" somehow. It seems like such a deep topic. Even though category theory has "duality baked in", what at first glance seems like just a -action on becomes a many-dimensional and many-layered notion...
One can say that "a category is a monad in the bicategory of spans", and then "op" arises from the fact that is compact closed; it has a duality involution given by swapping span legs. The "monad in spans" approach leads to the definition of cocategory, which is "a comonad in cospans". Then rather than "composing by pullback" you "cocompose by pushout". There are people that think about these things, and even a good exposition: http://www.math.jhu.edu/~tclingm1/store/cocategories.pdf.
When it comes to a very "high-level swap" (to me) like ends and coends here, it's almost enough to make you dizzy. The analogy with relations and quantification definitely brings it down to earth, so you can at least think about swapping for . But like you said, that doesn't seem to give an operation with a hope of being associative or unital. Any way, I'm sure there's some flexibility here to make alternative notions of composition.
One thing that's always been mysterious to me is the fact that you can think of profunctors both as generalized bimodules and as generalized linear maps.
There is a general notion of a "module of a monad", and in this "categories as monads" perspective, profunctors are exactly bimodules - and profunctor composition is "bimodule tensor" (coequalizing by the left/right actions of the middle category).
But as y'all have been saying, you can also think of profunctors as matrices - and composition is "matrix multiplication" (with some quotienting, as discussed).
These seem like opposing interpretations! How is this concept both a "vector space" and a "linear map" at the same time?
oo i missed this topic :eyes:
@Nathaniel Virgo honestly Set-valued coends seem to in general have a strong flavor of "making formal compositions associative", based on my limited experience
another really good example of a coend to chew on is day convolution, which lets you put a monoidal structure on the category of presheaves on a monoidal category
basically: say is a monoidal category. say we want to be able to take the tensor product of presheaves on , and we want it to agree with the existing one when the presheaves are representable. so: say we have presheaves —to define what should be, we need to ask, what do morphisms look like for representable ?
well: we can say that they factorize as 2 steps:
so we can define for as the set of formal compositions followed by —except this isn't quite right, we need to quotient a bit
and that's exactly a coend
(where the yoneda lemma has been used to minify a bit)
(this can alternatively be given as a profunctor composition or a kan extension, actually)
fun exercise: show that if is a discrete category, so that just forms a monoid, then if presheaves take only subsingleton values, meaning that they can be identified with subsets of , then in fact corresponds to
Christian Williams said:
These seem like opposing interpretations! How is this concept both a "vector space" and a "linear map" at the same time?
Bimodules can be understand as generalised maps. For example any ring homomorphism gives raise to a -bimodule on with left action multiplication by the image of and right action multiplication. This can be generalised to bimodule over a monoid (internal to some category) and then to enriched bimodules a.k.a. enriched profunctors by considering a monoid internal to as a -enriched category with one-object. In this setting it just states that any enriched functor gives a profunctor .
This is just to say that it is often better to think of bimodules as morphisms and not as objects.
I am not sure really familiar with "module of a monad" so I am not sure how it fits in this picture.
T Murrills said:
so, for instance, I could try just replacing existential quantification: .
Okay, I'm seeing now that that doesn't have identities! Swapping out the and for an or, or replacing the connective, say with an if or an iff, seems at first glance to produce similar problems.
This makes me suspect that the standard composition for Rel is actually quite special, and might be determined in some way by the very demand that we produce a "categorical" composition (associative, identities) on relations. Is that the case, somehow? Is the standard composition the only such elementary composition we could have on relations?
To define another structure of category on relations, you can modify the composition you have given to use a disjunction instead of a conjunction. This is an associative operation and it is unital with identities ). But this category is equivalent to the category of sets and relations with the usual composition (using existential quantifiers and conjunction). In fact, the equivalence is just negation, mapping a relation to its complement!
This also extends to a monoidal equivalence, taking the Cartesian product of sets as monoidal product for objects in both categories but using conjunction in one case and disjunction in the other, for morphisms.
Some have talked about how profunctors form a 2-category, or really a bicategory. I think the most natural categorical structure to describe them is a double category, which includes the strucure of functors and profunctors and the relationship between them is described by the structure of a proarrow equipment. I think the UCR seminar next week will go over double categories if you are interested to learn more.
ive been meaning to learn about double categories! ive heard they're cubical when ordinary bicategories are globular, or something to that effect
Yes something like that. The 2-cells are squares where the top and bottom squares come from the class of "horizontal" arrows and the left and right sides come from the "vertical" arrows. The nlab has a nice diagram. I find it makes the diagrams easier to draw :)
I'm way out of my depth at this point (which is fine, I'll catch up once I've levelled up enough), but I wonder if this double category thing has to do with something I noticed way up above after I drew this:
image.png
I drew the blue arrows to represent a natural transformation between the two profunctors, but in this profunctors-as-categories picture they can also be seen as a functor mapping the 'F' category to the 'G' category. If vertical morphisms between profunctors can be seen as functors then you can consider natural transformations between those functors, which adds another level to the category. I've no idea what that means practically, I just thought it was neat.
@Nathaniel Virgo I haven't seen any treatment of this, but it seems like you ought to be able to define a bicategory Prof(C, D) of profunctors, natural transformations, and modifications. Letting your two blue arrows be , note that as functors between the collages they preserve objects on the nose. A modification would be:
such that for all heteromorphisms f in F(c, d), the following square commutes:
α_(c,d)(f) c ----------------> d | | | Γ_c | Γ_d | | V V c ----------------> d β_(c,d)(f)
The nearest thing I can think of is Hoffnung's paper https://arxiv.org/abs/1112.0560, leaning on the similarity between spans of categories and profunctors.
By the way, it's worth noting that starting with any category with pullbacks you get an infinity-category of objects, spans, spans of spans, spans of spans of spans, ... just like that Viking song in Monty Python.
@John Baez But I'd expect Prof to be more similar to spans, maps of spans, and maps of maps of spans, where at some point the only things "between" two n-morphisms are equalities.
I guess maybe. But there could be a version that goes on forever too.
Sure. But I'd expect the thing analagous to spans of spans to be something like a "pronatural transformation", something that works out to be a profunctor between the collages.
I'd like to add a complementary point of view.
A leit-motive in introducing profunctors is considering them as a sort of -dimensional version of the set-theoretical notion of relation. Actually, a relation from to can be identified with its characteristic function . The dimensional shift then suggests to define a notion where the sets and are replaced by categories, and the set is replaced by the category of sets. Hence, a profunctor from to is identified with a functor , where is the opposite category of , which is necessary in order to deal with arrows of categories. Given these definitions, profunctor composition is the -dimensional version of relation composition, which has been discussed above.
Now, there is (at least) another relevant approach to the notion of profunctor, which I prefer because it is more suitable for dealing with internal structures. Let me explain it, by starting again from the easier case of relations.
The relation is in fact better known as a subset of the product , i.e. a subobject . Composing with product projections, one gets a span , where the two legs of the span are jointly monic. With this definition, the composition of with the another relation, say can be obtained by taking the composition of these two spans, and then shrinking the resulting big span. More precisely one takes the pullback of the cospan and compose projections with the other legs in order to get the new span . Unfortunately, this new span is not a relation, because its two legs ar not jointly monic, but this is not a big deal, since it suffices to take the image of the joint legs map , which is precisely the composition of relations .
Relations in can be considered as 'relative to a factorization system' namely, the image factorization. More precisely, given sets and , image factorization gives the local reflections .
It would be nice if something similar could be done for profunctors, and indeed it is so. The easier case is that of groupoids. Groupoids are categories where all arrows are iso, and a profunctor between groupoids is defined in the same way as for categories (but in the case of groupoids its definition can be simplified). In the category of groupoids there is a very nice factorization system that collapse three different factorization which are possible for functors between categories:
In fact it is possible to prove that profunctors between groupoids are precisely the relations relative to such factorization system. Therefore, one can calculate their composition by taking the pullback of the corresponding spans, and the taking the 'final' image of the resulting big span. All the details can be found in a recent paper of mine:
G. Metere, Distributors and the comprehensive factorization system for internal groupoids, Theory and Applications of Categories, Vol. 34 no. 1 (2019).
...where profunctors are called 'distributors', as they where named by Jean Benabou.
Concerning categories the situation is a bit more involved, since the three factorization systems above remain distinct. In fact it is still possible to compute the composition using a factorization system, but in this case one should interpret a profunctor from to as its corresponding -sided discrete fibration fibred over (or op-fibred over ), and then taking the initial image in or the final image in .
Ciao,
Beppe.