Category Theory

I like to dive into something new every Winter holiday.  I usually dive into some area that I may have touched on in the past but did not have the time to linger and learn.

This year, I have started learning something about category theory.   This is a branch of mathematics that addresses some of the ways that mathematical structures may be described and formalized in an abstract setting that is useful for analogy and comparison.  Category theory enables ideas that apply to different mathematical fields or sub-fields to be related together by identifying certain structures as instances of categories and then related through functors.  (I will not here be providing all of the mathematical machinery, but merely characterizing what this is all about.)  Category theory appeals directly to my interdisciplinary instincts.

Category came about in the 1940s as a way of relating some ideas found in topology and algebra.  From the 1800s until that point, set theory was viewed as the foundation upon which all mathematical ideas (including logic) could be built.  It was shown that sets are an example (albeit important and beautiful) of a category.  Category theory had its successes but also has usually been presented as something that is abstract and esoteric.  For the most part, category theory is introduced to graduate-level math students.

Category theory has had impact in computer science.  The Haskell language, a functional language with a sophisticated type system, is a prime example of how programming constructs can be related to category theory, and particularly to monads.  Monads are functors from a category to the same category.  As a close approximation to the truth, in programmer-speak, I can say (recursively) that “a monad is an object whose methods return a monad”.  To really be a monad, the object must adhere to the “monad laws” which I won’t go into here.

Now, for practical purposes, we can look to a common use case, namely jQuery objects.  It is common to chain the methods that jQuery provides together, operating on a selected set of DOM elements.  Chaining makes things clearer in code:


In addition, code typically uses tests to select a branch for alternative operations on a monad.  For example, we might have a tree displayed where we set the color (the class) to a particular value for a selected path.

I have found that many of the discussions of category theory and monads that are aimed at programmers are confusing or wrong.  There also is plenty of disagreement over whether a given explanation is correct or not.  I’m not interested in throwing myself into these debates but they did motivate me to explore and learn some category theory.

I have been reading and working through the book written by David Spivak that is available as the text for MIT open courseware 18.S996 (  This is a graduate-level offering called “Category Theory for Scientists” and as the name implies, it is aimed not at mathematicians but to people in the sciences interested in understanding and formalizing scientific models.

This is a pretty rigorous course (at H-level) and it has had me reaching for my undergraduate modern algebra text a few times (I. N. Herstein’s Topics in Algebra). I’m not yet all the way through, but it has been a great experience. However, there is an aspect to the course that does not sit well with me.  Spivak has his own invention – a category plus some interpretation rules that he calls “ologs” that he uses to formalize scientific or folk models.  These are directed graphs that are essentially what an AI person recognizes as semantic nets.  There is a huge literature on semantic nets that goes back decades (for a book length treatment, J. F. Sowa’s Conceptual Structures with a copyright of 1984). 

I think it is fine for Spivak to introduce ologs as a bridge between scientific models and category theory, but it should be noted that ologs are an island in a very big ocean of knowledge representation formalisms and work on natural language semantics.  Their biggest utility, in my mind is to root some of the very abstract ideas of category theory in formal but familiar scientific models.