## January 16, 2020

#### Posted by Tom Leinster

Yesterday I gave a seminar at the University of California, Riverside, through the magic of Skype. It was the first time I’ve given a talk sitting down, and only the second time I’ve done it in my socks.

The talk was on codensity monads, and that link takes you to the slides. I blogged about this subject lots of times in 2012 (1, 2, 3, 4), and my then-PhD student Tom Avery blogged about it too. In a nutshell, the message is:

This should probably be drilled into learning category theorists as much as better-known principles like “whenever you meet a functor, ask what adjoints it has”. But codensity monads took longer to be discovered, and are saddled with a forbidding name — should we just call them “induced monads”?

In any case, following this principle quickly leads to many riches, of which my talk was intended to give a taste.

Posted at January 16, 2020 2:36 PM UTC

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

Incidentally, here’s a puzzle I posed in the talk. The inclusion of the category of fields into the category of commutative rings has a codensity monad $T$, a formula for which is in the slides. What are the $T$-algebras?

Posted by: Tom Leinster on January 16, 2020 6:33 PM | Permalink | Reply to this

Wow! It’s really intriguing to see those arithmetical structures come up so naturally. At least in the case when $R$ has only finitely many prime ideals, then your functor $R \mapsto \prod_{\mathfrak{p}} Frac(R/\mathfrak{p})$ produces a finite product of fields, whose prime ideals are in bijection with the components, which makes the monad idempotent in this case. So I guess among rings with finite spectrum, the algebras of your monad are exactly the products of fields, and those have a unique algebra structure? For a ring infinitely many prime ideals though, the product will be infinite, and I suspect that its prime ideals will be in bijection with the ultrafilters on $Spec(R)$. Thus in general the algebras of your monad may also carry some topological structure? But I imagine that you’ve already thought about this.

Does this all seem reasonable? If so, it’s somewhat reminiscent of the adele ring, but I’m not competent enough to comment further on this. Anyway, I’m probably not saying anything that you don’t already know.

Posted by: Tobias Fritz on January 17, 2020 6:28 PM | Permalink | Reply to this

Don’t you actually get a product of integral domains, not necessarily of fields?

Posted by: L Spice on January 17, 2020 6:44 PM | Permalink | Reply to this

They’re fields: for each prime ideal $\mathfrak{p}$ of $R$, the ring $R/\mathfrak{p}$ is an integral domain, and $Frac(R/\mathfrak{p})$ denotes its field of fractions.

Posted by: Tom Leinster on January 17, 2020 10:36 PM | Permalink | Reply to this

Somehow, despite re-reading that multiple times to see what I was missing, my eyes skipped over ‘Frac’ each time. Thanks!

Posted by: L Spice on January 21, 2020 3:11 PM | Permalink | Reply to this

This morning on the bus, I started thinking about this problem, and got to precisely the same point as you got to in your first paragraph… but unlike me, you wrote it down!

I agree with your partial result:

among rings with finite spectrum, the algebras of your monad are exactly the products of fields, and those have a unique algebra structure

I don’t know if there’s some intrinsic description of rings that are (finite) products of fields.

For general rings $A$, I agree that a $T$-algebra structure on $A$ very likely involves some topological structure. But I don’t know what.

It also dawned on me on the bus that I’d tried to solve this problem years ago, and not succeeded then either. I see that my paper contains (in Example 5.1) the following sentence:

On the geometric side, $Spec(T^G(A))$ is the Stone-Čech compactification of the discrete space $Spec(A)$.

Here $A$ is a commutative ring and $T^G$ is the codensity monad $T$ we’re talking about. But frustratingly, I gave no reference for this fact, which probably means I didn’t know one. I guess I was just making a set-theoretic statement (i.e. the prime ideals of $T(A)$ are the ultrafilters on the set of prime ideals of $A$), rather than asserting a homeomorphism. The author was unclear. Anyway, this means that I agree(d) with your suspicion about what the prime ideals of $T(A)$ are.

it’s somewhat reminiscent of the adele ring, but I’m not competent enough to comment further on this

This made me smile, because John said almost exactly the same words during my seminar, right down to the not-entirely-believable competence disclaimer :-)

Posted by: Tom Leinster on January 17, 2020 10:34 PM | Permalink | Reply to this

Thank you for drawing attention to codensity monads. It’s such a ubiquitous, yet overlooked concept!

Posted by: Paolo Perrone on January 17, 2020 2:56 PM | Permalink | Reply to this

Let’s see if we can polymath the first puzzle.

The question There is a monad $T$ on the category $\mathbf{CRing}$ of commutative rings given by

$T(A) = \prod_{\mathfrak{p} \in Spec(A)} Frac(A/\mathfrak{p}).$

Here $A$ is a ring ($=$ commutative ring henceforth), $Spec(A)$ is the set of prime ideals of $A$, and $Frac$ means field of fractions. I won’t say explicitly here what the monad structure on $T$ is, but abstractly, $T$ is the codensity monad of the inclusion $\mathbf{Field} \to \mathbf{CRing}$.

And the question is:

What are the algebras for the monad $T$?

It’s a slightly open-ended question, in that you could just grumpily reply “they are what they are”. But I think we’ll know a satisfactory answer when we see it.

Posted by: Tom Leinster on January 17, 2020 11:35 PM | Permalink | Reply to this

Here are some things we already know.

First, two short things.

• As Tobias pointed out in an earlier comment, if $A$ is a finite product of fields then $A$ has a unique $T$-algebra structure. (Indeed, in that case $T(A) \cong T^2(A)$ canonically.)

• For any ring $A$, the ring $T(A)$ is reduced (has no nonzero nilpotents). Hence any subring of $T(A)$ is also reduced. But if $A$ carries a $T$-algebra structure then it’s isomorphic to a subring of $T(A)$. So, any ring carrying a $T$-algebra structure is reduced.

Now a longer thing.

As Tobias suspected, and as asserted in Example 5.1 of this paper, the prime ideals of $T(A)$ are in bijection with the ultrafilters on $Spec(A)$, for any ring $A$. Here’s how this works.

Actually, we’ll prove that for any product $B = \prod_{x \in X} k_x$ of fields, taken over an arbitrary set $X$, the prime ideals of $B$ are in bijection with the ultrafilters on $X$. I’ll use some notation: for $b = (b_x)_{x \in X} \in B$, write

$Z(b) = \{ x \in X : b_x = 0\} \subseteq X.$

In one direction, given a prime ideal $\mathfrak{p}$ of $B$, there’s an ultrafilter $\Omega_{\mathfrak{p}}$ on $X$ defined by

$\Omega_{\mathfrak{p}} = \{Z(b): b \in \mathfrak{p}\}.$

In the other direction, given an ultrafilter $\Omega$ on $X$, there’s a prime ideal $\mathfrak{p}_\Omega$ of $B$ defined by

$\mathfrak{p}_\Omega = \{ b \in B : Z(b) \in \Omega\}.$

And these two processes are mutually inverse, establishing a bijection between the prime ideals of $B = \prod_{x \in X} k_x$ and the ultrafilters on $X$. I’ve omitted a bunch of checks here, but none of them requires special techniques.

(As a sanity check, if $X$ is finite then every ultrafilter is principal, so the ultrafilters on $X$ are in bijection with the elements of $X$. And it’s easy to see that the prime ideals of a finite product of fields $B = k_1 \times \cdots \times k_n$ are just things like $\{0\} \times k_2 \times \cdots \times k_n$ — hence, one for each element of $\{1, \ldots, n\}$.)

The main thing we want ideals for is to quotient by them. So we need to ask: given an ultrafilter $\Omega$ on $X$, what’s the quotient of $B$ by the prime ideal $\mathfrak{p}_{\Omega}$, and what is its field of fractions?

The answers turn out to be simple. More or less by definition, $B/\mathfrak{p}_\Omega$ is the ultraproduct $\bigl(\prod_x k_x\bigr)/\Omega$. In other words, two elements $b = (b_x)_{x \in X}$ and $c = (c_x)_{x \in X}$ of $B$ represent the same element of $B/\mathfrak{p}_\Omega$ if and only if the set of indices $x$ such that $b_x = c_x$ is “large”, i.e. belongs to $\Omega$.

The excellent fact now is that $B/\mathfrak{p}_\Omega$ is already a field. (So taking its field of fractions does nothing. And every prime ideal of $B$ is in fact maximal.) That’s because, even though an ordinary product of fields isn’t a field, an ultraproduct of fields is a field. I explained why under the heading “Extended example” here, and it’s also an instance of Łoś’s theorem (also explained there).

So, our monad $T$ acts as follows on any product of fields $B = \prod_x k_x$:

$T\Bigl( \prod_{x \in X} k_x \Bigr) = \prod_{\text{ultrafilters}\ \Omega \ \text{on}\ X} \Bigl( \prod_{x \in X} k_x \Bigr) \Big/ \Omega.$

Since we’re interested in algebras for our monad $T$, and the definition of $T$-algebra involves the composite $T^2 = T\circ T$, eventually we’re going to have to ask what $T^2$ actually is. And we’ve already got our answer. Since $T(A)$ is a product of fields, we can take $B = T(A)$ in the description just given, which provides a more or less explicit formula for $T^2(A)$. It’s this:

$T^2(A) = \prod_{\text{ultrafilters}\ \Omega \ \text{on}\ Spec(A)} \Bigl( \prod_{\mathfrak{p} \in Spec(A)} Frac(A/\mathfrak{p}) \Bigr) \Big/ \Omega.$

Posted by: Tom Leinster on January 18, 2020 12:13 AM | Permalink | Reply to this

No one’s biting, and I don’t think I’m close to an answer to my question, but here seems as good a place as any to record some further observations.

First, any product of fields — perhaps an infinite product — appears to have a natural $T$-algebra structure. I showed before that for a product of fields $B = \prod_x k_x$,

$T(B) = \prod_{\text{ultrafilters}\ \Omega \ \text{on}\ X} \Bigl( \prod_{x \in X} k_x \Bigr) \Big/ \Omega.$

There’s a canonical map $\pi_B: T(B) \to B$: it’s projection onto the product of the principal ultrafilters on $X$ (noting that if $\Omega_y$ denotes the principal ultrafilter at $y \in X$ then $(\prod_x k_x)/\Omega_y = k_y$). Presumably $\pi_B$ is an algebra structure on $B$.

To verify that in full, we’d need to know something about the multiplication maps $\mu_A: T^2(A) \to T(A)$ of the monad $T$ (where $A$ denotes a ring). Since $T(A)$ is itself a product of fields, we’ve already constructed a homomorphism $T^2(A) \to T(A)$: it’s the map $\pi_{T(A)}$ got by taking $B = T(A)$ in the previous paragraph. And I guess that must be what $\mu_A$ is.

So, we seem to know:

• any finite product of fields has a unique $T$-algebra structure;

• any possibly-infinite product of fields has a canonical $T$-algebra structure.

Second observation: I noted before that if $B$ is a product of fields then every prime ideal in $B$ is maximal: in the jargon, $B$ is zero-dimensional. In particular, $T(A)$ is zero-dimensional for any ring $A$. It’s easy to see that the property of zero-dimensionality is inherited by retracts. If $A$ is a $T$-algebra then by definition, $A$ is a retract of $T(A)$. So, if a ring $A$ admits a $T$-algebra structure then $A$ is zero-dimensional.

Topologically, zero-dimensionality of a ring is equivalent to $Spec(A)$ being $T_1$ (i.e. points are closed), and also equivalent to $Spec(A)$ being Hausdorff. So, if $A$ admits a $T$-algebra structure then $Spec(A)$ is Hausdorff.

(The spectrum of any ring is compact, so once again we’ve got compact Hausdorff spaces floating around…)

But I couldn’t get any further than this. In particular, I don’t know whether there are any non-free $T$-algebras. (I suspect there are.)

Posted by: Tom Leinster on January 23, 2020 2:29 PM | Permalink | Reply to this

Dear Tom,

the category of $T$-algebras has products (in fact, all limits) which are created by the forgetful functor (by general reasons). Since fields have a unique algebra structure, it follows formally that products of fields have a canonical $T$-algebra structure as well (it might be non-unique).

What should also be mentioned here is the concept of a von Neumann regular ring. In the commutative case, there are lots of equivalent conditions (some of them are proven in: “Zero-dimensional commutative rings”, Lecture Notes in pure and applied mathematics 171, Chapter 1 “Background and Preliminaries on Zero-dimensional Rings” by Robert Gilmer):

For a commutative ring $A$, the following are equivalent:

1) $A$ is von Neumann regular, i.e. for every $a \in A$ there is some $b \in A$ with $a = aba$. 2) Every (principal) ideal of $A$ is idempotent. 3) Every (principal) ideal of $A$ is a radical ideal. 4) Every element $a \in A$ has a weak inverse $b \in A$ (i.e. $a = aba$ and $b = bab$). Notice that weak inverses are unique. 5) $A$ is isomorphic to a subring of a product of fields closed under weak inverses. 6) $A$ is reduced and every prime ideal is maximal (i.e. $\dim(A) \leq 0$). 7) For every prime $\mathfrak{p}$ the local ring $A_{\mathfrak{p}}$ is a field. 8) Every element of $A$ is a product of an idempotent element and a unit. 9) Every finitely generated ideal of $A$ is principal and generated by an idempotent element. 10) Every $A$-module is flat.

The characterization with weak inverses shows that the category $\mathbf{NRing}$ of commutative von Neumann regular rings is algebraic (we add an additional unary operation $w$ to the theory of commutative rings and require $a = a \cdot w(a) \cdot a$ and $w(a) = w(a) \cdot a \cdot w(a)$). On the other hand, since all local rings are fields (and hence every module is flat), we are not far from the category of fields. This is why $\mathbf{NRing}$ is one of my favorite categories which is “close enough” to the category of fields but “still algebraic”.

From the characterizations it follows immediately that $T(A)$ is von Neumann regular (use 5) and that every commutative ring $A$ with a $T$-algebra structure is von Neumann regular (since there is a split epimorphism $T(A) \to A$) and hence is reduced and has dimension $\leq 0$. This has already been proven here in the thread, but from this perspective it is just very easy in my opinion, since no ultraproducts or ultrafilters are necessary.

Also, $T$ restricts to a monad $T'$ on $\mathbf{NRing}$, and it is now clear that $T$-algebras are the same as $T'$-algebras. So let us write $T$ instead of $T'$ and work with $\mathbf{NRing}$ instead of $\mathbf{CRing}$. I think that this is a natural setting.

Since $T(A)$ is an infinite product and we are looking for maps out of it, it seems unlikely to me that there will be a concise description of the category of $T$-algebras.

However, we may restrict ourselves to an even more basic subcategory of $\mathbf{NRing}$, namely the category of boolean rings $\mathbf{Bool}$. (Notice that commutative von Neumann regular rings are “not far” from being boolean since every element is idempotent up to a unit, but of course also rings with $x^n = x$ are von Neumann regular.) I believe that every boolean $T$-algebra is a product of copies of $\mathbb{F}_2$, and that this is an equivalence between the category of $T$-algebras and $\mathbf{Set}^{op}$. By Stone duality this is equivalent to a topological statement, which I have just asked about here. Let’s see if this is true at all.

Posted by: Martin Brandenburg on February 7, 2020 11:42 AM | Permalink | Reply to this

Another thing to look for when lacking a left adjoint is the pro-left adjoint. Is there anything to say relating this construction to the codensity monad?

Posted by: David Corfield on January 18, 2020 7:48 AM | Permalink | Reply to this

I don’t know anything about shape theory. But for the example of $G:\mathbf{FinSet}\to\mathbf{Set}$, the induced functor $\mathrm{hom}(-,G):\mathbf{Set}\to[\mathbf{FinSet},\mathbf{Set}]^\mathrm{op}$ factors through $\mathrm{Pro}(\mathbf{FinSet})$, and I think this gives another resolution of the ultrafilter monad. Is this what you had in mind?

(Here $\mathrm{Pro}(\mathbf{FinSet})$ = Stone spaces, but this seems to work generally for codensity of $G:B\to A$ whenever the $B$ is small with finite limits and $G$ preserves them.)

Posted by: Sam Staton on January 23, 2020 9:54 AM | Permalink | Reply to this

One answer is to work in $Dist$, the bicategory of distributors (or profunctors). If then $K:A\to B$ is a functor, and one forms the corresponding codensity monad in $Dist$ of $K$ as a distributor which of course has an adjoint and thus yields a codensity monad, the shape theory of $K$ is related to the Kleisli category of that monad.

(This is here a summary of course, and it is years since I worked with this so I may have got some things wrong!)

I agree with Tom’s comment that assuming pro-left adjoints is a step too far in general. It can be useful in specific instances but that is then less generic. This is all in the book written by Jean-Marc Cordier and myself published first in 1989, but we did not try to do anything in the fascinating cases involving anything probabilistic.

Posted by: Tim Porter on January 27, 2020 5:16 PM | Permalink | Reply to this

I forgot to give the reference for the link between distributors and shape theory. That is in a paper by Dominique Bourn and Jean-Marc Cordier in the Cahiers 21 (1980) 161 - 189.

Posted by: Tim Porter on January 27, 2020 5:46 PM | Permalink | Reply to this

Thanks! I didn’t have anything very definite in mind – just wondering if there’s an interesting range of ways to make up for lack of left adjoint. And a hope some day to have time to see what’s going on with pyknotic sets/condensed sets.

Posted by: David Corfield on January 23, 2020 1:49 PM | Permalink | Reply to this

I guess I’ve already sufficiently emphasized that codensity monads are an absolutely canonical concept of category theory, and I don’t need to bang that drum any further.

While I can’t claim to have digested the concept of pro-left adjoint, I note that the definition does involve a somewhat arbitrary choice, namely, of a class of limits. Specifically, it involves the pro-completion of a category, i.e. the free completion under the class of cofiltered limits. (And the definition of pro-left adjoint is only made for those functors that preserve finite limits.) One can envisage making similar definitions for other classes of limit.

So while I wouldn’t necessarily disagree with the proposition there’s an “interesting range of ways to make up for lack of left adjoint”, I would argue that among those ways, codensity monads are canonical in a sense that pro-left adjoints are not.

Posted by: Tom Leinster on January 23, 2020 2:13 PM | Permalink | Reply to this

1. A codensity monad can be considered as a special case of a pushforward of a monad along a functor: if S is a monad and G is a functor, then the right Kan extension $Ran_{G}(G\circ S)$ is always a monad. The proof this fact is just slightly extended proof of the fact that a codensity monad is a monad. A codensity monad is then just a pushfoward of the identity monad.
2. However, there is a bit more general perspective: as we all know, a monad on a category $C$ just a monoid in the monoidal category of endofunctors of $C$, let us call it call it $Endof(C)$. If $G\colon C\to D$ is a functor and $D$ is complete, then $R\colon Endof(C)\to Endof(D)$ given by $R(S)=Ran_{G}(G\circ S)$ is a monoidal functor. Since $R$ is monoidal, it maps monoids in $Endof(C)$ to monoids in $Endof(D)$ and this is the pushforward.