[Last time](https://forum.azimuthproject.org/discussion/2124/lecture-30-chapter-2-preorders-as-enriched-categories) 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 to 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: 1. a set of objects, \\(\mathrm{Ob}(\mathcal{X})\\), and 2. 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](https://en.wikipedia.org/wiki/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](https://www.acsu.buffalo.edu/~wlawvere/) did in 1973... and he invented the concept that's now called a [Lawvere metric space](https://ncatlab.org/nlab/show/metric+space#LawvereMetricSpace). 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,y) \\) 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](https://en.wikipedia.org/wiki/Metric_space). 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](http://www.tac.mta.ca/tac/reprints/articles/1/tr1abs.html), _Rendiconti del Seminario Matematico e Fisico di Milano_ **XLIII** (1973), 135-166. Reprinted in _Reprints in Theory and Applications of Categories_ **1** (2002), 1-37. 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.](http://www.azimuthproject.org/azimuth/show/Applied+Category+Theory#Chapter_2)**