David asked me to explain what I'm up to. Here's a quick sketch.

We all know that life doesn't violate the 2nd law of thermodynamics, because the 2nd law says that entropy increases _in a closed system_, but the Earth is not a closed system: we're powered by the Sun. So, the Earth doesn't go to equilibrium: instead, life figure out how to exploit sunlight and build beautiful ordered structures.

But the details still need to be understood. And it's not just a matter of understanding the details of one particular case; there's a quite general pattern that systems out of equilibrium evolve organized structures that exploit the flow of 'free energy' (in the technical sense) through that system.

Ilya Prigogine won the Nobel prize for his work on this; he's written lots of [pop books](http://www.amazon.com/gp/product/0553343637/ref=cm_cr_dpvoterdr) and also technical books about it, and lots of other people have worked on these issues. So it's not as if this is unexplored territory! Anyone who wants to work on these issues has a lot to learn... and that includes me.

Nonetheless, I feel I have a certain edge over other people. (Feynman said that to succeed in research, it helps to feel you have an "inside track", or "edge" - some insight or trick up your sleeve that nobody else has. It's true.)

Part of this edge is category theory. Category theory lets us formalize the idea of networks, and flows through networks, in a very general way that can be tailored to whatever circumstances we're interested in.

In particular, my student Brendan Fong wrote a paper that provides general tools for building categories where the morphisms are networks:

* Brendan Fong, [Decorated cospans](http://www.tac.mta.ca/tac/volumes/30/33/30-33.pdf).

We used this to "black-box" passive linear networks, like circuits made of resistors, inductors and capacitors, obtaining their external behavior. The key was to take advantage of the principle of minimum power:

* John Baez and Brendan Fong, [A compositional framework for passive linear networks](http://arxiv.org/abs/1504.05625).

With my student Blake Pollard we have just finished generalizing this work to detailed balanced Markov processes - the random processes to which thermodynamic concepts like "temperature" and "free energy" apply:

* John Baez, Brendan Fong and Blake Pollard, [A compositional framework for Markov processes](http://math.ucr.edu/home/baez/markov.pdf).

In parallel, Blake has found a generalization of the 2nd law that applies to open systems:

* Blake Pollard, [A Second Law for open Markov processes](http://arxiv.org/abs/1410.6531).

The next step is to:

1) work out the connection to thermodynamics in much more detail, and

2) apply this framework to chemical reaction networks, or equivalently, stochastic Petri nets.

The type of thing we expect to explain is how, for example, a cell in your body carries out chemical reactions in _cycles_, driven by the flow of free energy through that cell. In some sense people already understand the basic idea - but they don't have a sufficiently precise and general language to talk about these things.