Today I will finally define enriched profunctors. For this we need two ways to build enriched categories. There are lots of ways to build new categories from old, and most work for \\(\mathcal{V}\\)-enriched categories too _if_ \\(\,\mathcal{V}\\) is nice enough. We ran into two of these constructions for categories in [Lecture 52](https://forum.azimuthproject.org/discussion/2273/lecture-52-the-hom-functor/p1) when discussing the hom-functor \[ \mathrm{hom}: \mathcal{C}^{\text{op}} \times \mathcal{C} \to \mathbf{Set} . \] To make sense of this we needed to show that we can take the 'product' of categories, and that every category has an 'opposite'. Now we're trying to understand \\(\mathcal{V}\\)-enriched profunctors \\(\Phi : \mathcal{X} \nrightarrow \mathcal{Y}\\), which are really just \\(\mathcal{V}\\)-enriched functors \[ \Phi : \mathcal{X}^{\text{op}} \times \mathcal{Y} \to \mathcal{V} .\] To make sense of this we need the same two constructions: the product and the opposite! (This is no coincidence: soon we'll see that every \\(\mathcal{V}\\)-enriched category \\(\mathcal{X}\\) has a hom-functor \\( \mathrm{hom} : \mathcal{X}^{\text{op}} \times \mathcal{X} \to \mathcal{V}\\), which we can think of as a profunctor.) So, first let's look at the product of enriched categories: **Theorem.** Suppose \\(\mathcal{V}\\) is a commutative monoidal poset. Then for any \\(\mathcal{V}\\)-enriched categories \\(\mathcal{X}\\) and \\(\mathcal{Y}\\), there is a \\(\mathcal{V}\\)-enriched category \\(\mathcal{X} \times \mathcal{Y}\\) for which: 1. An object is a pair \\( (x,y) \in \mathrm{Ob}(\mathcal{X}) \times \mathrm{Ob}(\mathcal{Y}) \\). 2. We define \[ (\mathcal{X} \times \mathcal{Y})((x,y), \, (x',y')) = \mathcal{X}(x,x') \otimes \mathcal{Y}(y,y') .\] **Proof.** We just need to check axioms a) and b) of an enriched category (see [Lecture 29](https://forum.azimuthproject.org/discussion/2121/lecture-29-chapter-2-enriched-categories/p1)): a) We need to check that for every object \\( (x,y) \\) of \\(\mathcal{X} \times \mathcal{Y}\\) we have \[ I \le (\mathcal{X} \times \mathcal{Y})((x,y), \, (x,y)) .\] By item 2 this means we need to show \[ I \le \mathcal{X}(x,x) \otimes \mathcal{Y}(y,y) .\] But since \\(\mathcal{X}\\) and \\(\mathcal{Y}\\) are enriched categories we know \[ I \le \mathcal{X}(x,x) \text{ and } I \le \mathcal{Y}(y,y) \] and tensoring these two inequalities gives us what we need. b) We need to check that for all objects \\( (x,y), (x',y'), (x'',y'') \\) of \\(\mathcal{X} \times \mathcal{Y}\\) we have \[ (\mathcal{X} \times \mathcal{Y})((x,y), \, (x',y')) \otimes (\mathcal{X} \times \mathcal{Y})((x',y'), \, (x'',y'')) \le (\mathcal{X} \times \mathcal{Y})((x,y), \, (x'',y'')) .\] This looks scary, but long division did too at first! Just relax and follow the rules. To get anywhere we need to rewrite this using item 2: \[ \mathcal{X}(x,x') \otimes \mathcal{Y}(y,y') \otimes \mathcal{X}(x',x'') \otimes \mathcal{Y}(y',y'') \le \mathcal{X}(x,x'') \otimes \mathcal{Y}(y,y'') . \qquad (\star) \] But since \\(\mathcal{X}\\) and \\(\mathcal{Y}\\) are enriched categories we know \[ \mathcal{X}(x,x') \otimes \mathcal{X}(x',x'') \le \mathcal{X}(x,x'') \] and \[ \mathcal{Y}(y,y') \otimes \mathcal{Y}(y',y'') \le \mathcal{Y}(y,y'') . \] Let's tensor these two inequalities and see if we get \\( (\star) \\). Here's what we get: \[ \mathcal{X}(x,x') \otimes \mathcal{X}(x',x'') \otimes \mathcal{Y}(y,y') \otimes \mathcal{Y}(y',y'') \le \mathcal{X}(x,x'') \otimes \mathcal{Y}(y,y'') .\] This is _almost_ \\( (\star) \\), but not quite. To get \\( (\star) \\) we need to switch two things in the middle of the left-hand side! But we can do that because \\(\mathcal{V}\\) is a _commutative_ monoidal poset. \\( \qquad \blacksquare \\) Next let's look at the opposite of an enriched category: **Theorem.** Suppose \\(\mathcal{V}\\) is a monoidal poset. Then for any \\(\mathcal{V}\\)-enriched category \\(\mathcal{X}\\) there is a \\(\mathcal{V}\\)-enriched category \\(\mathcal{X}^{\text{op}}\\), called the **opposite** of \\(\mathcal{X}\\), for which: 1. The objects of \\(\mathcal{X}^{\text{op}}\\) are the objects of \\(\mathcal{X}\\). 2. We define \[ \mathcal{X}^{\text{op}}(x,x') = \mathcal{X}(x',x) .\] **Proof.** Again we need to check [axioms a) and b) of an enriched category](https://forum.azimuthproject.org/discussion/2121/lecture-29-chapter-2-enriched-categories/p1). a) We need to check that for every object \\( x \\) of \\(\mathcal{X}^{\text{op}}\\) we have \[ I \le \mathcal{X}^{\text{op}}(x,x) . \] Using the definitions, this just says that for every object \\( x \\) of \\(\mathcal{X}\\) we have \[ I \le \mathcal{X}(x,x) . \] This is true because \\(\mathcal{X}\\) is an enriched category. b) We also need to check that for all objects \\(x,x',x'' \\) of \\(\mathcal{X}^{\text{op}} \\) we have \[ \mathcal{X}^{\text{op}} (x,x') \otimes \mathcal{X}^{\text{op}}(x',x'') \le \mathcal{X}^{\text{op}}(x,x'') . \] Using the definitions, this just says that for all objects \\(x,x',x'' \\) of \\(\mathcal{X}\\) we have \[ \mathcal{X}(x',x) \otimes \mathcal{X}(x'',x') \le \mathcal{X}(x'',x) . \] We can prove this as follows: \[ \mathcal{X}(x',x) \otimes \mathcal{X}(x'',x') = \mathcal{X}(x'',x') \otimes \mathcal{X}(x',x) \le \mathcal{X}(x'',x) .\] since \\(\mathcal{V}\\) is commutative and \\(\mathcal{X}\\) is an enriched category. \\( \qquad \blacksquare \\) Now we are ready to state the definition of an enriched profunctor! I gave a tentative definition back in [Lecture 60](https://forum.azimuthproject.org/discussion/2287/lecture-60-chapter-4-closed-monoidal-posets/p1), but we didn't really know what it meant, nor under which conditions it made sense. Now we do! **Definition.** Suppose \\(\mathcal{V}\\) is a closed commutative monoidal poset and \\(\mathcal{X},\mathcal{Y}\\) are \\(\mathcal{V}\\)-enriched categories. Then a \\(\mathcal{V}\\)-enriched profunctor \[ \Phi : \mathcal{X} \nrightarrow \mathcal{Y} \] is a \\(\mathcal{V}\\)-enriched functor \[ \Phi: \mathcal{X}^{\text{op}} \times \mathcal{Y} \to \mathcal{V} .\] There are lot of adjectives here: "closed commutative monoidal poset". They're all there for a reason. Luckily we've seen our friends \\(\mathbf{Bool}\\) and \\(\mathbf{Cost}\\) have all these nice properties - and so do many other examples, like the power set \\(P(X)\\) of any set \\(X\\). Alas, if we want to _compose_ \\(\mathcal{V}\\)-enriched profunctors we need \\(\mathcal{V}\\) to be even _nicer!_ From our work with feasibility relations we saw that composing profunctors is done using a kind of 'matrix multiplication'. For this to work, \\(\mathcal{V}\\) needs to be a 'quantale'. So, next time I'll talk about quantales. Luckily all the examples I just listed are quantales! Here's a puzzle to keep you happy until next time. It's important: **Puzzle 197.** Suppose \\(\mathcal{V}\\) is a closed commutative monoidal poset and \\(\mathcal{X}\\) is any \\(\mathcal{V}\\)-enriched category. Show that there is a \\(\mathcal{V}\\)-enriched functor, the **hom functor** \[ \mathrm{hom} \colon \mathcal{X}^{\text{op}} \times \mathcal{X} \to \mathcal{V} \] defined on any object \\( (x,x') \\) of \\(\mathcal{X}^{\text{op}} \times \mathcal{X} \\) by \[ \mathrm{hom}(x,x') = \mathcal{X}(x,x') .\] If you forget the definition of enriched functor, you can find it in [Lecture 32](https://forum.azimuthproject.org/discussion/2169/lecture-32-chapter-2-enriched-functors/p1). **[To read other lectures go here.](http://www.azimuthproject.org/azimuth/show/Applied+Category+Theory#Chapter_4)**