<h3>Quantum Computation</h3>
<p>One very interesting area is the application of various monoidal categories to quantum computation. Some could argue that this is also physics, but the work is done by people in computer science departments. An early paper in this area is <a href="http://arxiv.org/pdf/quant-ph/0402130" rel="noreferrer"><em>A categorical semantics of quantum protocols</em></a> by Samson Abramsky and Bob Coecke; many recent papers by <a href="http://www.comlab.ox.ac.uk/people/samson.abramsky/" rel="noreferrer">Abramsky</a> and <a href="http://www.comlab.ox.ac.uk/bob.coecke/" rel="noreferrer">Coecke</a> and others continue work in this direction.</p>
<p>In this body of work the quantum protocols are axiomatised as (certain kinds of) compact closed categories. Such categories have a beautiful graphical language in terms of string (and ribbon) diagrams. Equations in the category correspond to certain movements of the strings, such as straightening a tangled but not knotted string, which in turn correspond to something meaningful in quantum mechanics, such as a quantum teleportation.</p>
<p>The categorical approach offers a high level, logical view on what typically involves very low level calculations.</p>
<h3>Theory of Systems</h3>
<p><a href="http://www.cwi.nl/%7Ejanr/papers/files-of-papers/universal_coalgebra.pdf" rel="noreferrer">Coalgebra</a> has been used as a general framework to model systems (streams, automata, transition systems, probabilistic systems).
Its theory is rooted in category theory, being based on the notion of <a href="http://en.wikipedia.org/wiki/F-coalgebra" rel="noreferrer"><span class="math-container">$F$</span>-coalgebra</a>, where
<span class="math-container">$F$</span> is a functor that describes the structure of the transition system. Thus,
the kind of system changes with the underlying functor, but much of the theory, such
as the notion of bisimulation, is applicable for all functors.
Category theory also enables the <a href="http://eprints.ecs.soton.ac.uk/12612/" rel="noreferrer">modular construction of modal logics</a>
for reasoning about systems described as coalgebras.</p>
<h3>Graph Transformations</h3>
<p><a href="http://www.amazon.co.uk/Fundamentals-Algebraic-Transformation-Monographs-Theoretical/dp/3540311874/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1283624433&amp;sr=8-1" rel="noreferrer">Graph transformations</a> can be expressed quite nicely in the language of category theory.
This has found application, for example, in model transformation (as in UML models)
and other visual modelling formalisms. The approach takes place in the category of
graphs and graph homomorphisms. Firstly, a <em>pushout</em> can be seen as a gluing construction:
Given two graphs <span class="math-container">$G_1,G_2$</span>. A graph <span class="math-container">$P$</span> and two morphisms <span class="math-container">$e_1:P\to G_1$</span> and
<span class="math-container">$e_2:P\to G_2$</span> denote the parts the two graphs have in common. The pushout unifies these
parts, adding in the remaining parts of <span class="math-container">$G_1$</span> and <span class="math-container">$G_2$</span>, in effect, gluing <span class="math-container">$G_1$</span> and <span class="math-container">$G_2$</span>
together along <span class="math-container">$P$</span>.</p>
<p>A <em>double pushout</em> is used to describe a graph transformation.
The rule is represented by a tuple  <span class="math-container">$(L, K, R)$</span>, where <span class="math-container">$L$</span> denotes the precondition of the
rule, <span class="math-container">$R$</span> denotes the post condition of the rule, and <span class="math-container">$K$</span> denotes the part of the
graph to apply the rule to. There are maps from <span class="math-container">$l:K\to L$</span> and <span class="math-container">$r:K\to R$</span>, one
of which will be used to match a part of the original graph, the other to create
the resulting graph. <span class="math-container">$L\setminus K$</span> describes the part of the graph to be
deleted. <span class="math-container">$R\setminus K$</span> describes the the part to be created. A map <span class="math-container">$d$</span> from <span class="math-container">$K$</span>
into a <em>context</em> graph <span class="math-container">$D$</span> needs to be provided, and the pushout of <span class="math-container">$d$</span>  and the
map <span class="math-container">$l$</span> needs to equal the graph of interest <span class="math-container">$G$</span>.  The pushout of <span class="math-container">$d$</span> and <span class="math-container">$k$</span>
then gives the result of performing the transformation.</p>
<h3>Programming Languages (via MathOverflow)</h3>
<p>There have been plenty of applications of category theory in the design of programming
languages and programming language theory. Extensive answers can be found on MathOverflow. <a href="https://mathoverflow.net/questions/3721/programming-languages-based-on-category-theory">https://mathoverflow.net/questions/3721/programming-languages-based-on-category-theory</a>)
<a href="https://mathoverflow.net/questions/4235/relating-category-theory-to-programming-language-theory">https://mathoverflow.net/questions/4235/relating-category-theory-to-programming-language-theory</a>.</p>
<h3>Bigraphs -- Process Calculi</h3>
<p>Finally, there's Milner's <a href="http://www.amazon.co.uk/Space-Motion-Communicating-Agents/dp/0521738334/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1283624498&amp;sr=8-1" rel="noreferrer">bigraphs</a>, a general framework for describing and reasoning about
systems of interacting agents. It can be seen as a general framework for reasoning about
process algebras and their structural and behavioural theories. The approach is also based on
pushouts.</p>

CC BY-SA 3.0
2010-09-04T11:57:18.150Z
2013-04-02T05:02:59.277Z
2020-06-17T09:38:08.363Z
Dave Clarke
<blockquote>
  <p>I am already implicitly assuming there are no applications in Theory A found so far, but if you have some of those, that's even better for me!</p>
</blockquote>

<ul>
<li><p>My understanding is that Joyal's theory of species is used relatively widely in enumerative combinatorics, as a generalization of generating functions which additionally tell you how to permute things in addition to how many there are.</p></li>
<li><p>Pippenger has applied Stone duality to relate regular languages and varieties of semigroups.  Jeandel has introduced topological automata apply these ideas to give unified accounts (and proofs!) for quantum, probabilistic, and ordinary automata.</p></li>
<li><p>Roland Backhouse has given abstract characterizations of greedy algorithms by means of Galois connections with the tropical semiring. </p></li>
</ul>

<p>In a much more speculative vein, Noam mentioned sheaf models. These abstractly characterize the syntactic technique of logical relations, which is probably one of the most powerful techniques in semantics. We mostly use them to prove inexpressibility and consistency results, but it should be interesting for complexity theorists since it is a nice example of a practical non-natural (in the sense of Razborov/Rudich) proof technique. (However, logical relations are usually very carefully designed to <em>guarantee</em> that they relativize -- as language designers, we want to be able to assure programmers that function calls are black boxes!)</p>

<p>EDIT: I'll continue speculating, at Ryan's request. As I understand it, a natural proof is roughly one along the lines of trying to define an inductive invariant of the structure of a circuit, subject to various sensible conditions. Similar ideas are (unsurprisingly) pretty common in programming languages as well, when you try to define invariant maintained inductively by a lambda-calculus term (for instance, to prove type safety). 1</p>

<p>However, this technique often breaks down at higher (ie, function) types. For example, the simply-typed lambda calculus is total -- every program written in it terminates. However, straightforward attempts to prove this tend to founder on the problem of first-class functions: it's not enough to prove that every term of type $A \to B$ terminates. Since we can additionally apply arguments to functions, we not only need to ensure that every term of type $A \to B$ halts, we also need to ensure that this property holds "hereditarily" -- we also need to know that given any term of type $A$, the application will also halt. </p>

<p>This is what logical relations do. Instead of defining a single inductive invariant, we define a whole family of predicates by recursion over the structure of (typically) the type. Then, we prove that every definable term lies in the appropriate predicate, which lets us establish what we sought. So for termination, we would say that good values of base type are the values of base type, and the good values of type $A \to B$ are the values of this type which, given a good value of $A$, evaluates to a good value of $B$. Note that there is no single inductive invariant -- we define a whole family of invariants by recursion over the structure of the input, and use other means to show that all terms lie within these invariants. Proof-theoretically, this is a vastly stronger technique, and is why it lets you prove consistency results.</p>

<p>The connection to sheaves arises from the fact that we often need to reason about open terms (ie, terms with free variables), and so need to distinguish between getting stuck due to errors and getting stuck due to needing to reduce a variable. Sheaves arise from considering the reductions of the lambda calculus as defining the morphisms of a category whose terms are the objects (ie, the partial order induced by reduction), and then considering the functors from this category into sets (ie, predicates). Jean Gallier wrote some nice papers about this in the early 2000s, but I doubt they are readable unless you have already assimilated a fair amount of lambda calculus.</p>

CC BY-SA 3.0
2015-03-08T00:40:29.563Z
Re: Gallier, you mean the late '90s (as in http://www.sciencedirect.com/science/article/pii/0304397594002800 ?)
Blaisorblade
CC BY-SA 2.5
2010-09-04T18:41:18.887Z
Could you give a reference to the Backhouse paper?  He has several that mention "Galois connection" in the title, but a quick search didn't obviously reveal which one is about greedy algorithms (and I don't think I'm familiar enough with the area to wade through the details and figure out easily which one is "really" about greedy algorithms).  Thanks!
Joshua Grochow
CC BY-SA 2.5
2010-09-04T19:22:00.273Z
Along with Joshua's question, I'm also interested in how sheaf models and logical relations relate to natural proofs.
Ryan Williams
CC BY-SA 2.5
2010-09-05T10:44:09.093Z
Re: Stone duality, for more exciting recent work see Mai Gehrke's "Stone duality and the recognisable languages over an algebra" (http://www.math.ru.nl/~mgehrke/Ge09.pdf) and Gehrke, Grigorieff and Pin's "A topological approach to recognition" (http://www.math.ru.nl/~mgehrke/GGP10.pdf)
Noam Zeilberger
CC BY-SA 2.5
2010-09-04T14:10:48.080Z
2010-09-04T22:42:17.337Z
2010-09-04T22:42:17.337Z
Neel Krishnaswami
<p>There are many examples, the first one that comes to mind is <a href="http://homepages.inf.ed.ac.uk/als/">Alex Simpson</a>'s use of category theory to prove properties of programming languages, see e.g. "<a href="http://homepages.inf.ed.ac.uk/als/Research/cartinmist.pdf">Computational Adequacy for Recursive Types in Models of Intuitionistic Set Theory</a>", Annals of Pure and Applied Logic, 130:207-275, 2004. Even though the title mentions set theory the technique is category-theoretic. See Alex's home page for more examples.</p>

CC BY-SA 2.5
2010-09-04T17:21:34.473Z
Thanks for the refs, but please note that I did not ask: "what results were obtained by using category theory that could not be obtained otherwise?"
Ryan Williams
CC BY-SA 2.5
2010-09-04T20:15:46.633Z
True, you didn't. I edited my answer.
Andrej Bauer
CC BY-SA 2.5
2010-09-04T17:11:06.617Z
2010-09-04T20:16:14.933Z
2010-09-04T20:16:14.933Z
Andrej Bauer
<p>I think you are asking two questions about applicability, type A and type B separately.</p>

<p>As you note, there are many substantive applications of category theory to type B topics: semantics of programming languages (monads, cartesian closed categories), logic and provability (topoi, varieties of linear logic).</p>

<p>However, there seems to be little substantive applications to theory A (algorithms or complexity).</p>

<p>There are some uses in elementary objects, such as describing categories of automata or combinatorial objects (graphs, sequences, permutations, etc). But these don't seem to account for a deeper understanding of language theory or algorithms.</p>

<p>Speculatively, it could be a mismatch between the current strategies of category theory and theory A subjects:</p>

<ul>
<li><p>The central strategy of category theory is dealing with equality (when things are the same and when they are different and how they map to each other). </p></li>
<li><p>For complexity theory, the primary strategy is reductions and setting bounds (one would think a reduction is like an arrow, but I don't think anything beyond this superficial similarity has been studied). </p></li>
<li><p>For algorithms, there is no overarching strategy to it other than ad hoc clever combinatorial thinking. For certain domains, I'd expect there could be fruitful exploration (algorithms for algebras?) but I haven't seen it yet.</p></li>
</ul>

CC BY-SA 3.0
2012-07-23T05:56:40.367Z
it turns out that reductions are related to categorical reconstructions of Goedel's Dialectica interpretation and the semantics of linear logic. See Andreas Blass's "Questions and Answers -- A Category Arising in Linear Logic, Complexity Theory, and Set Theory". http://www.math.lsa.umich.edu/~ablass/qa.pdf
Neel Krishnaswami
CC BY-SA 3.0
2012-07-22T03:01:03.367Z
2017-11-19T13:20:53.297Z
2017-11-19T13:20:53.297Z
Mitch
<p>"TCS-A" applications that come to my mind are Joyal's combinatorial species (generalisations of power series to functors so as to describe combinatorial objects like trees, sets, multisets, etc) and the formalisation of cryptographic "game-hopping" using relational, probabilistic Hoare logic (Easycrypt, Certicrypt, Andreas Lochbihler's work). While categories do not directly appear in the latter they were instrumental in the development of the underlying logics (e.g. monads). </p>

<p>PS: Since my name was mentioned in the first answer: the use of fibrations of groupoids to show nonderivability of a certain axiom in Martin-Löf's type theory by Thomas Streicher and myself can also be considered a "solid" use of category theory (albeit in logic or "TCS-B"). </p>

CC BY-SA 3.0
2017-11-22T15:34:51.203Z
2017-11-22T15:34:51.203Z
Martin Hofmann
<p>The more recent book <a href="https://arxiv.org/abs/1803.05316" rel="noreferrer">Seven Sketches in Compositionality</a> lists several applications of category theory in computer science and engineering. Notable the chapter on databases where the authors describe querying, combining, migrating, and evolving databases based on a categorical model. The authors took this further and developed the <a href="https://www.categoricaldata.net/fql.html" rel="noreferrer">Categorical Query Language</a> (CQL) and an integrated development environment (IDE) based on their categorical model of databases.</p>

CC BY-SA 4.0
2019-05-08T09:06:53.447Z
2019-05-08T09:06:53.447Z
michid
<p>I can think of one instance where category theory was directly "applied" to solve an open problem in programming languages: Thorsten Altenkirch, Peter Dybjer, Martin Hofmann, and Phil Scott, <a href="http://www.cs.nott.ac.uk/~txa/publ/lics01.pdf">"Normalization by evaluation for typed lambda calculus with coproducts"</a>.  From their abstract: "We solve the decision problem for simply typed lambda calculus with strong binary sums, equivalently the word problem for free cartesian closed categories with binary coproducts. Our method is based on the semantical technique known as 'normalization by evaluation' and involves inverting the interpretation of the syntax into a suitable sheaf model and from this extracting appropriate unique normal forms."</p>

<p>In general, though, I think that category theory is not usually applied to prove deep theorems in programming languages (of which there aren't so many), but instead offers a conceptual framework that is often useful (for example in the above, the idea of (pre)sheaf semantics).</p>

<p>An important historical example is Eugenio Moggi's suggestion that the notion of <em>monad</em> (which is basic and ubiquitous in category theory) <a href="http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.79.733">could be used as part of a semantic explanation of side effects in programming languages</a> (e.g., state, nondeterminism).  This also inspired some reflection on the <em>syntax</em> of programming languages, for example leading directly to the <a href="http://www.haskell.org/tutorial/monads.html">"Monad typeclass"</a> in Haskell (used to encapsulate effects).</p>

<p>More recently (the past decade), this explanation of effects in terms of monads has been revisited from the point of view of the old connection (established by category theorists, in the 60s) between monads and algebraic theories: see Martin Hyland and John Power's, <a href="http://www.dpmms.cam.ac.uk/~martin/Research/Publications/2007/hp07.pdf">"The Category Theoretic Understanding of Universal Algebra: Lawvere Theories and Monads"</a>.  The idea is that the monadic view of effects is compatible with the (in some ways more appealing) algebraic view of effects, wherein effects (e.g., store) can be explained in terms of operations (e.g., "lookup" and "update") and associated equations (e.g., idempotency of update).  There is a recent paper building on this connection by Paul-André Melliès, <a href="http://www.pps.jussieu.fr/~mellies/papers/segal-lics-2010.pdf">"Segal condition meets computational effects"</a>, which also relies heavily on ideas coming from <a href="http://ncatlab.org/nlab/show/HomePage">"higher category theory"</a> (for example the notion of "Yoneda structure" as a way of organizing presheaf semantics).</p>

<p>Another, related class of examples comes from <a href="http://en.wikipedia.org/wiki/Linear_logic">linear logic</a>.  Soon after its introduction by Jean-Yves Girard in the 80s (with an aim of a better understanding of constructive logic), solid connections to category theory were established.  For some explanation of this connection, see John Baez and Mike Stay's, <a href="http://math.ucr.edu/home/baez/rosetta.pdf">"Physics, Topology, Logic and Computation: A Rosetta Stone"</a>.</p>

<p>Finally, this answer would be incomplete without reference to sigfpe's illuminating blog <a href="http://blog.sigfpe.com/">"A Neighborhood of infinity"</a>.  In particular you could check out <a href="http://blog.sigfpe.com/2010/03/partial-ordering-of-some-category.html">"A Partial Ordering of some Category Theory applied to Haskell"</a>.</p>

CC BY-SA 2.5
2010-09-04T14:54:56.527Z
Hi Noam, I think that after that excellent answer, your rep is high enough to add links !
Suresh Venkat
CC BY-SA 2.5
2010-09-04T16:58:08.360Z
I faced the same problem as a newbie. I just waited to get my answer voted up, then I put in the links. You could do the same...
Andrej Bauer
CC BY-SA 2.5
2010-09-04T17:16:27.510Z
Thanks! Sorry about the hyperlink restriction... wish there was some way to tell the system "yo, I'm Noam Zeilberger, I'm legit"
Ryan Williams
CC BY-SA 2.5
2010-09-05T10:14:57.713Z
added the links!  Yeah it's a totally reasonable policy, just gets in the way sometimes.
Noam Zeilberger
CC BY-SA 2.5
2010-09-04T11:43:04.667Z
2010-09-05T10:13:26.687Z
2010-09-05T10:13:26.687Z
Noam Zeilberger
<p>I've been learning a few bits of category theory. It certainly is a different way of looking at things. (Very rough summary for those who haven't seen it: category theory gives ways of expressing all kinds of mathematical behavior solely in terms of functional relationships between objects. For example, things like the Cartesian product of two sets are defined completely in terms of how other functions behave with it, not in terms of what elements are members of the set.) </p>

<p>I have some vague understanding that category theory is useful on the programming languages/logic (the "Theory B") side, and am wondering how much algorithms and complexity ("Theory A") could benefit. It might help me get off the ground though, if I know some solid applications of category theory in Theory B. (I am already implicitly assuming there are no applications in Theory A found so far, but if you have some of those, that's even better for me!) </p>

<p>By "solid application", I mean:</p>

<p>(1) The application depends so strongly on category theory that it's very difficult to achieve without using the machinery.</p>

<p>(2) The application invokes at least one non-trivial theorem of category theory (e.g. Yoneda's lemma).</p>

<p>It could well be that (1) implies (2), but I want to make sure these are "real" applications. </p>

<p>While I do have some "Theory B" background, it's been a while, so any de-jargonizing would be much appreciated.</p>

<p>(Depending on what kind of answers I get, I might turn this question into community wiki later. But I really want good applications with good explanations, so it seems a shame not to reward the answerer(s) with something.)</p>

<pl.programming-languages><lo.logic><ct.category-theory>
Solid applications of category theory in TCS?
Ryan Williams
# Solid applications of category theory in TCS?

(Asked by: username_0 on 2010-09-04)

I've been learning a few bits of category theory. It certainly is a different way of looking at things. (Very rough summary for those who haven't seen it: category theory gives ways of expressing all kinds of mathematical behavior solely in terms of functional relationships between objects. For example, things like the Cartesian product of two sets are defined completely in terms of how other functions behave with it, not in terms of what elements are members of the set.)

I have some vague understanding that category theory is useful on the programming languages/logic (the "Theory B") side, and am wondering how much algorithms and complexity ("Theory A") could benefit. It might help me get off the ground though, if I know some solid applications of category theory in Theory B. (I am already implicitly assuming there are no applications in Theory A found so far, but if you have some of those, that's even better for me!)

By "solid application", I mean:

(1) The application depends so strongly on category theory that it's very difficult to achieve without using the machinery.

(2) The application invokes at least one non-trivial theorem of category theory (e.g. Yoneda's lemma).

It could well be that (1) implies (2), but I want to make sure these are "real" applications.

While I do have some "Theory B" background, it's been a while, so any de-jargonizing would be much appreciated.

(Depending on what kind of answers I get, I might turn this question into community wiki later. But I really want good applications with good explanations, so it seems a shame not to reward the answerer(s) with something.)

**Tags:** pl.programming-languages, lo.logic, ct.category-theory

---

## 7 answers

### Answer by username_5 on 2010-09-04. Score: 91 | Accepted answer

I can think of one instance where category theory was directly "applied" to solve an open problem in programming languages: Thorsten Altenkirch, Peter Dybjer, Martin Hofmann, and Phil Scott, ["Normalization by evaluation for typed lambda calculus with coproducts"](http://www.cs.nott.ac.uk/~txa/publ/lics01.pdf). From their abstract: "We solve the decision problem for simply typed lambda calculus with strong binary sums, equivalently the word problem for free cartesian closed categories with binary coproducts. Our method is based on the semantical technique known as 'normalization by evaluation' and involves inverting the interpretation of the syntax into a suitable sheaf model and from this extracting appropriate unique normal forms."

In general, though, I think that category theory is not usually applied to prove deep theorems in programming languages (of which there aren't so many), but instead offers a conceptual framework that is often useful (for example in the above, the idea of (pre)sheaf semantics).

An important historical example is Eugenio Moggi's suggestion that the notion of *monad* (which is basic and ubiquitous in category theory) [could be used as part of a semantic explanation of side effects in programming languages](http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.79.733) (e.g., state, nondeterminism). This also inspired some reflection on the *syntax* of programming languages, for example leading directly to the ["Monad typeclass"](http://www.haskell.org/tutorial/monads.html) in Haskell (used to encapsulate effects).

More recently (the past decade), this explanation of effects in terms of monads has been revisited from the point of view of the old connection (established by category theorists, in the 60s) between monads and algebraic theories: see Martin Hyland and John Power's, ["The Category Theoretic Understanding of Universal Algebra: Lawvere Theories and Monads"](http://www.dpmms.cam.ac.uk/~martin/Research/Publications/2007/hp07.pdf). The idea is that the monadic view of effects is compatible with the (in some ways more appealing) algebraic view of effects, wherein effects (e.g., store) can be explained in terms of operations (e.g., "lookup" and "update") and associated equations (e.g., idempotency of update). There is a recent paper building on this connection by Paul-André Melliès, ["Segal condition meets computational effects"](http://www.pps.jussieu.fr/~mellies/papers/segal-lics-2010.pdf), which also relies heavily on ideas coming from ["higher category theory"](http://ncatlab.org/nlab/show/HomePage) (for example the notion of "Yoneda structure" as a way of organizing presheaf semantics).

Another, related class of examples comes from [linear logic](http://en.wikipedia.org/wiki/Linear_logic). Soon after its introduction by Jean-Yves Girard in the 80s (with an aim of a better understanding of constructive logic), solid connections to category theory were established. For some explanation of this connection, see John Baez and Mike Stay's, ["Physics, Topology, Logic and Computation: A Rosetta Stone"](http://math.ucr.edu/home/baez/rosetta.pdf).

Finally, this answer would be incomplete without reference to sigfpe's illuminating blog ["A Neighborhood of infinity"](http://blog.sigfpe.com/). In particular you could check out ["A Partial Ordering of some Category Theory applied to Haskell"](http://blog.sigfpe.com/2010/03/partial-ordering-of-some-category.html).

> **Comments:**
> **username_10**: Hi Noam, I think that after that excellent answer, your rep is high enough to add links !  
> **username_6**: I faced the same problem as a newbie. I just waited to get my answer voted up, then I put in the links. You could do the same...  
> **username_0**: Thanks! Sorry about the hyperlink restriction... wish there was some way to tell the system "yo, I'm Noam Zeilberger, I'm legit"  
> **username_5**: added the links!  Yeah it's a totally reasonable policy, just gets in the way sometimes.  

---

### Answer by username_1 on 2010-09-04. Score: 53

### Quantum Computation

One very interesting area is the application of various monoidal categories to quantum computation. Some could argue that this is also physics, but the work is done by people in computer science departments. An early paper in this area is [*A categorical semantics of quantum protocols*](http://arxiv.org/pdf/quant-ph/0402130) by Samson Abramsky and Bob Coecke; many recent papers by [Abramsky](http://www.comlab.ox.ac.uk/people/samson.abramsky/) and [Coecke](http://www.comlab.ox.ac.uk/bob.coecke/) and others continue work in this direction.

In this body of work the quantum protocols are axiomatised as (certain kinds of) compact closed categories. Such categories have a beautiful graphical language in terms of string (and ribbon) diagrams. Equations in the category correspond to certain movements of the strings, such as straightening a tangled but not knotted string, which in turn correspond to something meaningful in quantum mechanics, such as a quantum teleportation.

The categorical approach offers a high level, logical view on what typically involves very low level calculations.

### Theory of Systems

[Coalgebra](http://www.cwi.nl/%7Ejanr/papers/files-of-papers/universal_coalgebra.pdf) has been used as a general framework to model systems (streams, automata, transition systems, probabilistic systems).
Its theory is rooted in category theory, being based on the notion of [$F$-coalgebra](http://en.wikipedia.org/wiki/F-coalgebra), where
$F$ is a functor that describes the structure of the transition system. Thus,
the kind of system changes with the underlying functor, but much of the theory, such
as the notion of bisimulation, is applicable for all functors.
Category theory also enables the [modular construction of modal logics](http://eprints.ecs.soton.ac.uk/12612/)
for reasoning about systems described as coalgebras.

### Graph Transformations

[Graph transformations](http://www.amazon.co.uk/Fundamentals-Algebraic-Transformation-Monographs-Theoretical/dp/3540311874/ref=sr_1_1?ie=UTF8&s=books&qid=1283624433&sr=8-1) can be expressed quite nicely in the language of category theory.
This has found application, for example, in model transformation (as in UML models)
and other visual modelling formalisms. The approach takes place in the category of
graphs and graph homomorphisms. Firstly, a *pushout* can be seen as a gluing construction:
Given two graphs $G\_1,G\_2$. A graph $P$ and two morphisms $e\_1:P\to G\_1$ and
$e\_2:P\to G\_2$ denote the parts the two graphs have in common. The pushout unifies these
parts, adding in the remaining parts of $G\_1$ and $G\_2$, in effect, gluing $G\_1$ and $G\_2$
together along $P$.

A *double pushout* is used to describe a graph transformation.
The rule is represented by a tuple $(L, K, R)$, where $L$ denotes the precondition of the
rule, $R$ denotes the post condition of the rule, and $K$ denotes the part of the
graph to apply the rule to. There are maps from $l:K\to L$ and $r:K\to R$, one
of which will be used to match a part of the original graph, the other to create
the resulting graph. $L\setminus K$ describes the part of the graph to be
deleted. $R\setminus K$ describes the the part to be created. A map $d$ from $K$
into a *context* graph $D$ needs to be provided, and the pushout of $d$ and the
map $l$ needs to equal the graph of interest $G$. The pushout of $d$ and $k$
then gives the result of performing the transformation.

### Programming Languages (via MathOverflow)

There have been plenty of applications of category theory in the design of programming
languages and programming language theory. Extensive answers can be found on MathOverflow. <https://mathoverflow.net/questions/3721/programming-languages-based-on-category-theory>)
<https://mathoverflow.net/questions/4235/relating-category-theory-to-programming-language-theory>.

### Bigraphs -- Process Calculi

Finally, there's Milner's [bigraphs](http://www.amazon.co.uk/Space-Motion-Communicating-Agents/dp/0521738334/ref=sr_1_1?ie=UTF8&s=books&qid=1283624498&sr=8-1), a general framework for describing and reasoning about
systems of interacting agents. It can be seen as a general framework for reasoning about
process algebras and their structural and behavioural theories. The approach is also based on
pushouts.


---

### Answer by username_2 on 2010-09-04. Score: 36

> I am already implicitly assuming there are no applications in Theory A found so far, but if you have some of those, that's even better for me!

* My understanding is that Joyal's theory of species is used relatively widely in enumerative combinatorics, as a generalization of generating functions which additionally tell you how to permute things in addition to how many there are.
* Pippenger has applied Stone duality to relate regular languages and varieties of semigroups. Jeandel has introduced topological automata apply these ideas to give unified accounts (and proofs!) for quantum, probabilistic, and ordinary automata.
* Roland Backhouse has given abstract characterizations of greedy algorithms by means of Galois connections with the tropical semiring.

In a much more speculative vein, Noam mentioned sheaf models. These abstractly characterize the syntactic technique of logical relations, which is probably one of the most powerful techniques in semantics. We mostly use them to prove inexpressibility and consistency results, but it should be interesting for complexity theorists since it is a nice example of a practical non-natural (in the sense of Razborov/Rudich) proof technique. (However, logical relations are usually very carefully designed to *guarantee* that they relativize -- as language designers, we want to be able to assure programmers that function calls are black boxes!)

EDIT: I'll continue speculating, at Ryan's request. As I understand it, a natural proof is roughly one along the lines of trying to define an inductive invariant of the structure of a circuit, subject to various sensible conditions. Similar ideas are (unsurprisingly) pretty common in programming languages as well, when you try to define invariant maintained inductively by a lambda-calculus term (for instance, to prove type safety). 1

However, this technique often breaks down at higher (ie, function) types. For example, the simply-typed lambda calculus is total -- every program written in it terminates. However, straightforward attempts to prove this tend to founder on the problem of first-class functions: it's not enough to prove that every term of type $A \to B$ terminates. Since we can additionally apply arguments to functions, we not only need to ensure that every term of type $A \to B$ halts, we also need to ensure that this property holds "hereditarily" -- we also need to know that given any term of type $A$, the application will also halt.

This is what logical relations do. Instead of defining a single inductive invariant, we define a whole family of predicates by recursion over the structure of (typically) the type. Then, we prove that every definable term lies in the appropriate predicate, which lets us establish what we sought. So for termination, we would say that good values of base type are the values of base type, and the good values of type $A \to B$ are the values of this type which, given a good value of $A$, evaluates to a good value of $B$. Note that there is no single inductive invariant -- we define a whole family of invariants by recursion over the structure of the input, and use other means to show that all terms lie within these invariants. Proof-theoretically, this is a vastly stronger technique, and is why it lets you prove consistency results.

The connection to sheaves arises from the fact that we often need to reason about open terms (ie, terms with free variables), and so need to distinguish between getting stuck due to errors and getting stuck due to needing to reduce a variable. Sheaves arise from considering the reductions of the lambda calculus as defining the morphisms of a category whose terms are the objects (ie, the partial order induced by reduction), and then considering the functors from this category into sets (ie, predicates). Jean Gallier wrote some nice papers about this in the early 2000s, but I doubt they are readable unless you have already assimilated a fair amount of lambda calculus.

> **Comments:**
> **username_4**: Could you give a reference to the Backhouse paper?  He has several that mention "Galois connection" in the title, but a quick search didn't obviously reveal which one is about greedy algorithms (and I don't think I'm familiar enough with the area to wade through the details and figure out easily which one is "really" about greedy algorithms).  Thanks!  
> **username_0**: Along with Joshua's question, I'm also interested in how sheaf models and logical relations relate to natural proofs.  
> **username_5**: Re: Stone duality, for more exciting recent work see Mai Gehrke's "Stone duality and the recognisable languages over an algebra" (http://www.math.ru.nl/~mgehrke/Ge09.pdf) and Gehrke, Grigorieff and Pin's "A topological approach to recognition" (http://www.math.ru.nl/~mgehrke/GGP10.pdf)  
> **username_3**: Re: Gallier, you mean the late '90s (as in http://www.sciencedirect.com/science/article/pii/0304397594002800 ?)  

---

### Answer by username_6 on 2010-09-04. Score: 26

There are many examples, the first one that comes to mind is [Alex Simpson](http://homepages.inf.ed.ac.uk/als/)'s use of category theory to prove properties of programming languages, see e.g. "[Computational Adequacy for Recursive Types in Models of Intuitionistic Set Theory](http://homepages.inf.ed.ac.uk/als/Research/cartinmist.pdf)", Annals of Pure and Applied Logic, 130:207-275, 2004. Even though the title mentions set theory the technique is category-theoretic. See Alex's home page for more examples.

> **Comments:**
> **username_0**: Thanks for the refs, but please note that I did not ask: "what results were obtained by using category theory that could not be obtained otherwise?"  
> **username_6**: True, you didn't. I edited my answer.  

---

### Answer by username_7 on 2012-07-22. Score: 12

I think you are asking two questions about applicability, type A and type B separately.

As you note, there are many substantive applications of category theory to type B topics: semantics of programming languages (monads, cartesian closed categories), logic and provability (topoi, varieties of linear logic).

However, there seems to be little substantive applications to theory A (algorithms or complexity).

There are some uses in elementary objects, such as describing categories of automata or combinatorial objects (graphs, sequences, permutations, etc). But these don't seem to account for a deeper understanding of language theory or algorithms.

Speculatively, it could be a mismatch between the current strategies of category theory and theory A subjects:

* The central strategy of category theory is dealing with equality (when things are the same and when they are different and how they map to each other).
* For complexity theory, the primary strategy is reductions and setting bounds (one would think a reduction is like an arrow, but I don't think anything beyond this superficial similarity has been studied).
* For algorithms, there is no overarching strategy to it other than ad hoc clever combinatorial thinking. For certain domains, I'd expect there could be fruitful exploration (algorithms for algebras?) but I haven't seen it yet.

> **Comments:**
> **username_2**: it turns out that reductions are related to categorical reconstructions of Goedel's Dialectica interpretation and the semantics of linear logic. See Andreas Blass's "Questions and Answers -- A Category Arising in Linear Logic, Complexity Theory, and Set Theory". http://www.math.lsa.umich.edu/~ablass/qa.pdf  

---

### Answer by username_8 on 2017-11-22. Score: 6

"TCS-A" applications that come to my mind are Joyal's combinatorial species (generalisations of power series to functors so as to describe combinatorial objects like trees, sets, multisets, etc) and the formalisation of cryptographic "game-hopping" using relational, probabilistic Hoare logic (Easycrypt, Certicrypt, Andreas Lochbihler's work). While categories do not directly appear in the latter they were instrumental in the development of the underlying logics (e.g. monads).

PS: Since my name was mentioned in the first answer: the use of fibrations of groupoids to show nonderivability of a certain axiom in Martin-Löf's type theory by Thomas Streicher and myself can also be considered a "solid" use of category theory (albeit in logic or "TCS-B").


---

### Answer by username_9 on 2019-05-08. Score: 5

The more recent book [Seven Sketches in Compositionality](https://arxiv.org/abs/1803.05316) lists several applications of category theory in computer science and engineering. Notable the chapter on databases where the authors describe querying, combining, migrating, and evolving databases based on a categorical model. The authors took this further and developed the [Categorical Query Language](https://www.categoricaldata.net/fql.html) (CQL) and an integrated development environment (IDE) based on their categorical model of databases.


---

