Christopher wrote:

> I think of them as relation like, because relations have exactly that same orientation but not direction.

Profunctors are indeed similar to relations, but they have more of a directionality than relations.

A relation between two sets

\[ R \colon X \nrightarrow Y \]

can be seen as a function

\[ R \colon X \times Y \to \mathbf{Bool} \]

where \\(R(x,y) = \texttt{true}\\) if and only if the relation _holds_ between \\(x\\) and \\(y\\).

A \\(\mathcal{V}\\)-enriched profunctor between two \\(\mathcal{V}\\)-enriched categories

\[ \Phi \colon \mathcal{X} \nrightarrow \mathcal{Y} \]

can be seen as an enriched functor

\[ \Phi \colon \mathcal{X}^{\text{op}} \times \mathcal{Y} \to \mathcal{V} .\]

Notice that 'op'. That makes a difference!

The difference is that a relation

\[ R \colon X \nrightarrow Y \]

can always be 'turned around' to give a relation going back the other way, called the **[transpose](https://en.wikipedia.org/wiki/Converse_relation)** and written

\[ R^\top \colon Y \nrightarrow X, \]

while a profunctor

\[ \Phi \colon \mathcal{X} \nrightarrow \mathcal{Y} \]

_cannot_ be turned around to give a profunctor from \\(\mathcal{Y}\\) to \\(\mathcal{X}\\)... only one from \\(\mathcal{Y}^{\text{op}}\\) to \\(\mathcal{X}^{\text{op}}\\).

If we think of a relation as a function

\[ R \colon X \times Y \to \mathbf{Bool} \]

then its transpose is the function

\[ R^\top \colon Y \times X \to \mathbf{Bool} \]

given by

\[ R^\top(y,x) = R(x,y) \]

It's just like the transpose of a matrix, and indeed it's good to visualize a relation as an \\(X \times Y\\)-shaped box of \\(\texttt{true}\\)s and \\(\texttt{false}\\)s.

If we think of an enriched profunctor as a enriched functor

\[ \Phi \colon \mathcal{X}^{\text{op}} \times \mathcal{Y} \to \mathcal{V} .\]

then its transpose is

\[ \Phi^\top \colon (\mathcal{Y}^{\text{op}})^{\text{op}} \times \mathcal{X}^\text{op} \to \mathcal{V} \]

given by

\[ \Phi^\top(y,x) = \Phi(x,y) \]

But note, this gives a profunctor

\[ \Phi^{\top} \colon \mathcal{X}^{\text{op}} \to \mathcal{Y}^{\text{op}} \]

So with profunctors, you have to 'flip them upside down as you turn them around'.

> I think of them as relation like, because relations have exactly that same orientation but not direction.

Profunctors are indeed similar to relations, but they have more of a directionality than relations.

A relation between two sets

\[ R \colon X \nrightarrow Y \]

can be seen as a function

\[ R \colon X \times Y \to \mathbf{Bool} \]

where \\(R(x,y) = \texttt{true}\\) if and only if the relation _holds_ between \\(x\\) and \\(y\\).

A \\(\mathcal{V}\\)-enriched profunctor between two \\(\mathcal{V}\\)-enriched categories

\[ \Phi \colon \mathcal{X} \nrightarrow \mathcal{Y} \]

can be seen as an enriched functor

\[ \Phi \colon \mathcal{X}^{\text{op}} \times \mathcal{Y} \to \mathcal{V} .\]

Notice that 'op'. That makes a difference!

The difference is that a relation

\[ R \colon X \nrightarrow Y \]

can always be 'turned around' to give a relation going back the other way, called the **[transpose](https://en.wikipedia.org/wiki/Converse_relation)** and written

\[ R^\top \colon Y \nrightarrow X, \]

while a profunctor

\[ \Phi \colon \mathcal{X} \nrightarrow \mathcal{Y} \]

_cannot_ be turned around to give a profunctor from \\(\mathcal{Y}\\) to \\(\mathcal{X}\\)... only one from \\(\mathcal{Y}^{\text{op}}\\) to \\(\mathcal{X}^{\text{op}}\\).

If we think of a relation as a function

\[ R \colon X \times Y \to \mathbf{Bool} \]

then its transpose is the function

\[ R^\top \colon Y \times X \to \mathbf{Bool} \]

given by

\[ R^\top(y,x) = R(x,y) \]

It's just like the transpose of a matrix, and indeed it's good to visualize a relation as an \\(X \times Y\\)-shaped box of \\(\texttt{true}\\)s and \\(\texttt{false}\\)s.

If we think of an enriched profunctor as a enriched functor

\[ \Phi \colon \mathcal{X}^{\text{op}} \times \mathcal{Y} \to \mathcal{V} .\]

then its transpose is

\[ \Phi^\top \colon (\mathcal{Y}^{\text{op}})^{\text{op}} \times \mathcal{X}^\text{op} \to \mathcal{V} \]

given by

\[ \Phi^\top(y,x) = \Phi(x,y) \]

But note, this gives a profunctor

\[ \Phi^{\top} \colon \mathcal{X}^{\text{op}} \to \mathcal{Y}^{\text{op}} \]

So with profunctors, you have to 'flip them upside down as you turn them around'.