Category Theory For Dummies
Category Theory For Dummies
Category Theory For Dummies
James Cheney
Outline
Categories: Why are they interesting?
Category theory
An abstract theory of structured things and structure preserving function-like things. Independent of the concrete representation of the things and functions. An alternative foundation for mathematics? (Lawvere) Closely connected with computation, types and logic. Forbiddingly complex notation for even simple ideas.
4
but does not necessarily help understand the things being studied (and may get in the way).
What is a category?
Some structures
Sets A
10
Composition
Functions are closed under composition (when domain and range match) I.E., if f : A B and g : B C then g f : A C is a function too. For sets g f = {(x, g(f (x))) | x A}. For matrices g f = g f (matrix multiply). For ML-terms, g f = x : A.g(f (x)).
11
Identity
For every structure A, there is an identity function, lets write it idA : A A.
12
Facts
Composition is associative: h (g f ) = (h g) f
13
Surprise!
You now know the denition of a category C = (C, , id, ) 1. C is a collection of objects. 2. If A, B are in C, then A B is a collection of arrows f from A to B. 3. idA : A A and whenever f : A B, g : B C, then g f : A C. 4. is associative, and idA is a unit with respect to . Note: Objects and arrows can be anything.
14
Diagrams
Equations can be expressed using commutative diagrams:
A g o f f g B h o g f A id A f A f
id B
Idea: every pair of paths with same source and target are equal.
15
Examples
Set is the category of sets and set functions.
These examples are misleading: They all have more in common than just the category structure.
16
Numbers as categories
0 is a category. Its empty.
1 is a category:
0 id 0
2 is a category, etc:
id 0 0 1 id 1
17
In fact, a monoid is basically a category with one object. It has one object M , and each element x M is an arrow x:M M idM = is a unit, x y = x y is associative
Lesson: Objects are not always really sets, and arrows not always really functions.
So what works in Set doesnt necessarily work in all categories. Not even close.
19
Categorical properties
20
Categorical properties
A categorical property is something that can be dened in the language of category theory
Inverses
Having an inverse is one of the most basic properties of functions. In C, f : A B has an inverse g : B A if f g = idA
A id A A f g f
g f = idB
B id B B
22
Isomorphism
Invertible functions are called isomorphisms, and A, B are isomorphic (A = B) if there is an isomorphism in A B (or vice versa). In Set, A = B if |A| = |B|. In Vec, V = W if dim(V ) = dim(W ).
Category theorists love proving that two very dierent-looking things are isomorphic.
24
26
Next
Functors: Structure-preserving maps between categories
Functions between functors: when are two implementations of polymorphic lists equivalent? when are two semantics equivalent?