# Introductions to Category Theory

Category Theory (opens new window) was invented by mathematicians Samuel Eilenberg (opens new window) and Saunders Mac Lane (opens new window) in the early 1940ies "in their study of algebraic topology, with the goal of understanding the processes that preserve mathematical structure". It was initially mostly of interst to Mathematicians who used it to find patterns and translations between various areas of mathematics. As a result the examples of Categories given were those of interest to people with enough understanding of Mathematics to be interested in seeing patterns between the different areas.

As computing grew, it was found that the same tools could be used in programming, and then also in wider areas of practical interest. As we are interested in Categories related to the Web, we will look at introductions that are closer to computing. It turns out that the when Cats is explained with examples from a domain the learner understands it is not that difficult to learn.

# Video introductions

Learning Category theory means getting a feeling as to how one speaks about it, and how it is used. This often involves drawing diagrams. It helps to see those being drawn as this brings the diagrams to life.

# The MIT 2020 Lectures: Programming with Categories

This series of lectures (course material (opens new window)) brings together Mathematicians David Spivak, Brendan Fong and Programmer/ex Physicist Bartosz Milewski, to explain Category Theory's application to programming.

  • In Lecture 1, David Spivak explains what a Category is, with intutions coming from Sets (though no prior knowledge is required), and ends with the definition of a Category.
  • In Lecture 2, Brendan Fong illustrates the definition with categories with 1 and 2 objects, pre orders, Monoids, some ways to think about isomorphism and why these capture a concept of structure. The lambda calculus is quickly introduced and its correspondence with Haskell is shown. (A nice intro to Haskell if you want to dig deeper is Learn You a Haskell for Great Good! (opens new window))
  • In Lecture 3, Bartosz Milewski, moves from untyped lambda calculus to typed calculus, showing how simple it is to write generic function composition in Haskell, and finishes with morphisms between categories known as functors

# Further Material

The Programming with Categories Home Page (opens new window) lists further resources. Especially useful is

# Databases with Categories

As mentioned above, learning about categories using examples familiar to one, helps make the ideas much easier to understand. Databases are one of the most widely used applications of computers. Below are some of the papers that really make clear how close Category Theory is to databases.

The first goal is to present a straightforward category-theoretic model of databases under which every theorem about small categories becomes a theorem about databases It proceeds to show this using concepts of categories, functors and natural transformations, clarifying the import of those concepts by doing so.

The above papers do consider the semantic web standards, since these are designed to turn the Web into a decentralised Database. But Evan Patterson's 2017 paper Knowledge Representation in Bicategories of Relations (opens new window) shows how one can get much closer to the RDF and OWL standards by moving from the Category of Sets to the Category Rel of Sets and Relations.

See also our list of papers on the Semantic Web.

# Object Oriented Programming

Most programming languages in use are now Object Oriented, from Java, JavaScript, Python, to Scala (opens new window) which is a hybrid. Interestingly enough the best modelling of Object Oriented programming is as coalgebras, which emphasises observability over construction, statefullness and processuality. For those who have worked a lot in Object Oriented spaces the following papers will also be helpful.