ON THEM Precisely, formally, define - • the operations that can be performed on things • the properties that we can access on things That’s what programming is 8 / 52
is a very abstract branch of mathematics, concerned with: • Objects and their context • Their relationships with other objects • And how we can derive properties and operations on them • It gives us a framework to manage this complexity • Allows us to analyse the connections between multiple groups and levels at the same time • It’s very general, so applies in a lot of situations 14 / 52
If you have a f : A → B and g : B → C, there must be an arrow g ◦ f : A → C. A f → B g → C And composition must be associative. If f : A → B, g : B → C, and h : C → D: h ◦ (g ◦ f) = (h ◦ g) ◦ f A f → B g → C h → D 29 / 52
object A, there must exist a special identity morphism, idA : A → A. A idA→ A Or more commonly: A idA This identity morphism acts as a neutral element for composition. For any f : A → B: f ◦ idA = f and idB ◦ f = f 31 / 52
an arrow from 10 to 10, and 11 to 11, and so on, • And that arrow must act as the identity element for function composition 10 11 12 +1 +1 +2 id10 33 / 52
1. A bunch of Objects: denoted with capital letters A,B,C,... 2. A bunch of Arrows: connections between objects. Denoted with lower case letters f,g,h,... • A • B • C • D • E • F • G • H i j f g h k l 34 / 52
called Morphisms. • Categories focus more on morphisms rather than objects. • A morphism represents a relationship between any two objects A and B in a category. • There could be any number of distinct morphisms between any two objects. • A morphism from A to B is written as f : A → B. 35 / 52
diagramatically as follows: A f → B Morphisms compose. The composition is denoted by the symbol (◦). So the composition of g after f is written as: g ◦ f Diagramatically: A B C f g 36 / 52
two rules (axioms): Axiom 1: Rules of Composition If you have a f : A → B and g : B → C, there must be an arrow g ◦ f : A → C. A f → B g → C And composition must be associative. If f : A → B, g : B → C, and h : C → D: h ◦ (g ◦ f) = (h ◦ g) ◦ f A f → B g → C h → D 37 / 52
For every object A, there must exist a special identity morphism, idA : A → A. A idA→ A Or more commonly: A idA This identity morphism acts as a neutral element for composition. For any f : A → B: f ◦ idA = f and idB ◦ f = f 38 / 52
0, is the unique category with: • No objects. • No morphisms. • It vacuously satisfies all the category axioms because there is nothing to check! 39 / 52
objects, A and B. • Objects: {A,B} • Morphisms: {idA,idB,f : A → B,g : A → B} A f,g→ B • Composition is not defined for f and g since their domains and codomains don’t align. The identity morphisms are also omitted from the diagram for clarity. • All axioms hold! 41 / 52
of a category. • Objects: All sets. (e.g., {1,2,3}, R, {cat,dog}) • Morphisms: All functions between sets. • Composition: Standard function composition. • Identity: The identity function for each set, idA (x) = x. 42 / 52
as a thin category (at most one morphism between any two objects). • Objects: The elements of the set P. • Morphisms: A unique morphism exists from x to y if and only if x ≤ y. ∣Hom(x, y)∣ ≤ 1 for all x, y ∈ P • Composition: If x ≤ y and y ≤ z, the composite morphism exists because transitivity ensures x ≤ z. • Identity: For any object x, the identity morphism exists because reflexivity ensures x ≤ x. 43 / 52
as a thin category (at most one morphism between any two objects). • Objects: The elements of the set P. • Morphisms: A unique morphism exists from x to y if and only if x ≤ y. ∣Hom(x, y)∣ ≤ 1 for all x, y ∈ P • Composition: If x ≤ y and y ≤ z, the composite morphism exists because transitivity ensures x ≤ z. • Identity: For any object x, the identity morphism exists because reflexivity ensures x ≤ x. 43 / 52
as a thin category (at most one morphism between any two objects). • Objects: The elements of the set P. • Morphisms: A unique morphism exists from x to y if and only if x ≤ y. ∣Hom(x, y)∣ ≤ 1 for all x, y ∈ P • Composition: If x ≤ y and y ≤ z, the composite morphism exists because transitivity ensures x ≤ z. • Identity: For any object x, the identity morphism exists because reflexivity ensures x ≤ x. 43 / 52
is initial if for every object X in the category, there exists a unique morphism from I to X. I X Y Z Terminal Object (T) An object T is terminal if for every object X in the category, there exists a unique morphism from X to T. T X Z Y 45 / 52
morphisms f : Z → A and g : Z → B, there exists a unique morphism h : Z → A × B such that the diagram commutes. π1 ◦ h = f and π2 ◦ h = g A × B A Z π1 π2 f g h 47 / 52
two objects A and B, their sum (or coproduct): 1. Is written A + B 2. Has two morphisms (injections): – ι1 : A → A + B – ι2 : B → A + B A + B A ι1 ι2 48 / 52
morphisms f : A → Z and g : B → Z, there exists a unique morphism h : A + B → Z such that the diagram commutes. h ◦ ι1 = f and h ◦ ι2 = g A + B A Z ι1 ι2 f g h 49 / 52