Intro to Category Theory 1 / 17
′ ′ f - ′ Introduction to A B ′ a h b Abstract Nonsense - - f g′ A - B
Christoph Rauch g ? ? k′ FAU Erlangen-Nürnberg C′ - D′ h Theorieseminar SS2012
c d - - July 11, 2012 ? k ? C - D
...... Origins. foundations laid by Eilenberg, Mac Lane Grothendieck, Lawvere .
. Abstract. Language convenient notation huge amount of definitions only a handful of results concerning the theory itself .
. Categories. in Computer Science Haskell automata theory, program semantics, logics .
Intro to Category Theory | Motivation 2 / 17 Category Theory as a Mindset
...... Abstract. Language convenient notation huge amount of definitions only a handful of results concerning the theory itself .
. Categories. in Computer Science Haskell automata theory, program semantics, logics .
Intro to Category Theory | Motivation 2 / 17 Category Theory as a Mindset
. Origins. foundations laid by Eilenberg, Mac Lane Grothendieck, Lawvere .
...... Categories. in Computer Science Haskell automata theory, program semantics, logics .
Intro to Category Theory | Motivation 2 / 17 Category Theory as a Mindset
. Origins. foundations laid by Eilenberg, Mac Lane Grothendieck, Lawvere .
. Abstract. Language convenient notation huge amount of definitions only a handful of results concerning the theory itself .
...... Intro to Category Theory | Motivation 2 / 17 Category Theory as a Mindset
. Origins. foundations laid by Eilenberg, Mac Lane Grothendieck, Lawvere .
. Abstract. Language convenient notation huge amount of definitions only a handful of results concerning the theory itself .
. Categories. in Computer Science Haskell automata theory, program semantics, logics .
...... where f : A → B and g : B → C ⇒ ∃ g ◦ f : A → C (composition)
for each object A there is an arrow idA : A → A (identity) and h ◦ (g ◦ f) = (h ◦ g) ◦ f for compatible morphisms (associativity)
f ◦ idA = f = idB ◦f for all f : A → B (unit)
Intro to Category Theory | Definitions and Concepts 3 / 17 Categories
. A. Category C consists of a class Ob(C) of objects a class Hom(C) of morphisms, where each morphism has a domain and codomain in Ob(C), and we write f : A → B for a morphism f with domain A and codomain B
.
...... and h ◦ (g ◦ f) = (h ◦ g) ◦ f for compatible morphisms (associativity)
f ◦ idA = f = idB ◦f for all f : A → B (unit)
Intro to Category Theory | Definitions and Concepts 3 / 17 Categories
. A. Category C consists of a class Ob(C) of objects a class Hom(C) of morphisms, where each morphism has a domain and codomain in Ob(C), and we write f : A → B for a morphism f with domain A and codomain B where f : A → B and g : B → C ⇒ ∃ g ◦ f : A → C (composition)
for each object A there is an arrow idA : A → A (identity)
.
...... Intro to Category Theory | Definitions and Concepts 3 / 17 Categories
. A. Category C consists of a class Ob(C) of objects a class Hom(C) of morphisms, where each morphism has a domain and codomain in Ob(C), and we write f : A → B for a morphism f with domain A and codomain B where f : A → B and g : B → C ⇒ ∃ g ◦ f : A → C (composition)
for each object A there is an arrow idA : A → A (identity) and h ◦ (g ◦ f) = (h ◦ g) ◦ f for compatible morphisms (associativity) f ◦ id = f = id ◦f for all f : A → B (unit) . A B
...... Haskell:. Haskell types and Haskell functions in theory form a category Hask, but note that the actual implementations .have minor issues (right identity, limits)
.
. Posets. as Categories Each poset (S, ≤) defines a category C(S, ≤) with the elements of S as objects.. There is a morphism between p, q ∈ S iff p ≤ q.
. Games. (Conway) Mike Shulman at the n-Category Café stated that combinatorial games can be. seen as the objects in a category with winning strategies as morphisms.
Intro to Category Theory | Definitions and Concepts 4 / 17 Example Categories
. Sets. The category Set consists of sets as objects, total functions as morphisms .and function composition.
...... Haskell:. Haskell types and Haskell functions in theory form a category Hask, but note that the actual implementations .have minor issues (right identity, limits)
.
. Games. (Conway) Mike Shulman at the n-Category Café stated that combinatorial games can be. seen as the objects in a category with winning strategies as morphisms.
Intro to Category Theory | Definitions and Concepts 4 / 17 Example Categories
. Sets. The category Set consists of sets as objects, total functions as morphisms .and function composition.
. Posets. as Categories Each poset (S, ≤) defines a category C(S, ≤) with the elements of S as .objects. There is a morphism between p, q ∈ S iff p ≤ q.
...... Haskell:. Haskell types and Haskell functions in theory form a category Hask, but note that the actual implementations .have minor issues (right identity, limits)
.
Intro to Category Theory | Definitions and Concepts 4 / 17 Example Categories
. Sets. The category Set consists of sets as objects, total functions as morphisms .and function composition.
. Posets. as Categories Each poset (S, ≤) defines a category C(S, ≤) with the elements of S as .objects. There is a morphism between p, q ∈ S iff p ≤ q.
. Games. (Conway) Mike Shulman at the n-Category Café stated that combinatorial games can .be seen as the objects in a category with winning strategies as morphisms.
...... Intro to Category Theory | Definitions and Concepts 4 / 17 Example Categories
. Sets. The category Set consists of sets as objects, total functions as morphisms .and function composition.
. Haskell:. . Posets. as Categories Haskell types and Haskell functions in theory form a Each posetcategory(S, ≤)Haskdefines, but a category note thatC the(S, actual≤) with implementations the elements of S as ∈ ≤ .objects..have There minor is a morphism issues (right between identity,p, qlimits)S iff p q.
. Games. (Conway) Mike Shulman at the n-Category Café stated that combinatorial games can .be seen as the objects in a category with winning strategies as morphisms.
.
...... Mac. Lane: .Show that every diagram commutes.
.
. Usage. replacement for equations in category theory “pasting together” of diagrams .
Intro to Category Theory | Definitions and Concepts 5 / 17 Commutative Diagrams
. Principle.
h - A B This diagram is said to commute if the equation
f = g ◦ h f g - ? holds. . C
...... Mac. Lane: .Show that every diagram commutes.
.
Intro to Category Theory | Definitions and Concepts 5 / 17 Commutative Diagrams
. Principle.
h - A B This diagram is said to commute if the equation
f = g ◦ h f g - ? holds. . C
. Usage. replacement for equations in category theory “pasting together” of diagrams .
...... Intro to Category Theory | Definitions and Concepts 5 / 17 Commutative Diagrams
. Principle.
h - A B This diagram is said to commute if the equation
f = g ◦ h f g . Mac. Lane:- ? holds. . .Show thatC every diagram commutes.
. Usage. replacement for equations in category theory “pasting together” of diagrams .
.
...... Haskell:. class Functor f where fmap :: (a → b) → (f a → f b)
.Type constructors are endofunctors!
.
. Category. of Categories .The category Cat has small categories as objects and functors as arrows.
Intro to Category Theory | Definitions and Concepts 6 / 17 Functors
. A. Functor F between categories C and D is a a pair of maps (F0 : Ob(C) → Ob(D),F1 : Hom(C) → Hom(D)) where if f : A → B in C, then F (f): F (A) → F (B) in D if f : B → C and g : A → B in C, then F (f) ◦ F (g) = F (f ◦ g)
For all A in C, idF (A) = F (idA)
a C . We let F (A) = F0(A) for objects A and F (f) = F1(f) for arrows f of
...... Haskell:. class Functor f where fmap :: (a → b) → (f a → f b)
.Type constructors are endofunctors!
.
Intro to Category Theory | Definitions and Concepts 6 / 17 Functors
. A. Functor F between categories C and D is a a pair of maps (F0 : Ob(C) → Ob(D),F1 : Hom(C) → Hom(D)) where if f : A → B in C, then F (f): F (A) → F (B) in D if f : B → C and g : A → B in C, then F (f) ◦ F (g) = F (f ◦ g)
For all A in C, idF (A) = F (idA)
a C . We let F (A) = F0(A) for objects A and F (f) = F1(f) for arrows f of
. Category. of Categories .The category Cat has small categories as objects and functors as arrows.
...... Intro to Category Theory | Definitions and Concepts 6 / 17 Functors
. A. Functor F between categories C and D is a a pair of maps (F0 : Ob(C) → Ob(D),F1 : Hom(C) → Hom(D)) where if f. Haskell:. : A → B in C, then F (f): F (A) → F (B) in D → → C ◦ ◦ if f :classB C Functorand g : Af whereB in , then F (f) F (g) = F (f g) For all Afmapin C, ::idF ( (aA)→ = Fb)(idA→) (f a → f b)
a Type constructors are endofunctors! C . We let. F (A) = F0(A) for objects A and F (f) = F1(f) for arrows f of
. Category. of Categories .The category Cat has small categories as objects and functors as arrows.
.
...... such that. Haskell:. maybeToList
map even $ maybeToListF (f) $ Just 5 maybeToList $ fmapF (A) even- F$ (BJust) 5 .
ηA ηB ? ? G(f) G(A) - G(B)
commutes for any A, B ∈ Ob(C) and morphisms f : A → B.
.
Intro to Category Theory | Definitions and Concepts 7 / 17 Natural Transformations
. For. categories C, D and functors F,G : C → D, a natural transformation η : F → G is defined camponentwise on the objects of C: ηA : F (A) → G(A) ∀A ∈ Ob(C)
.
...... Haskell:. maybeToList map even $ maybeToList $ Just 5 maybeToList $ fmap even $ Just 5 .
.
Intro to Category Theory | Definitions and Concepts 7 / 17 Natural Transformations
. For. categories C, D and functors F,G : C → D, a natural transformation η : F → G is defined camponentwise on the objects of C: ηA : F (A) → G(A) ∀A ∈ Ob(C) such that
F (f) F (A) - F (B)
ηA ηB ? ? G(f) G(A) - G(B)
commutes. for any A, B ∈ Ob(C) and morphisms f : A → B.
...... Intro to Category Theory | Definitions and Concepts 7 / 17 Natural Transformations
. For. categories C, D and functors F,G : C → D, a natural transformation η : F → G is defined camponentwise on the objects of C: ηA : F (A) → G(A) ∀A ∈ Ob(C) such that. Haskell:. maybeToList
map even $ maybeToListF (f) $ Just 5 maybeToList $ fmapF (A) even- F$ (BJust) 5 .
ηA ηB ? ? G(f) G(A) - G(B)
commutes. for any A, B ∈ Ob(C) and morphisms f : A → B.
...... Uniqueness. .Inverses are unique, i.e. if g1 and g2 are inverses of f, then g1 = g2.
Intro to Category Theory | Definitions and Concepts 8 / 17 Inverses and Isomorphisms
. A. morphism f : A → B in a category C is called an isomorphism if there exists a morphism g : B → A with g. ◦ f = idA and f ◦ g = idB. We call g an inverse of f.
...... Intro to Category Theory | Definitions and Concepts 8 / 17 Inverses and Isomorphisms
. A. morphism f : A → B in a category C is called an isomorphism if there exists a morphism g : B → A with g. ◦ f = idA and f ◦ g = idB. We call g an inverse of f.
. Uniqueness. .Inverses are unique, i.e. if g1 and g2 are inverses of f, then g1 = g2.
...... Products. Let A and B be objects. An object A × B is called the product of A and B iff
there exist πA : A × B → A, πB : A × B → B (projections)
for all objects C and fA : C → A, fB : C → B there exists a unique u : C → A × B π ◦ u = f π ◦ u = f . such that A A and B B
Intro to Category Theory | Definitions and Concepts 9 / 17 Limits
. Terminal. Objects An object T is called terminal if for every object A, there is exactly one .morphism A → T .
...... Intro to Category Theory | Definitions and Concepts 9 / 17 Limits
. Terminal. Objects An object T is called terminal if for every object A, there is exactly one .morphism A → T .
. Products. Let A and B be objects. An object A × B is called the product of A and B iff
there exist πA : A × B → A, πB : A × B → B (projections)
for all objects C and fA : C → A, fB : C → B there exists a unique u : C → A × B π ◦ u = f π ◦ u = f . such that A A and B B
...... Colimits:. ⇒ The limits just presented have duals: initial objects, coproducts and coequalizers .
.
. Duality. For every category C, the so-called dual category Cop is the category with op .Ob(C ) = Ob(C) and the morphisms of C with source and target reversed.
Intro to Category Theory | Definitions and Concepts 10 / 17 Limits (II)
. Equalizers. f g e Let A −→ B ←− A be two morphisms in a category. Then E −→ A is called equalizer for f and g iff f ◦ e = g ◦ e for any object C and morphism m : C → A, if f ◦ m = g ◦ m, then there exists a unique morphism u : C → E such that e ◦ u = m .
...... Colimits:. ⇒ The limits just presented have duals: initial objects, coproducts and coequalizers .
.
Intro to Category Theory | Definitions and Concepts 10 / 17 Limits (II)
. Equalizers. f g e Let A −→ B ←− A be two morphisms in a category. Then E −→ A is called equalizer for f and g iff f ◦ e = g ◦ e for any object C and morphism m : C → A, if f ◦ m = g ◦ m, then there exists a unique morphism u : C → E such that e ◦ u = m .
. Duality. For every category C, the so-called dual category Cop is the category with op Ob. (C ) = Ob(C) and the morphisms of C with source and target reversed.
...... Intro to Category Theory | Definitions and Concepts 10 / 17 Limits (II)
. Equalizers. f g e Let A −→ B ←− A be two morphisms in a category. Then E −→ A is called equalizer for f and g iff f .◦Colimits:. e = g ◦ e for any⇒ objectThe limitsC and just morphism presentedm have: C duals:→ A,initial if f ◦ objectsm = g,◦ m, then there exists a unique morphism u : C → E such that e ◦ u = m . coproducts and coequalizers .
. Duality. For every category C, the so-called dual category Cop is the category with op Ob. (C ) = Ob(C) and the morphisms of C with source and target reversed.
.
...... Laws. for Exponential Objects ( ) B×C ∼ B C 1 A = A ∏ ∏ ( ) B ∼ B 2 ( Ai) = A ⨿ ∏ ( )i Bi ∼ B 3 A = Ai ⨿ ∼ ⨿ 4 A × Bi = (A × Bi) .
Intro to Category Theory | Definitions and Concepts 11 / 17 Cartesian Closed Categories
. Exponential. Objects and Currying Let A and B be objects in a category with binary products. Then, an exponential object is an object BA together with a morphism ev :(A × BA) → B if for any object C and morphism f :(A × C) → B A .there is a unique morphism λf : C → B such that ev ◦λf = f.
...... Intro to Category Theory | Definitions and Concepts 11 / 17 Cartesian Closed Categories
. Exponential. Objects and Currying Let A and B be objects in a category with binary products. Then, an exponential object is an object BA together with a morphism ev :(A × BA) → B if for any object C and morphism f :(A × C) → B A .there is a unique morphism λf : C → B such that ev ◦λf = f.
. Laws. for Exponential Objects ( ) B×C ∼ B C 1 A = A ∏ ∏ ( ) B ∼ B 2 ( Ai) = A ⨿ ∏ ( )i Bi ∼ B 3 A = Ai ⨿ ∼ ⨿ 4 A × Bi = (A × Bi) .
...... Intro to Category Theory | Selected Constructions 12 / 17 Pushouts
Let f : C → A and g : C → B be two objects in a category. The pushout of theses morphisms is a pair of morphisms (f ′, g′) together with an object P such that f ′ : C → P and g′ : B → P and the square
f ′ P B 6 6
g′ g
f A C commutes. Additionally, (P, f ′, g′) must be universal with respect to this diagram.
...... Intro to Category Theory | Selected Constructions 13 / 17 Pushout Examples
. Pushouts. in Set Construct the set-theoretic union element-free as a combination of an equalizer and a pushout .
...... Monoids. . Monads. A set S An endofunctor T : C → C An op. A nat. transf. µ : T ◦ T → T (·): S × S → S A nat. transf. η : idC → T An element e : 1 → S and laws and laws µ (µ(T ◦ T ) ◦ T ) = µ (T ◦ µ(T ◦ T )) (a · b) · c = a · (b · c) µ (η(T )) = T = µ (T (η)) · · . e a = a = a e .
Intro to Category Theory | Selected Constructions 14 / 17 Monads
Monads are just monoids in the category of endofunctors.
...... Monads. An endofunctor T : C → C A nat. transf. µ : T ◦ T → T A nat. transf. η : idC → T and laws µ (µ(T ◦ T ) ◦ T ) = µ (T ◦ µ(T ◦ T )) µ (η(T )) = T = µ (T (η)) .
Intro to Category Theory | Selected Constructions 14 / 17 Monads
Monads are just monoids in the category of endofunctors.
. Monoids. A set S An op. (·): S × S → S An element e : 1 → S and laws (a · b) · c = a · (b · c) · · . e a = a = a e
...... Intro to Category Theory | Selected Constructions 14 / 17 Monads
Monads are just monoids in the category of endofunctors.
. Monoids. . Monads. A set S An endofunctor T : C → C An op. A nat. transf. µ : T ◦ T → T (·): S × S → S A nat. transf. η : idC → T An element e : 1 → S and laws and laws µ (µ(T ◦ T ) ◦ T ) = µ (T ◦ µ(T ◦ T )) (a · b) · c = a · (b · c) µ (η(T )) = T = µ (T (η)) · · . e a = a = a e .
...... Examples. Monads induced by monoids and small categories Powerset, States, … .
Intro to Category Theory | Selected Constructions 15 / 17 Monad Examples
. Monad. Laws µT ηT T η T 3 - T 2 T - T 2 T
id T µ µ µ C C id ? - ? ? T 2 - T T . µ
...... Intro to Category Theory | Selected Constructions 15 / 17 Monad Examples
. Monad. Laws µT ηT T η T 3 - T 2 T - T 2 T
id T µ µ µ C C id ? - ? ? T 2 - T T . µ
. Examples. Monads induced by monoids and small categories Powerset, States, … .
...... Intro to Category Theory | Selected Constructions 16 / 17 Monads in Haskell
. Implementation.
class Monad m where (>>=) :: m a → (a → m b) → m b return :: a → m a with Monad laws m >>= return = m return x >>= f = f x
(m >>= f) >>= g = m >>= (λx → f x >>= g) .
...... Books. Mac Lane • Categories for the Working Mathematician (classic) Barr, Wells • Toposes, Triples and Theories (free) Lawvere, Schanuel • Conceptual Mathematics (very basic) .
Intro to Category Theory | Further Reading 17 / 17 Material on Category Theory
. Web. Resouces ncatlab.org ureddit.com CT Course The Catsters (youtube) Haskell wiki ##categorytheory on freenode .
...... Intro to Category Theory | Further Reading 17 / 17 Material on Category Theory
. Web. Resouces ncatlab.org ureddit.com CT Course The Catsters (youtube) Haskell wiki ##categorytheory on freenode .
. Books. Mac Lane • Categories for the Working Mathematician (classic) Barr, Wells • Toposes, Triples and Theories (free) Lawvere, Schanuel • Conceptual Mathematics (very basic) .
......