Home
From Category Theory for Programmers - Series 1
Lecture 1
-
A category is a bunch of objects
-
Morphisms (or an arrow) is something that goes between two objects
-
Object is the primitive, take it on faith, can be anything (think object class in C#)
-
Or consider, an object is simply used to mark the beginning and end of arrows
-
You can have zero or more arrows going between objects
-
Can be infinite/uncountable number of arrows
-
Doesn't have to be different objects, can be arrows back to itself
-
Composition is a property
-
For a → b → c
-
If a→b is called 𝑓, and b→c is called 𝑔
-
There's a composition 𝑔 ∘ 𝑓, which is identical a→b→c, which must exist
-
Different composition tables will give different categories
-
For every object (a) there is an identity arrow ida
-
For a→b (call it 𝑓) and b→b
-
idb ∘ 𝑓 = 𝑓
-
𝑓 followed by idb = 𝑓
-
Left identity
-
For (different) a,b where a→a and a→b (call it 𝑔)
-
𝑔 ∘ ida = 𝑔
-
Ida followed by 𝑔 = 𝑔
-
Right identity
-
Left and right identity are not necessarily the same
-
Axiom of category
-
Aka associativity
-
ℎ ∘ (g ∘ 𝑓) = (ℎ ∘ 𝑔) ∘ 𝑓
-
(side note for higher math) If objects form a set, it's a small category; if they don't form a set, it's a large category
-
Haskell note: "bottom" is base lower type, for example, describes what gets "returned" if the function enters an infinite loop