Lecture 31  Lawvere Metric Spaces
Last time I asked you to figure out what's a category enriched in the symmetric monoidal poset of "costs".
The set of costs consists of nonnegative numbers together with infinity:
$$ [0,\infty] . $$
There's an obvious way to define \(\le\) for costs, where we decree that everything is less than or equal to \(\infty\). There's an obvious way to add costs, where we decree that \(\infty\) plus anything equals \(\infty\). And there's an obvious unit for this addition operation, namely \(0\).
Now comes the tricky part, which tripped me up at first. We've got our hands on a obvious way to create a symmetric monoidal poset, which we could call \( ( [0,\infty], \le, +, 0 )\). However, this is not the one we want! Instead, we will play a fiendish trick! We'll use the "opposite" symmetric monoidal poset:
$$ \mathbf{Cost} = ( [0,\infty], \ge, + , 0) .$$
Note we've flipped around the direction of our partial order! You can always take any symmetric monoidal poset \(\mathcal{V}\), reverse the direction of the partial order this way, and get a new one called the opposite \(\mathcal{V}^{\text{op}} \). This can be confusing, and your brain may be screaming in pain, but it's a fundamental fact of life so you have to get used to it.
Let's see what a \(\mathbf{Cost}\)category amounts to, and why this "opposite" trick was a good idea here. We'll just run through the definition of enriched category and see what it gives.
A \(\mathbf{Cost}\)category, say \(\mathcal{X}\), consists of:

a set of objects, \(\mathrm{Ob}(\mathcal{X})\), and

an element \(\mathcal{X}(x,y) \in \mathbf{Cost} \) for any two objects \(x,y\).
So, a \(\mathbf{Cost}\)category gives a number in \([0,\infty]\) for each pair of objects \(x,y\).
Next:
a) In any enriched category we have
[ I\leq\mathcal{X}(x,x) \textrm{ for any object } x .]
However, in \(\mathbf{Cost}\) the unit \(I\) is the number \(0\), and we've fiendishly reversed the ordering. So, in a \(\mathbf{Cost}\)category we have
[ 0 \geq \mathcal{X}(x,x) \textrm{ for all objects } x .]
But \( \mathcal{X}(x,x) \) is a cost, so we also know \( \mathcal{X}(x,x) \geq 0 \). So, we can just say
[ \mathcal{X}(x,x) = 0 \textrm{ for all objects } x .]
Finally:
b) In any enriched category we have
[ \mathcal{X}(x,y)\otimes\mathcal{X}(y,z)\leq\mathcal{X}(x,z) \textrm{ for all objects } x,y,z. ]
However, in \(\mathbf{Cost}\) the monoid operation \(\otimes\) is addition, and we've fiendishly reversed the ordering. So, in a \(\mathbf{Cost}\)category we have
[ \mathcal{X}(x,y) + \mathcal{X}(y,z) \geq\mathcal{X}(x,z) \textrm{ for all objects } x,y,z. ]
Now we're done.
But hey: that last inequality is the triangle inequality! So maybe we should think of \(\mathcal{X}(x,y)\) as a distance and write it as \(d(x,y)\). That's what Bill Lawvere did in 1973... and he invented the concept that's now called a Lawvere metric space. In other words:
Definition. A Lawvere metric space is a \(\mathbf{Cost}\)category.
Theorem. A Lawvere metric space consists of a set \(X \) together with a function
$$ d : X \times X \to [0,\infty] $$
such that
a) \( d(x,x) = 0 \) for all \( x \in X \)
and
b) \( d(x,y) + d(y,z) \geq d(x,z) \) for all \( x,y,z \in X\).
Proof. We've shown that any \(\mathbf{Cost}\)category consists precisely of a set \(X = \mathrm{Ob}(\mathcal{X})\) together with a cost \(d(x,y) = \mathcal{X}(x,y) \) for each \(x,y \in X\), obeying these two inequalities. \( \qquad \blacksquare \)
Now, you may already have heard about metric spaces. A metric space is a very famous concept: it's a set with a way of measuring distances that obeys a few axioms. These include the two axioms of a Lawvere metric space, but also three more:
d) if \(d(x,y) = 0 \) then \(x = y \)
e) \(d(x,y) = d(y,x) \) for all \(x,y \in X\), and
f) \(d(x,y) < \infty \)
for all \(x,y \in X\).
These extra axioms hold in a lot of examples, but Lawvere noticed that they aren't really necessary for many of the main theorems involving metric spaces!
Dropping these extra axioms also allows for new applications. For example, we could let \(d(x,y)\) be the cost of going from one place \(x\) to another place \(y\), using your favorite modes of transportation. There are places you can go for free, so axiom d) does not hold. Sometimes it costs a different price to go from \(x\) to \(y\) than to go back, so axiom e) does not hold. And there are places you cannot go for any prices, like the Andromeda Nebula, so axiom f) does not hold. (See how economic issues keep coming into the discussions in this chapter?)
In fact, axioms d)f) are also bad in some purely mathematical ways: there are some nice ways to build new Lawvere metric spaces from old ones (called "coequalizers" and "coproducts") that don't work when you include these extra axioms.
You might think that extra axioms are always good, because they let you prove more theorems. But you have to remember they impose a price: it means the axioms apply to fewer things, so constructing structures that obey these axioms becomes harder.
So, Lawvere metric spaces are a great example of how category theory can lead us to refine and perfect existing ideas. And when you get good at enriched category theory, it means every general result you prove will apply to Lawvere metric spaces as well as preorders!
To see what Lawvere actually did, read this paper:
 Bill Lawvere, Metric spaces, generalized logic and closed categories, Rendiconti del Seminario Matematico e Fisico di Milano XLIII (1973), 135166. Reprinted in Reprints in Theory and Applications of Categories 1 (2002), 137.
It's good to look at papers by Lawvere now and then, to see how close you are to being a true category theorist. It's inevitably humbling, at least for me... but I've decided that's a good thing. It drives me to do better, while preventing me from getting a big head.
To read other lectures go here.