
How category theory is applied - furcyd
https://www.johndcook.com/blog/2019/04/29/how-category-theory-is-applied/
======
bcheung
It is difficult to come up with concrete examples of category theory because
it is too high up the abstraction hierarchy. It normally requires stepping
through several layers of abstraction to reach something concrete.

Monads are one specific application of category theory.

Of course monads in and of themselves are still very abstract, so we need to
drill down to another level of concreteness by taking a look at the "Maybe",
"Either", or "IO" monads.

This is still very abstract so we can drill down to another level to "does the
data exist", "is there an error", and "how do I handle IO"?

Category theory is a toolbox of mental representations useful for reasoning
about a particular problem set (designing formal systems that let you design
formal systems). In other words, category theory is an abstract concept for
solving a slightly less abstract set of problems.

Asking for concrete examples doesn't really make sense because it is too far
up the abstraction hierarchy.

To make the case for the importance of category theory, it is necessary to
present the entire abstraction hierarchy across a number of different real
world domains. This is not something academia is good at because it tends to
isolate and subdivide work into increasingly specialized fields.

------
twic
Gives three examples of bits of mathematics with really strong concrete uses.

Then says that category theory "does not itself solve hard problems in
topology or algebra. It clears away tangled multitudes of individually trivial
problems. It puts the hard problems in clear relief and makes their solution
possible.".

And doesn't give any examples.

Still sounds useless to me.

~~~
ironSkillet
I agree, the article does not actually present anything concrete. For me, the
usefulness of category theory is in providing a simplifying and high level set
of abstractions that can serve to illuminate the structural essence of a
problem domain. At first, I thought it was just abstract nonsense (and this is
coming from someone who has a PhD in mathematics), but after playing around
with it a bit, I've started to appreciate the power of the concepts.

The most interesting "application" of category theory that I've seen (as it
relates to software engineering) is the connection between databases and
category theory, e.g at
[https://johncarlosbaez.wordpress.com/2018/06/06/applied-
cate...](https://johncarlosbaez.wordpress.com/2018/06/06/applied-category-
theory-course-databases/). In short, relational schemas are categories, and
common data migration operations can very naturally can be described in the
language of category theory (functors, pullbacks etc).

~~~
twic
> The most interesting "application" of category theory that I've seen (as it
> relates to software engineering) is the connection between databases and
> category theory

So is this application _productive_? It's nice to be able to describe
something that already exists in terms of category theory, and even nicer if
those descriptions are concise and satisfying. But does that description
enable anything new? Did we get any new migration operations, normal forms,
etc?

~~~
wisnesky
Yes, for example the dual of join (called 'sigma'), which only exists for
databases in categorical normal form. There are many academic papers and an
open-source project ('categorical query language') here:
[http://www.categoricaldata.net](http://www.categoricaldata.net).

~~~
twic
Sounds interesting! I had a look, but couldn't find out what sigma does. This
is not quite the same level as, say, the PostgreSQL documentation:

[http://www.categoricaldata.net/help/instancesigma.html](http://www.categoricaldata.net/help/instancesigma.html)

Is there somewhere i can go for a worked example of using sigma?

~~~
wisnesky
Sure, here is an example that uses sigma to compute an equivalence relation:

[http://cql.conexus.ai/quotient.php](http://cql.conexus.ai/quotient.php)

------
pizza
Very interesting. Somewhat ironically, I think I would understand the article
better with some examples of actual transformations/applications of category
theory in original problem domains.

~~~
fspeech
Category theory basically reshaped the language (and methodology, in some
sense) of large swaths of modern mathematics. So it s applied more like the
set theory, as a foundation. But it’s hard to explain to people not steeped in
the subject.

~~~
sl8r
Although, to play devil's advocate, you can prove results with set theory that
you'd care about even if you weren't super interested in foundations, usually
by playing with different cardinalities. E.g.:

Call a real number "algebraic" if it's a zero to some polynomial with rational
coefficients. (e.g. \sqrt{2} is algebraic since it's a zero for x^2 - 2).
Claim: There exist non-algebraic ("transcendental") numbers. Proof: There are
only countably many polynomials, and so there are only countably many
algebraic numbers, but there are uncountably many reals. Similarly, there are
numbers that aren't Turning-computable. Etc.

~~~
fspeech
If you write out your statements encoded in say ZFC no one would recognize
what you are saying. Sometimes the concept of sets and set relationships fit
our needs exactly. Other times we build more user friendly concepts on top of
set theory like an API. Categorial constructions are also everywhere whether
one recognizes them or not.

------
stared
"but it’s not often applied so directly"

I beg to differ. While quantum mechanics is linear algebra with a lot of
tensor structure. The language of deep learning is linear algebra (plus non-
linearities). Often in machine learning one use lin alg pretty much directly:
linear regression, SVD, etc.

------
varjag
post-hoc

