Skip to the Main Content

Note:These pages make extensive use of the latest XHTML and CSS Standards. They ought to look great in any standards-compliant modern browser. Unfortunately, they will probably look horrible in older browsers, like Netscape 4.x and IE 4.x. Moreover, many posts use MathML, which is, currently only supported in Mozilla. My best suggestion (and you will thank me when surfing an ever-increasing number of sites on the web which have been crafted to use the new standards) is to upgrade to the latest version of your browser. If that's not possible, consider moving to the Standards-compliant and open-source Mozilla browser.

January 29, 2025

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 AA is a function w A:ob(A)w_A: ob(A) \to \mathbb{Q} such that

aA|A(b,a)|w A(a)=1 \sum_{a \in A} |A(b, a)| w_A(a) = 1

for all bAb \in A. This is a system of linear equations with as many equations as unknowns, so there’s usually a unique weighting w Aw_A on AA. The magnitude of a functor X:AFinSetX: A \to FinSet is defined to be

|X|= aw A(a)|X(a)|. |X| = \sum_a w_A(a) |X(a)| \in \mathbb{Q}.

This is equal to the cardinality of the colimit of XX when XX 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 XX isn’t a coproduct of representables, |X||X| 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 AA: it’s the total weight

|A|= aAw A(a). |A| = \sum_{a \in A} w_A(a).

This is equal to the magnitude of the constant functor Δ1:AFinSet\Delta 1: A \to FinSet 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: |X||X| is equal to the magnitude of 𝔼(X)\mathbb{E}(X), the category of elements of XX. 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 XX, under some fairly mild additional hypotheses on AA.

Aside   The two results in the last paragraph are easily deduced from each other, up to some small changes in the hypotheses on AA. This isn’t entirely surprising, as 𝔼(X)\mathbb{E}(X) is the colax colimit of X:ACatX: A \to Cat (where I’ve changed the codomain of XX from SetSet to CatCat by viewing sets as discrete categories). In any case, Thomason proved that the nerve of 𝔼(X)\mathbb{E}(X) is homotopy equivalent to hocolim(X)hocolim(X), 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

|𝔼(X)|=χ(hocolim(X)). |\mathbb{E}(X)| = \chi(hocolim(X)).

Thus, if we know that one side of this equation is equal to |X||X|, 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 AA and a functor X:AFinSetX: A \to FinSet, can we find a formula for the cardinality of the limit of XX, in terms of AA and the cardinalities of the sets X(a)X(a) (aAa \in A) only?

Of course, we can’t in general: |limX||lim X| depends on what XX does to the maps in AA as well as the objects. But there are significant cases where we can:

Examples

  • If AA is the two-object discrete category (01)(0 \quad 1) then a functor X:AFinSetX: A \to FinSet is a pair (X 0,X 1)(X_0, X_1) of finite sets, and

    |X 0×X 1|=|X 0|×|X 1|. |X_0 \times X_1| = |X_0| \times |X_1|.

  • What about pullbacks? Take finite sets and functions

    X 0fX 1gX 2. X_0 \stackrel{f}{\rightarrow} X_1 \stackrel{g}{\leftarrow} X_2.

    Suppose ff is uniform, meaning that all its fibres are isomorphic: f 1(y)f 1(y)f^{-1}(y) \cong f^{-1}(y') for all y,yX 1y, y' \in X_1. This is equivalent to the condition that ff is a product projection X 1×FX 1X_1 \times F \to X_1, a condition I talked about here, using the word “projection” instead of “uniform”. Using the uniformity of ff, it’s a little exercise to show that the pullback of our diagram has cardinality

    |X 0||X 2||X 1|. \frac{{|X_0|} \cdot {|X_2|}}{|X_1|}.

  • In a similar way, we can show that the equalizer of a pair of functions f,g:X 0X 1f, g: X_0 \to X_1 has cardinality |X 0|/|X 1|{|X_0|}/{|X_1|} if the function (f,g):X 0X 1×X 1(f, g): X_0 \to X_1 \times X_1 is uniform.

    You can think of this condition as saying that given an element x 0X 0x_0 \in X_0 chosen uniformly at random, all pairs (f(x 0),g(x 0))(f(x_0), g(x_0)) are equally likely. In particular, the probability that (f(x 0),g(x 0))(f(x_0), g(x_0)) lies on the diagonal of X 1×X 1X_1 \times X_1 is

    |diagonal||X 1×X 1|=|X 1||X 1||X 1|=1|X 1|. \frac{|diagonal|}{|X_1 \times X_1|} = \frac{|X_1|}{{|X_1|}\cdot {|X_1|}} = \frac{1}{|X_1|}.

    Since an element x 0X 0x_0 \in X_0 is in the equalizer if and only if (f(x 0),g(x 0))(f(x_0), g(x_0)) lies on the diagonal, we’d expect the equalizer to have cardinality |X 0|/|X 1|{|X_0|}/{|X_1|}, and it does. I’ll come back to this probabilistic idea later, rigorously.

  • Now let’s consider cofree actions of a group GG on a set. By definition, the cofree GG-set generated by a set SS is the set S GS^G of GG-indexed families (s g) gG(s_g)_{g \in G} of elements of SS (or functions GSG \to S if you prefer), with action

    h(s g) gG=(s gh) gG. h \cdot (s_g)_{g \in G} = (s_{g h})_{g \in G}.

    The fixed points of this GG-set are the constant families (s) gG(s)_{g \in G}, for sSs \in S. So, if we’re given just the GG-set S GS^G and not told what SS is, we can reconstruct SS anyway: it’s the set of fixed points. In particular, when everything is finite, |S||S| is the cardinality of the GG-set to the power of 1/o(G)1/o(G) (writing oo for order).

    Now, when a GG-set is regarded as a functor BGSetB G \to Set, the set of fixed points is the limit of the functor. So for a functor X:BGFinSetX: B G \to FinSet corresponding to a cofree action of a group GG on a finite set X 0X_0,

    |limX|=|X 0| 1/o(G). |lim X| = |X_0|^{1/o(G)}.

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 GG-set to be free if it’s isomorphic to G×SG \times S (with its usual action) for some set SS. It’s a useful little theorem that a GG-set XX is free if and only if:

for all gGg \in G, if gx=xg x = x for some xXx \in X then g=1g = 1.

Is there an analogous result for cofree actions?

As I mentioned above, if you’ve got a cofree GG-set XX and you want to find the set SS such that XS GX \cong S^G, it’s easy: SS 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 GG-set to be cofree.

Back to the cardinality of limits! In all the examples above, for functors X:AFinSetX: A \to FinSet satisfying certain conditions, we had

|limX|= aA|X(a)| q(a) |lim X| = \prod_{a \in A} |X(a)|^{q(a)}

for some rational numbers q(a)q(a) (aAa \in A) depending only on AA, not XX. If you read Part 1, you might be able to guess both what these numbers q(a)q(a) are and what condition on XX 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 AA is a weighting on A opA^{op}, or explicitly, a function w A:ob(A)w^A: ob(A) \to \mathbb{Q} such that

aA|A(a,b)|w A(a)=1 \sum_{a \in A} |A(a, b)| w^A(a) = 1

for all bAb \in A. As for weightings, I’ll assume throughout that AA has exactly one coweighting, which is generically true.

As I explained in a previous post, the forgetful functor

Set ASet ob(A) Set^A \to Set^{ob(A)}

has both a left adjoint LL and a right adjoint RR. A functor ASetA \to Set is in the image of LL 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 ASetA \to Set is cofree if it’s in the image of RR. These are the ones that make the formula for the magnitude of a limit work:

Theorem   Let AA be a finite category and X:AFinSetX: A \to FinSet a cofree functor. Then

|limX|= aA|X(a)| w A(a). |lim X| = \prod_{a \in A} |X(a)|^{w^A(a)}.

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

(S(a)) aASet ob(A), (S(a))_{a \in A} \in Set^{ob(A)},

the cofree functor X=R(S)X = R(S) is given by

X(a)= bS(b) A(a,b). X(a) = \prod_b S(b)^{A(a, b)}.

You can see from this formula how X(a)X(a) is functorial in aa. (The right-hand side is doubly contravariant in aa, which means it’s covariant.) In examples, the functions

X(a)X(u)X(b) X(a) \stackrel{X(u)}{\to} X(b)

arising from maps auba \stackrel{u}{\to} b in AA 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, X(u)X(u) is always uniform if uu is epic, and in the kinds of category AA that we often take limits over, the maps often are epic.

Examples

  • When AA is a two-object discrete category, so that limits over AA are binary products, every functor AFinSetA \to FinSet is cofree, the coweights of the objects of AA are both 11, and the theorem gives the usual formula for the cardinality of a product of two finite sets.

  • For pullbacks, we’re taking AA to be (012)(0 \rightarrow 1 \leftarrow 2), whose coweighting is (1,1,1)(1, -1, 1). A functor AFinSetA \to FinSet is a diagram (X 0X 1X 2)(X_0 \rightarrow X_1 \leftarrow X_2) 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

    |X 0||X 2||X 1|. \frac{{|X_0|}\cdot {|X_2|}}{|X_1|}.

  • Similarly, a functor from A=(01)A = (0 \rightrightarrows 1) to FinSetFinSet consists of finite sets and functions f,g:X 0X 1f, g: X_0 \to X_1, it’s cofree if and only if (f,g):X 0X 1×X 1(f, g): X_0 \to X_1 \times X_1 is uniform, and the theorem tells us that the equalizer has cardinality

    |X 0||X 1|. \frac{|X_0|}{|X_1|}.

  • Finally, when AA is the one-object category corresponding to a group GG, the single coweight is 1/o(G)1/o(G), a functor AFinSetA \to FinSet is a finite GG-set XX, and the theorem tells us that if the action is cofree then the number of fixed points is

    |X 0| 1/o(G)|X_0|^{1/o(G)}

    (where |X 0||X_0| means the cardinality of the underlying set X 0X_0 of XX).

Comagnitude: definition and examples

Given an arbitrary functor X:AFinSetX: A \to FinSet, not necessarily cofree, it’s typically not true that

|limX|= aA|X(a)| w A(a). |lim X| = \prod_{a \in A} |X(a)|^{w^A(a)}.

But we can still think about the right-hand side! So I’ll define the comagnitude X\|X\| of XX by

X= aA|X(a)| w A(a) +. \|X\| = \prod_{a \in A} |X(a)|^{w^A(a)} \in \mathbb{R}^+.

(The notation X\|X\| isn’t great, and isn’t intended to suggest a norm. I just wanted something that looked similar to but different from X\|X\|. Suggestions are welcome.)

Examples

  • If XX is cofree then X=|limX|\|X\| = {|lim X|}.

  • For a diagram X=(X 0X 1X 2)X = (X_0 \rightarrow X_1 \leftarrow X_2) of finite sets, seen as a set-valued functor in the usual way,

    X=|X 0||X 2||X 1|. \|X\| = \frac{{|X_0|}\cdot {|X_2|}}{|X_1|}.

  • Similarly, for a diagram X=(X 0X 1)X = (X_0 \rightrightarrows X_1) of finite sets,

    X=|X 0||X 1|. \|X\| = \frac{|X_0|}{|X_1|}.

  • For a finite set X 0X_0 equipped with an action of a finite monoid GG, the comagnitude of the corresponding functor X:BGFinSetX: B G \to FinSet is given by

    X=|X 0| 1/o(G). \|X\| = |X_0|^{1/o(G)}.

  • Let AA be any finite category and SS any finite set. The constant functor ΔS:AFinSet\Delta S: A \to FinSet with value SS has comagnitude

    a|S| w A(a)=|S| aw A(a). \prod_a |S|^{w^A(a)} = |S|^{\sum_a w^A(a)}.

    Now it’s a tiny lemma that the total coweight of a category AA is equal to the total weight (try it!), which by definition is the magnitude of AA. So

    AΔSFinSet=|S| |A|. \| A \stackrel{\Delta S}{\to} FinSet \| = |S|^{|A|}.

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 X:AFinSetX: A \to FinSet, but one that only depends on AA and the sets X(a)X(a).

You: That’s impossible! There are loads of examples of functors X,Y:AFinSetX, Y: A \to FinSet such that X(a)Y(a)X(a) \cong Y(a) for all aAa \in A, but |limX||limY|{|lim X|} \neq {|lim Y|}.

Me: Try anyway.

You: Well, okay. If the only information I’m allowed to use is which set each object of AA 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 AA, calculate the cardinality of the limit of each one, and take the average.

This suggests an idea: could the comagnitude of a functor X:AFinSetX: A \to FinSet be the expected value of |limY||lim Y| for a random functor Y:AFinSetY: A \to FinSet satisfying |Y(a)|=|X(a)|{|Y(a)|} = {|X(a)|}?

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 QQ be a quiver (directed multigraph). We can form the free category FQF Q on QQ, whose objects are the vertices of QQ and whose maps are the directed paths of edges in QQ. Assuming that QQ is finite and acyclic, the category FQF Q is finite too.

It’s a theorem that for a functor X:FQFinSetX: F Q \to FinSet, the comagnitude X\|X\| is the expected value of |limY||lim Y| for a functor Y:AFinSetY: A \to FinSet chosen uniformly at random subject to the condition that Y(a)=X(a)Y(a) = X(a) for all aAa \in A.

This covers cases such as products, pullbacks and equalizers: all those categories AA are free on a quiver.

(Incidentally, the cofree functors on FQF Q 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 ΔS:AFinSet\Delta S: A \to FinSet has comagnitude |S| |A||S|^{|A|}, for any finite set SS. 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 X:AFinSetX: A \to FinSet, there’s no way we’re going to be able to extract the comagnitude of XX 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 XX is the Euler characteristic of its homotopy colimit (under hypotheses on AA), 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 X:ASetX: A \to Set as a functor ACatA \to Cat taking values in discrete categories, then its lax limit is simply the discrete category on the set limXlim X. That’s too trivial to help. But more importantly, coweights can be fractional, which means that comagnitudes

X= a|X(a)| w A(a) \|X\| = \prod_a |X(a)|^{w^A(a)}

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 X\|X\|.

Properties of comagnitude

In any case, comagnitude of set-valued functors has some good properties. Most simply, if XY:AFinSetX \cong Y: A \to FinSet then X=Y\|X\| = \|Y\|. Also, given functors

AFBYFinSet, A \stackrel{F}{\to} B \stackrel{Y}{\to} FinSet,

we have YF=Y\|Y \circ F\| = \|Y\| if FF is an equivalence, or even just if FF has a right adjoint. Comagnitude also behaves well with respect to limits. For example, given functors X,Y,Z:AFinSetX, Y, Z: A \to FinSet and natural transformations

XYZ X \rightarrow Y \leftarrow Z

such that the diagram

X(a)Y(a)Z(a) X(a) \rightarrow Y(a) \leftarrow Z(a)

is cofree for each aa (meaning that both functions are uniform), then the comagnitude of the pullback

X× YZ:AFinSet X \times_Y Z : A \to FinSet

is given by

X× YZ=XZY. \|X \times_Y Z\| = \frac{\|X\| \cdot \|Z\|}{\|Y\|}.

A similar result holds for any other limit shape.

Codiscrepancy

The last idea I want to share is about “codiscrepancy”. For a functor X:AFinSetX: A \to FinSet, typically |limX|X{|lim X|} \neq \|X\| unless XX is cofree. We can measure the extent to which this equation fails by defining the codiscrepancy of XX to be

|limX|X +. \frac{|lim X|}{\|X\|} \in \mathbb{R}^+.

(I’ll ignore the possibility that this is 0/00/0.) 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 EX 0X 1E \to X_0 \rightrightarrows X_1 in FinSetFinSet. Its codiscrepancy is

    |E||X 0|/|X 1|=|E||X 1||X 0|. \frac{|E|}{{|X_0|}/{|X_1|}} = \frac{{|E|} \cdot {|X_1|}}{|X_0|}.

    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

    P X 0 X 2 X 1 \begin{array}{ccc} P & \rightarrow & X_0 \\ \downarrow & & \downarrow \\ X_2 & \rightarrow & X_1 \end{array}

    in FinSet, the codiscrepancy is

    |P||X 0||X 2|/|X 1|=|P||X 1||X 0||X 2|. \frac{|P|}{{|X_0|}\cdot {|X_2|}/{|X_1|}} = \frac{{|P|}\cdot{|X_1|}}{{|X_0|}\cdot{|X_2|}}.

    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 I×JI \times J of finite sets can be seen as a set AA together with a function AI×JA \to I \times J, or equivalently a pair of functions IAJI \leftarrow A \rightarrow J. The pullback square

    I×J I J 1 \begin{array}{ccc} I \times J & \rightarrow & I \\ \downarrow & & \downarrow \\ J & \rightarrow & 1 \end{array}

    of sets gives rise to a pullback square of monoids

    End I×J(A) End I(A) End J(A) End(A), \begin{array}{ccc} End_{I \times J}(A) & \rightarrow & End_I(A) \\ \downarrow & & \downarrow \\ End_J(A) & \rightarrow & End(A), \end{array}

    where, for instance, End I(A)End_I(A) is the monoid of endomorphisms of AA over II. And the codiscrepancy of this pullback square is

    |End(A)||End I×J(A)||End I(A)||End J(A)|, \frac{{|End(A)|}\cdot{|End_{I \times J}(A)|}}{{|End_I(A)|}\cdot{|End_J(A)|}},

    This is exactly the mutual information of our measure on I×JI \times J. 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?

Posted at January 29, 2025 10:50 PM UTC

TrackBack URL for this Entry:   https://golem.ph.utexas.edu/cgi-bin/MT-3.0/dxy-tb.fcgi/3586

0 Comments & 0 Trackbacks

Post a New Comment