January 26, 2025
I came across Category Theory when I was a fledgling assistant professor at Brown. One requirement of getting a PhD in mathematics is to take a course in Set Theory. If you held a gun to my head and told me to write down all the axioms of Zermelo-Frankel set theory, I would be a dead man. The simplicity of Category Theory was a revelation. I made the mistake of telling one of my colleagues about my interest and was shocked by his angry reply, “Category Theory doesn’t do anything. Stop wasting your time on it!”
Many people think math is abstract nonsence. Most mathematicians seem to regard Category Theory as generalized abstract nonsense. It is definitely something that is difficult to appreciate until you’ve learned a lot of mathematics. Samuel Eilenberg and Saunders Mac Lane invented it to unify common themes shared by many mathematical objects.
Category Theory involves objects and arrows from one object to another. The discipline of defining mathematical concepts using them clarifies classical definitions. One surprising result is that set membership cannot be defined using only objects and arrows.
I’m sure Sammy and Saunders had no idea that Category Theory would become the basis for modern functional programming languages. Classical logic casually uses and to quantify over propositions that are either true of false. It turns out it is sometimes not possilbe to write a computer program to determine this.
A truely astounding result is the Curry-Howard correspondence. Proofs using the axioms of Hilbert stye deduction for intuitional logic are the “same” as a the computational model of lambda calculus.
Math true false statemts caveats. !!!
“equal” is a problem
“equivaltent” is better
HOTT
Everything in classical mathematics is a set. Logicians are wont to say “the language of Set Theory is epsilon.” By that they mean the only additional symbol required in first-order logic to define the axioms for set membership is
The first attempt at defining modern Set Theory is due to Frege. He defined a set by giving a rule for membership. Bertrand Russell showed that entailed a contradiction. Let be the set of all sets where it is not the case , .
Exercise. Show implies and implies .
It was not easy to fix up Frege’s theory. This led to various schemes to axiomatize what a set is, e.g., Zermelo-Fraenkel, von Neumann. Their axioms are not the first thing you might think of.
A simple solution to this is to only define subsets of an existing set that satisfy a rule. For any set and a predicate on we can stay out of trouble by defining . A predicate is a function from elements of a set that returns either true or false.
A set is just a bag of things (elements) with no structure. Two sets are equal if they contain the same elements. Using epsilon and first order logic this is written if and only if
If then they have the same number of elements. A weaker notion is two sets have the same cardinality if they have the same number of elements. If and are infinite this becomes a bit tricky to define. The sets and are both infinite and clearly but . They have the same cardinality because we can associate with . The function defined by is one-to-on and onto.
If and are sets, their cartesian product is the set of all pairs . A relation is a subset . We write for . The left coset of is . The right coset of is .
A relation is a function if for every there exists a unique with . We can write instead of since is unique.
Exercise. A relation is a function if and only if the the right coset contains exactly one element of .
If is relation on that is a function we write . A function is one-to-one if implies . A function is onto if for every there exists with . An isomorphism is a function that is one-to-one and onto.
Two sets have the same cardinality if there is an isomorphism and we write .
Exercise. Show for every set .
Hint: Define by , the identity function.
Exercise. If a function is an isomorphism show there exists a function that is also an isomorphism.
Hint: Define by if and only if , the inverse function of .
This shows implies .
Exercise. _If and then .
Hint: The composition of isomorphisms is an isomorphism.
This shows cardinality is an equivalence relation on sets.
A relation is reflexive if for all . The diagonal of is the relation .
Exercise. Show is reflexive if and only if .
Exercise. Show is the identity function on .
If then its transpose is .
A relation is symmetric if and only if .
A relation is antisymmetric if and only if .
If and the composition is the set of all for which there exists with and .
A relation is transitive if and only if .
A relation is an equivalence relation if and only if it is reflective, symmetric, and transitive.
Exercise. If is an equivalence relation then for all .
Exercise. If is an equivalence relation then either or for .
Exercise. Show is a partition of .
Category theory uses objects and arrows instead of membership to express mathematical concepts.
Using Category Theory to define a set turned out to be problematic. It was not possible to recapture the notion of set membership. Topos Theory identified the concept of parameterized membership as a subobject classifier. Sometimes it is more natural to consider the points on a sphere as the unique tangent plane to the point.
The objects in category are sets and the arrows are functions from one set to another.
If is a set with one element (a singleton) then for every set there is a unique function from to the singleton set . Every is sent to .
Exercise. If is a set and for every set there exists a unique function from to then is a singleton.
We can define a singleton set using only objects and arrows. We cannot define epsilon using objects an arrows.
This is an example of a terminal object.
The cartesian product of sets and is . Selecting the left and right elements correspond to the functions and .
Note .
Exercise. If and there exists a unique function with $$
$$
Hint: .
This defines cartesian product using only objects and arrows.
What is the “sum” of two sets? We could define to be the union, but putting on our category theory glasses that turns out to be not quite right.
Reversing the arrows of the category definiton of product we are looking for functions and with the following property: if and then there exists a unique function with
We can define and by set inclusion. If and how do we define so and ?
If we can define and if we can define .
Exercise. If and then . If and then .
The problem is ensuring and on the intersection .
Computer science product and sum types.
Vector space V + W = V x W and V x W = L(V,W).
#A^B = #A^#B
We want #(A+B) = #A + #B