It looks like you're new here. If you want to get involved, click one of these buttons!

- All Categories 2.2K
- Applied Category Theory Course 338
- Applied Category Theory Exercises 149
- Applied Category Theory Discussion Groups 48
- Applied Category Theory Formula Examples 15
- Chat 470
- Azimuth Code Project 107
- News and Information 145
- Azimuth Blog 148
- Azimuth Forum 29
- Azimuth Project 190
- - Strategy 109
- - Conventions and Policies 21
- - Questions 43
- Azimuth Wiki 707
- - Latest Changes 699
- - - Action 14
- - - Biodiversity 8
- - - Books 2
- - - Carbon 9
- - - Computational methods 38
- - - Climate 53
- - - Earth science 23
- - - Ecology 43
- - - Energy 29
- - - Experiments 30
- - - Geoengineering 0
- - - Mathematical methods 69
- - - Meta 9
- - - Methodology 16
- - - Natural resources 7
- - - Oceans 4
- - - Organizations 34
- - - People 6
- - - Publishing 4
- - - Reports 3
- - - Software 20
- - - Statistical methods 2
- - - Sustainability 4
- - - Things to do 2
- - - Visualisation 1
- General 38

Options

Let's review our progress, and try to put all the pieces of this course together in a neat package.

We started by returning to a major theme of Chapter 2: enriched categories. We saw that enriched functors between these were just a special case of something more flexible: enriched profunctors. We saw some concrete applications of these, but also their important theoretical role.

Simply put: moving from functors to profunctors is completely analogous to moving from functions to *matrices!* Thus, introducing profunctors gives category theory some of the advantages of *linear algebra*.

Recall: a function between sets

$$ f \colon X \to Y $$ can be seen as a special kind of \(X \times Y\)-shaped matrix

$$ \phi \colon X \times Y \to \mathbb{R} $$ namely one where the matrix entry \(\phi(x,y) \) is \(1\) if \(y = f(x)\), and \(0\) otherwise. In short:

$$ \phi(x,y) = \delta_{f(x), y} $$
where \(\delta\) is the Kronecker delta. Composing functions then turns out to be a special case of multiplying matrices. Here I'm using \(\mathbb{R}\) because most of you have seen matrices of real numbers, but we could equally well use \(\mathbf{Bool} = \lbrace \texttt{true}, \texttt{false} \rbrace \), and get matrices of truth values, which are just *relations*. Matrix multiplication has the usual composition of relations as a special case!

Similarly, a \(\mathcal{V}\)-enriched functor

$$ F \colon \mathcal{X} \to \mathcal{Y} $$ can be seen a special kind of \(\mathcal{V}\)-enriched profunctor

$$ \Phi \colon \mathcal{X}^{\text{op}} \times \mathcal{Y} \to \mathcal{V} $$ namely the 'companion' of \(F\), given by

$$ \Phi(x,y) = \mathcal{V}(F(x), y) .$$ This is a fancier relative of the Kronecker delta! For matrices of booleans \( \delta_{f(x), y} = \texttt{true}\) iff \(f(x) = y\), but \( \mathcal{V}(F(x), y) = \texttt{true}\) iff \(f(x) \le y \).

The analogy is completed by this fact: the formula for composing enriched profunctors is really just matrix multiplication written with less familiar symbols:

$$ (\Psi\Phi)(x,z) = \bigvee_{y \in \mathrm{Ob}(\mathcal{Y})} \Phi(x,y) \otimes \Psi(y,z). $$ Here \(\bigvee\) plays the role of a sum and \(\otimes\) plays the role of multiplication.

To clarify this analogy, we studied the category \(\mathbf{Prof}_\mathcal{V}\) with

- \(\mathcal{V}\)-enriched categories as objects

and

- \(\mathcal{V}\)-enriched profunctors as morphisms.

We saw that it was a compact closed category. This means that you can work with morphisms in this category using string diagrams, and you can bend the strings around using caps and cups. In short, \(\mathcal{V}\)-enriched profunctors are like circuits made of components connected by flexible pieces of wire, which we can stick together to form larger circuits.

And while you may not have learned it in your linear algebra class, this 'flexibility' is exactly one of the advantages of linear algebra! For any field \(k\) (for example the real numbers \(\mathbb{R}\)) there is a category \(\mathbf{FinVect}_k\) with

- finite-dimensional vector spaces over \(k\) as objects

and

- linear maps as morphisms.

This category is actually equivalent to the category with finite sets as objects and \(k\)-valued matrices as morphisms, where we compose matrices by matrix multiplication. And like \(\mathbf{Prof}_\mathcal{V}\), the category \(\mathbf{FinVect}_k\) is compact closed, as I mentioned last time. So, while a *function between sets* has a rigidly defined 'input' and 'output' (i.e. domain and codomain), a *linear map between finite-dimensional vector spaces* can be 'bent' or 'turned around' in various ways - as you may have first seen when you learned about the transpose of a matrix.

There's one other piece of this story whose full significance I haven't quite explained yet.

We've seen pairs of adjoint functors, and we've seen 'duals' in compact closed categories. In fact they're closely related! There is a general concept of adjunction that has both of these as special cases! And adjunctions give something all you functional programmers have probably been wishing I'd talk about all along: monads. So I'll try to explain this next time.

## Comments

Very interesting..thanks

`Very interesting..thanks`

John wrote:

How do k-valued matrices act on finite sets?

`John wrote: >This category is actually equivalent to the category with finite sets as objects and k k-valued matrices as morphisms How do k-valued matrices act on finite sets?`

Coincidentally I came across some very useful notes from John on "groupoidification" the other day which spells out this profunctors = matrices thing in more detail. Unfortunately they are sitting on the math.ucr.edu server, which is still kaput, but the URL is here should it ever come back to life: http://www.math.ucr.edu/home/baez/groupoidification/

`Coincidentally I came across some very useful notes from John on "groupoidification" the other day which spells out this profunctors = matrices thing in more detail. Unfortunately they are sitting on the math.ucr.edu server, which is still kaput, but the URL is here should it ever come back to life: http://www.math.ucr.edu/home/baez/groupoidification/`

One can use the Wayback Machine to access an archive of the URL: https://web.archive.org/web/20180519002806/http://www.math.ucr.edu/home/baez/groupoidification/

`> Unfortunately they are sitting on the math.ucr.edu server, which is still kaput, but the URL is here should it ever come back to life: http://www.math.ucr.edu/home/baez/groupoidification/ One can use the Wayback Machine to access an archive of the URL: https://web.archive.org/web/20180519002806/http://www.math.ucr.edu/home/baez/groupoidification/`

Interest stirred up!

`> We've seen pairs of adjoint functors, and we've seen 'duals' in compact closed categories. In fact they're closely related! There is a general concept of adjunction that has both of these as special cases! Interest stirred up!`

Okay, one thing I keep noticing is that in these "richer" "spaces" (especially in CS applications) its often much more natural to define division then subtraction. So I guess I am asking, is there a theory of "division rigs", or "positive fields"?

`Okay, one thing I keep noticing is that in these "richer" "spaces" (especially in CS applications) its often much more natural to define division then subtraction. So I guess I am asking, is there a theory of "division rigs", or "positive fields"?`

"(Exercise: check that the cardinality of the groupoid of finite sets is e = 2.718281828... If you get stuck, read "week147".)"

Ah! That's why the species of bags (aka finite multisets) is the taylor series of e^x.

`"(Exercise: check that the cardinality of the groupoid of finite sets is e = 2.718281828... If you get stuck, read "week147".)" Ah! That's why the species of bags (aka finite multisets) is the taylor series of e^x.`