Comagnitude 2
Posted by Tom Leinster
Previously: Part 1
Last time, I talked about the magnitude of a set-valued functor. Today, I’ll introduce the comagnitude of a set-valued functor.
I don’t know how much there is to the comagnitude idea. Let’s see! I’ll tell you all the interesting things I know about it.
Along the way, I’ll also ask an elementary question about group actions that I hope someone knows how to answer.
Recap
First, a quick recap of last time. A weighting on a finite category is a function such that
for all . This is a system of linear equations with as many equations as unknowns, so there’s usually a unique weighting on . The magnitude of a functor is defined to be
This is equal to the cardinality of the colimit of when is a coproduct of representables. Examples of this equality include the inclusion-exclusion principle and the simple formula for the number of orbits of a free action of a group on a finite set. But even when isn’t a coproduct of representables, means something, and I gave a few examples involving entropy.
There’s also a definition of the magnitude (or Euler characteristic) of a finite category : it’s the total weight
This is equal to the magnitude of the constant functor that sends everything to the one-element set.
But in the other direction, the definition of the magnitude of a set-valued functor can also be seen as a special case of the definition of the magnitude of a category: is equal to the magnitude of , the category of elements of . In a comment on the last post, Mike Shulman pointed to work of his and Kate Ponto’s showing that it’s also equal to the Euler characteristic of the homotopy colimit of , under some fairly mild additional hypotheses on .
Aside The two results in the last paragraph are easily deduced from each other, up to some small changes in the hypotheses on . This isn’t entirely surprising, as is the colax colimit of (where I’ve changed the codomain of from to by viewing sets as discrete categories). In any case, Thomason proved that the nerve of is homotopy equivalent to , so in particular, they have the same Euler characteristic. But the Euler characteristic of the nerve of a category is its magnitude (under hypotheses), so
Thus, if we know that one side of this equation is equal to , then so is the other. A few more details of this argument are in my comment here.
But there’s a but! Whereas magnitude can be defined for categories as well as set-valued functors, it will turn out that comagnitude can’t be, as far as I can see. We’ll get to this later.
The cardinality of a limit
Let’s play a dual game to the one we played last time: given a finite category and a functor , can we find a formula for the cardinality of the limit of , in terms of and the cardinalities of the sets () only?
Of course, we can’t in general: depends on what does to the maps in as well as the objects. But there are significant cases where we can:
Examples
If is the two-object discrete category then a functor is a pair of finite sets, and
What about pullbacks? Take finite sets and functions
Suppose is uniform, meaning that all its fibres are isomorphic: for all . This is equivalent to the condition that is a product projection , a condition I talked about here, using the word “projection” instead of “uniform”. Using the uniformity of , it’s a little exercise to show that the pullback of our diagram has cardinality
In a similar way, we can show that the equalizer of a pair of functions has cardinality if the function is uniform.
You can think of this condition as saying that given an element chosen uniformly at random, all pairs are equally likely. In particular, the probability that lies on the diagonal of is
Since an element is in the equalizer if and only if lies on the diagonal, we’d expect the equalizer to have cardinality , and it does. I’ll come back to this probabilistic idea later, rigorously.
Now let’s consider cofree actions of a group on a set. By definition, the cofree -set generated by a set is the set of -indexed families of elements of (or functions if you prefer), with action
The fixed points of this -set are the constant families , for . So, if we’re given just the -set and not told what is, we can reconstruct anyway: it’s the set of fixed points. In particular, when everything is finite, is the cardinality of the -set to the power of (writing for order).
Now, when a -set is regarded as a functor , the set of fixed points is the limit of the functor. So for a functor corresponding to a cofree action of a group on a finite set ,
Let me digress briefly to ask an elementary question:
Question How do you recognize a cofree group action?
What I mean is this. Define a -set to be free if it’s isomorphic to (with its usual action) for some set . It’s a useful little theorem that a -set is free if and only if:
for all , if for some then .
Is there an analogous result for cofree actions?
As I mentioned above, if you’ve got a cofree -set and you want to find the set such that , it’s easy: is the set of fixed points. But I can’t get any further than that, or obtain any non-tautological necessary and sufficient condition for a -set to be cofree.
Back to the cardinality of limits! In all the examples above, for functors satisfying certain conditions, we had
for some rational numbers () depending only on , not . If you read Part 1, you might be able to guess both what these numbers are and what condition on guarantees that this equation holds. So I’ll just jump to the answer and state the definitions that make it all work.
Here goes. A coweighting on is a weighting on , or explicitly, a function such that
for all . As for weightings, I’ll assume throughout that has exactly one coweighting, which is generically true.
As I explained in a previous post, the forgetful functor
has both a left adjoint and a right adjoint . A functor is in the image of if and only if it’s a coproduct of representables; these were the functors that made the formula for the cardinality of a colimit work. I’ll say a functor is cofree if it’s in the image of . These are the ones that make the formula for the magnitude of a limit work:
Theorem Let be a finite category and a cofree functor. Then
What do the cofree functors actually look like? I don’t know a really easily testable condition — and that’s why I asked the question above about cofree actions by a group. But they’re not the products of representables. In fact, given a family of sets
the cofree functor is given by
You can see from this formula how is functorial in . (The right-hand side is doubly contravariant in , which means it’s covariant.) In examples, the functions
arising from maps in have a strong tendency to be uniform, in the sense I defined in the pullback example above. In fact, as I mentioned in a previous post, is always uniform if is epic, and in the kinds of category that we often take limits over, the maps often are epic.
Examples
When is a two-object discrete category, so that limits over are binary products, every functor is cofree, the coweights of the objects of are both , and the theorem gives the usual formula for the cardinality of a product of two finite sets.
For pullbacks, we’re taking to be , whose coweighting is . A functor is a diagram of finite sets, and it’s cofree if and only if both these functions are uniform. In that case, the theorem gives us the formula we saw before for the cardinality of a pullback: it’s
Similarly, a functor from to consists of finite sets and functions , it’s cofree if and only if is uniform, and the theorem tells us that the equalizer has cardinality
Finally, when is the one-object category corresponding to a group , the single coweight is , a functor is a finite -set , and the theorem tells us that if the action is cofree then the number of fixed points is
(where means the cardinality of the underlying set of ).
Comagnitude: definition and examples
Given an arbitrary functor , not necessarily cofree, it’s typically not true that
But we can still think about the right-hand side! So I’ll define the comagnitude of by
(The notation isn’t great, and isn’t intended to suggest a norm. I just wanted something that looked similar to but different from . Suggestions are welcome.)
Examples
If is cofree then .
For a diagram of finite sets, seen as a set-valued functor in the usual way,
Similarly, for a diagram of finite sets,
For a finite set equipped with an action of a finite monoid , the comagnitude of the corresponding functor is given by
Let be any finite category and any finite set. The constant functor with value has comagnitude
Now it’s a tiny lemma that the total coweight of a category is equal to the total weight (try it!), which by definition is the magnitude of . So
For the next example, I have in my head an imaginary dialogue.
Me: Find me a formula for the cardinality of the limit of a functor , but one that only depends on and the sets .
You: That’s impossible! There are loads of examples of functors such that for all , but .
Me: Try anyway.
You: Well, okay. If the only information I’m allowed to use is which set each object of gets sent to, and I’m supposed to calculate the cardinality of the limit, then the best I can do is to consider all functors that do the prescribed thing on the objects of , calculate the cardinality of the limit of each one, and take the average.
This suggests an idea: could the comagnitude of a functor be the expected value of for a random functor satisfying ?
Sadly not, in general (regardless of what probability distribution you use). Bu there’s a significant case where the answer is yes: you can characterize comagnitude in terms of random functors:
Example Let be a quiver (directed multigraph). We can form the free category on , whose objects are the vertices of and whose maps are the directed paths of edges in . Assuming that is finite and acyclic, the category is finite too.
It’s a theorem that for a functor , the comagnitude is the expected value of for a functor chosen uniformly at random subject to the condition that for all .
This covers cases such as products, pullbacks and equalizers: all those categories are free on a quiver.
(Incidentally, the cofree functors on have a simple explicit description, which I gave here. For those, the cardinality of the limit is equal to the expected value: it’s “what you’d expect”.)
(Co)magnitude of functors vs. (co)magnitude of categories
I mentioned earlier that the constant functor has comagnitude , for any finite set . In this sense, the definition of the magnitude of a category is a special case of the definition of the comagnitude of a set-valued functor (sort of; maybe “special case” is slightly overstating it). With the situation for magnitude in mind, you might wonder whether, in the other direction, the definition of the comagnitude of a set-valued functor is a special case of the definition of the magnitude of a category, or of some notion of the “comagnitude of a category”.
Not as far as I can see. For a start, two set-valued functors can have the same category of elements but different comagnitudes; so for a functor , there’s no way we’re going to be able to extract the comagnitude of from its category of elements. Now the category of elements is a colax colimit, so you might think of using the lax limit instead. Or you might remember the result of Ponto and Shulman that the magnitude of is the Euler characteristic of its homotopy colimit (under hypotheses on ), and hope for some dual result involving homotopy limits instead.
But I don’t think any of that works. For a start, if we view as a functor taking values in discrete categories, then its lax limit is simply the discrete category on the set . That’s too trivial to help. But more importantly, coweights can be fractional, which means that comagnitudes
are in general irrational. Since the magnitude of a finite category is always rational, there’s no finite category in the world whose magnitude is going to be .
Properties of comagnitude
In any case, comagnitude of set-valued functors has some good properties. Most simply, if then . Also, given functors
we have if is an equivalence, or even just if has a right adjoint. Comagnitude also behaves well with respect to limits. For example, given functors and natural transformations
such that the diagram
is cofree for each (meaning that both functions are uniform), then the comagnitude of the pullback
is given by
A similar result holds for any other limit shape.
Codiscrepancy
The last idea I want to share is about “codiscrepancy”. For a functor , typically unless is cofree. We can measure the extent to which this equation fails by defining the codiscrepancy of to be
(I’ll ignore the possibility that this is .) In my last post, I used the word “discrepancy” for the difference between the cardinality of the colimit and the magnitude. For limits and comagnitude, taking the ratio seems more appropriate than taking the difference.
Examples
Take an equalizer diagram in . Its codiscrepancy is
In the case of discrepancy and magnitude last time, there was some discussion in both the post and the comments about the relationship between discrepancy and the Euler characteristic of chain complexes. Codiscrepancy seems more related to homotopy cardinality, where we take an alternating product of cardinalities of homotopy groups rather than an alternating sum of ranks of homology groups. But I’m still absorbing the comments from last time and won’t try to say more now.
For a pullback diagram
in FinSet, the codiscrepancy is
This provides an answer — although maybe not a completely satisfying one — to the question I posed at the end of part 1: can mutual information be seen as some kind of magnitude?
Here’s how. As explained in the example on conditional entropy in part 1, an integer-valued measure on a product of finite sets can be seen as a set together with a function , or equivalently a pair of functions . The pullback square
of sets gives rise to a pullback square of monoids
where, for instance, is the monoid of endomorphisms of over . And the codiscrepancy of this pullback square is
This is exactly the mutual information of our measure on . So that gives the definition of the mutual information of an integer-valued measure, and by the same kind of argument we used last time, we can easily get from this the definition for arbitrary measures, including probability measures.
Reflections
Zooming out now and contemplating everything in this post and the last, the big question in my mind is: what’s this all good for? Do the magnitude and comagnitude of set-valued functors have significance beyond the examples I’ve given?
And what about the world of enriched categories and functors? The most novel and startling results in the theory of magnitude have come from thinking about metric spaces as enriched categories. So what happens in that setting? Are there interesting results?