In Chapter 4 of _[Seven Sketches](http://math.mit.edu/~dspivak/teaching/sp18/7Sketches.pdf)_, Fong and Spivak introduce 'enriched profunctors' as a way to study collaborative design, where different teams are working together to make a product. An enriched profunctor can be used to answer the questions:

* **given some requirements, what resources will let us fulfill these requirements?**

and

* **given some resources, what requirements will these resources let us fulfill?**

You'll notice that these questions are two sides of the same coin! There will be an enriched profunctor going from resources to requirements they fulfill, and we can 'flip' it to get an enriched profunctor from requirements to resources needed to fulfill them.

As the name suggests, an 'enriched profunctor' is a bit like a functor between enriched categories... for pros. That is, for professionals.

Indeed, most category theorists consider enriched profunctors rather sophisticated. But Fong and Spivak bring them down to earth by their clever trick of focusing on _preorders_ rather than more general categories.

Remember that [in Chapter 1 they introduced preorders](https://forum.azimuthproject.org/discussion/1812/lecture-3-chapter-1-posets/p1). A **preorder** is a set \$$X\$$ equipped with a relation \$$\le\$$ obeying

$x \le x$

and

$x \le y \text{ and } y \le z \; \implies \; x \le z .$

Later we saw a preorder is secretly a category with at most one morphism from any object \$$x\$$ to any object \$$y\$$: if one exists we write \$$x \le y\$$. But because there's at most _one_, we never have to worry about equations between morphisms. Everything simplifies enormously! This is the key to Fong and Spivak's expository strategy.

[In Chapter 2 they introduced monoidal preorders](https://forum.azimuthproject.org/discussion/1812/lecture-3-chapter-1-posets/p1). These are a special case of 'monoidal categories', which we haven't discussed yet - but they're much simpler! A **monoidal preorder** is a preorder \$$(X,\le) \$$ with an operation \$$\otimes : X \times X \to X\$$ and element \$$I \in X\$$ obeying

$$(x \otimes y) \otimes z = x \otimes (y \otimes z)$$

$$I \otimes x = x = x \otimes I$$

and

$$x \le x' \textrm{ and } y \le y' \textrm{ imply } x \otimes y \le x' \otimes y' .$$

We used preorders to study _resources_: we said \$$x \le y \$$ if \$$x \$$ is cheaper than \$$y\$$, or you can get \$$x\$$ if you have \$$y\$$. Then we used \$$\otimes\$$ to _combine_ resources, and used \$$I\$$ for a 'nothing' resource: \$$x\$$ combined with nothing is just \$$x\$$.

(Actually Fong and Spivak use the opposite convention, writing \$$x \le y\$$ to mean you can get \$$y\$$ if you have \$$x\$$. This seems weird if you think of resources as being like money, but natural if you think of your preorder as a category, and remember \$$x \le y\$$ means there's a morphism \$$f : x \to y\$$. I should probably use this convention.)

Later in Chapter 2 they generalized preorders a bit, and introduced [categories enriched in a monoidal preorder](https://forum.azimuthproject.org/discussion/2121/lecture-29-chapter-2-enriched-categories/p1). Remember the idea: first we choose a monoidal preorder to enrich in, and call it \$$\mathcal{V}\$$. Then a **\$$\mathcal{V}\$$-enriched category**, say \$$\mathcal{X}\$$, consists of

1. a set of **objects** \$$\text{Ob}(\mathcal{X})\$$, and

2. for every two objects \$$x,y\$$, an element \$$\mathcal{X}(x,y)\$$ of \$$\mathcal{V}\$$,

such that

a) \$$I\leq\mathcal{X}(x,x) \$$ for every object \$$x\in\text{Ob}(\mathcal{X})\$$, and

b) \$$\mathcal{X}(x,y)\otimes\mathcal{X}(y,z)\leq\mathcal{X}(x,z) \$$ for all objects \$$x,y,z\in\mathrm{Ob}(\mathcal{X})\$$.

[We saw](https://forum.azimuthproject.org/discussion/2124/lecture-30-chapter-1-preorders-as-enriched-categories/p1) that if \$$\mathcal{V} = \mathbf{Bool}\$$, a \$$\mathcal{V}\$$-enriched category is just a preorder: the truth value \$$\mathcal{X}(x,y)\$$ tells you if you _can_ get from \$$x\$$ to \$$y\$$. But if \$$\mathcal{V} \$$ is something fancier, like \$$\mathbf{Cost}\$$, \$$\mathcal{X}(x,y)\$$ tells you more, like _how much it costs_ to get from \$$x\$$ to \$$y\$$.

Where do enriched profunctors fit into this game?

Here: given \$$\mathcal{V}\$$-enriched categories \$$\mathcal{X}\$$ and \$$\mathcal{Y}\$$, a \$$\mathcal{V}\$$-enriched profunctor is a clever kind of thing going from \$$\mathcal{X}\$$ to \$$\mathcal{Y}\$$.

If we take objects of \$$\mathcal{X}\$$ to be _requirements_ and objects of \$$\mathcal{Y}\$$ to be _resources_, we can use a \$$\mathcal{V}\$$-enriched profunctor from \$$\mathcal{X}\$$ to \$$\mathcal{Y}\$$ to describe, for each choice of requirements, which resources will fulfill it... or how much it will cost to make them fulfill it... or various other things like that, depending on \$$\mathcal{V}\$$.

On the other hand, we can use a \$$\mathcal{V}\$$-enriched profunctor going back from \$$\mathcal{Y}\$$ to \$$\mathcal{X}\$$ to describe, for each choice of resources, which requirements they will fulfill.. or how much it will cost to make it fulfill them... or various other things like that, depending on \$$\mathcal{V}\$$.

It's all very beautiful and fun. Dive in! Read Section 4.1 and 4.2.1, and maybe 4.2.2 if you're feeling energetic.

Happy Fourth of July! You don't need fireworks for excitement if you've got profunctors.

**[To read other lectures go here.](http://www.azimuthproject.org/azimuth/show/Applied+Category+Theory#Chapter_2)**