Keith wrote:

> Isn't puzzle 185 asking for an algorithm that computes shortest possible paths over the profunctor \$$\Phi\$$?

No, I'm a mathematician: if I ever want an algorithm, I'll ask for it loud and clear!

> **Puzzle 185.** In general, a \$$\mathbf{Cost}\$$-enriched profunctor \$$\Phi : C \nrightarrow D\$$ is defined to be a [\$$\mathbf{Cost}\$$-enriched functor](https://forum.azimuthproject.org/discussion/2169/lecture-32-chapter-2-enriched-functors/p1)

> $\Phi : C^{\text{op}} \times D \to \mathbf{Cost}$

> This is a function that assigns to any \$$c \in C\$$ and \$$d \in D\$$ a cost \$$\Phi(c,d)\$$. However, to be a \$$\mathbf{Cost}\$$-enriched functor it needs to obey some properties! What are these properties? What do they mean in terms of trips between cities?

A) What properties must a function \$$\Phi : C^{\text{op}} \times D \to \mathbf{Cost}\$$ obey for it to be a \$$\mathbf{Cost}\$$-enriched functor?

Simon has pointed out a problem here, which is that I may never have come out and said how \$$\mathbf{Cost}\$$ becomes a \$$\mathbf{Cost}\$$-enriched category! Without knowing this my question is not really well-posed.

So, how does \$$\mathbf{Cost}\$$ becomes a \$$\mathbf{Cost}\$$-enriched category?

A \$$\mathbf{Cost}\$$-enriched category \$$\mathcal{C}\$$ has a cost \$$\mathcal{C}(x,y)\$$ for any two objects \$$x,y\$$, so here we need a cost for any two costs \$$x,y\$$. And here's what it is: it's \$$y-x\$$, or zero if this is less than zero.

Simon has explained how we get this from general principles. I will say more about this later - I was always planning to explain it; I just forget I needed to explain it for this puzzle!

And given the answer to part A), I'm asking

B) What does this answer mean in terms of our favorite example, where

$\Phi : C^{\text{op}} \times D \to \mathbf{Cost}$

describes the cost of travelling from a city \$$c \in C\$$ to a city \$$d \in D\$$?