Abstract Nonsense Introduction to 1 / 17 Intro to Category Theory - - PowerPoint PPT Presentation

abstract nonsense introduction to
SMART_READER_LITE
LIVE PREVIEW

Abstract Nonsense Introduction to 1 / 17 Intro to Category Theory - - PowerPoint PPT Presentation

. . July 11, 2012 Theorieseminar SS2012 FAU Erlangen-Nrnberg Christoph Rauch Abstract Nonsense Introduction to 1 / 17 Intro to Category Theory . . . . f B A h a b f g A B g k


slide-1
SLIDE 1

. . . . . .

Intro to Category Theory 1 / 17

Introduction to Abstract Nonsense

Christoph Rauch

FAU Erlangen-Nürnberg Theorieseminar SS2012

July 11, 2012

A′ f′

✲ B′

A f

a

h′ B b

C′ g′

k′

✲ D′ ❄

C g

k

c

D h

d

slide-2
SLIDE 2

. . . . . .

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

  • nly a handful of results concerning the theory itself

..

Categories in Computer Science

. Haskell automata theory, program semantics, logics

slide-3
SLIDE 3

. . . . . .

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

  • nly a handful of results concerning the theory itself

..

Categories in Computer Science

. Haskell automata theory, program semantics, logics

slide-4
SLIDE 4

. . . . . .

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

  • nly a handful of results concerning the theory itself

..

Categories in Computer Science

. Haskell automata theory, program semantics, logics

slide-5
SLIDE 5

. . . . . .

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

  • nly a handful of results concerning the theory itself

..

Categories in Computer Science

. Haskell automata theory, program semantics, logics

slide-6
SLIDE 6

. . . . . .

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 and (composition) for each object there is an arrow id (identity) and for compatible morphisms (associativity) id id for all (unit)

slide-7
SLIDE 7

. . . . . .

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 for compatible morphisms (associativity) id id for all (unit)

slide-8
SLIDE 8

. . . . . .

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 ◦ idA = f = idB ◦f for all f : A → B (unit)

slide-9
SLIDE 9

. . . . . .

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 defines a category with the elements of as

  • bjects. There is a morphism between

iff . ..

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. . ..

Haskell:

. Haskell types and Haskell functions in theory form a category Hask, but note that the actual implementations have minor issues (right identity, limits)

slide-10
SLIDE 10

. . . . . .

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

  • bjects. 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. . ..

Haskell:

. Haskell types and Haskell functions in theory form a category Hask, but note that the actual implementations have minor issues (right identity, limits)

slide-11
SLIDE 11

. . . . . .

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

  • bjects. 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. . . ..

Haskell:

. Haskell types and Haskell functions in theory form a category Hask, but note that the actual implementations have minor issues (right identity, limits)

slide-12
SLIDE 12

. . . . . .

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

  • bjects. 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. . . ..

Haskell:

. Haskell types and Haskell functions in theory form a category Hask, but note that the actual implementations have minor issues (right identity, limits)

slide-13
SLIDE 13

. . . . . .

Intro to Category Theory | Definitions and Concepts 5 / 17

Commutative Diagrams

..

Principle

.

A h

✲ B

C g

f

This diagram is said to commute if the equation f = g ◦ h holds. ..

Usage

. replacement for equations in category theory “pasting together” of diagrams . ..

Mac Lane:

. Show that every diagram commutes.

slide-14
SLIDE 14

. . . . . .

Intro to Category Theory | Definitions and Concepts 5 / 17

Commutative Diagrams

..

Principle

.

A h

✲ B

C g

f

This diagram is said to commute if the equation f = g ◦ h holds. ..

Usage

. replacement for equations in category theory “pasting together” of diagrams . . ..

Mac Lane:

. Show that every diagram commutes.

slide-15
SLIDE 15

. . . . . .

Intro to Category Theory | Definitions and Concepts 5 / 17

Commutative Diagrams

..

Principle

.

A h

✲ B

C g

f

This diagram is said to commute if the equation f = g ◦ h holds. ..

Usage

. replacement for equations in category theory “pasting together” of diagrams . . ..

Mac Lane:

. Show that every diagram commutes.

slide-16
SLIDE 16

. . . . . .

Intro to Category Theory | Definitions and Concepts 6 / 17

Functors

..

A Functor F between categories C and D is

. a pair of maps (F0 : Ob(C) → Ob(D), F1 : Hom(C) → Hom(D))a 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)

aWe let F(A) = F0(A) for objects A and F(f) = F1(f) for arrows f of C

..

Category of Categories

. The category Cat has small categories as objects and functors as arrows. . . ..

Haskell:

.

class Functor f where fmap :: (a b) (f a f b)

Type constructors are endofunctors!

slide-17
SLIDE 17

. . . . . .

Intro to Category Theory | Definitions and Concepts 6 / 17

Functors

..

A Functor F between categories C and D is

. a pair of maps (F0 : Ob(C) → Ob(D), F1 : Hom(C) → Hom(D))a 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)

aWe let F(A) = F0(A) for objects A and F(f) = F1(f) for arrows f of C

..

Category of Categories

. The category Cat has small categories as objects and functors as arrows. . . ..

Haskell:

.

class Functor f where fmap :: (a b) (f a f b)

Type constructors are endofunctors!

slide-18
SLIDE 18

. . . . . .

Intro to Category Theory | Definitions and Concepts 6 / 17

Functors

..

A Functor F between categories C and D is

. a pair of maps (F0 : Ob(C) → Ob(D), F1 : Hom(C) → Hom(D))a 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)

aWe let F(A) = F0(A) for objects A and F(f) = F1(f) for arrows f of C

..

Category of Categories

. The category Cat has small categories as objects and functors as arrows. . . ..

Haskell:

.

class Functor f where fmap :: (a → b) → (f a → f b)

Type constructors are endofunctors!

slide-19
SLIDE 19

. . . . . .

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

  • f C:

ηA : F(A) → G(A) ∀A ∈ Ob(C) such that commutes for any Ob and morphisms . . . ..

Haskell: maybeToList

.

map even $ maybeToList $ Just 5 maybeToList $ fmap even $ Just 5

slide-20
SLIDE 20

. . . . . .

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

  • f C:

ηA : F(A) → G(A) ∀A ∈ Ob(C) such that

F(A) F(f)

✲ F(B)

G(A) ηA

G(f)

✲ G(B)

ηB

commutes for any A, B ∈ Ob(C) and morphisms f : A → B. . . ..

Haskell: maybeToList

.

map even $ maybeToList $ Just 5 maybeToList $ fmap even $ Just 5

slide-21
SLIDE 21

. . . . . .

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

  • f C:

ηA : F(A) → G(A) ∀A ∈ Ob(C) such that

F(A) F(f)

✲ F(B)

G(A) ηA

G(f)

✲ G(B)

ηB

commutes for any A, B ∈ Ob(C) and morphisms f : A → B. . . ..

Haskell: maybeToList

.

map even $ maybeToList $ Just 5 maybeToList $ fmap even $ Just 5

slide-22
SLIDE 22

. . . . . .

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 and are inverses of , then .

slide-23
SLIDE 23

. . . . . .

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.

slide-24
SLIDE 24

. . . . . .

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 and be objects. An object is called the product of and iff there exist , (projections) for all objects and , there exists a unique such that and

slide-25
SLIDE 25

. . . . . .

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 such that πA ◦ u = fA and πB ◦ u = fB

slide-26
SLIDE 26

. . . . . .

Intro to Category Theory | Definitions and Concepts 10 / 17

Limits (II)

..

Equalizers

. Let A

f

− → B

g

← − A be two morphisms in a category. Then E

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 , the so-called dual category

  • p is the category with

Ob

  • p

Ob and the morphisms of with source and target reversed. . . ..

Colimits:

. The limits just presented have duals: initial objects, coproducts and coequalizers

slide-27
SLIDE 27

. . . . . .

Intro to Category Theory | Definitions and Concepts 10 / 17

Limits (II)

..

Equalizers

. Let A

f

− → B

g

← − A be two morphisms in a category. Then E

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 Ob(Cop) = Ob(C) and the morphisms of C with source and target reversed. . . ..

Colimits:

. The limits just presented have duals: initial objects, coproducts and coequalizers

slide-28
SLIDE 28

. . . . . .

Intro to Category Theory | Definitions and Concepts 10 / 17

Limits (II)

..

Equalizers

. Let A

f

− → B

g

← − A be two morphisms in a category. Then E

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 Ob(Cop) = Ob(C) and the morphisms of C with source and target reversed. . . ..

Colimits:

. ⇒ The limits just presented have duals: initial objects, coproducts and coequalizers

slide-29
SLIDE 29

. . . . . .

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 there is a unique morphism λf : C → BA such that ev ◦λf = f. ..

Laws for Exponential Objects

.

1 2 3 4

slide-30
SLIDE 30

. . . . . .

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 there is a unique morphism λf : C → BA such that ev ◦λf = f. ..

Laws for Exponential Objects

.

1 AB×C ∼

= ( AB)C

2 (∏ Ai)B ∼

= ∏ ( AB

i

)

3 A ⨿ Bi ∼

= ∏ ( AB

i

)

4 A × ⨿ Bi ∼

= ⨿ (A × Bi)

slide-31
SLIDE 31

. . . . . .

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 P ✛ f′ B A g′

✻ ✛

f C g

  • commutes. Additionally, (P, f′, g′) must be universal with respect to this

diagram.

slide-32
SLIDE 32

. . . . . .

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

slide-33
SLIDE 33

. . . . . .

Intro to Category Theory | Selected Constructions 14 / 17

Monads

Monads are just monoids in the category of endofunctors. ..

Monoids

. A set An op. An element and laws ..

Monads

. An endofunctor A nat. transf. A nat. transf. id and laws

slide-34
SLIDE 34

. . . . . .

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 ..

Monads

. An endofunctor A nat. transf. A nat. transf. id and laws

slide-35
SLIDE 35

. . . . . .

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 ..

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(η))

slide-36
SLIDE 36

. . . . . .

Intro to Category Theory | Selected Constructions 15 / 17

Monad Examples

..

Monad Laws

.

T 3 µT ✲ T 2 T 2 Tµ

µ

✲ T

µ

T ηT ✲ T 2 ✛ Tη T T µ

❄ ✛

idC idC

..

Examples

. Monads induced by monoids and small categories Powerset, States, …

slide-37
SLIDE 37

. . . . . .

Intro to Category Theory | Selected Constructions 15 / 17

Monad Examples

..

Monad Laws

.

T 3 µT ✲ T 2 T 2 Tµ

µ

✲ T

µ

T ηT ✲ T 2 ✛ Tη T T µ

❄ ✛

idC idC

..

Examples

. Monads induced by monoids and small categories Powerset, States, …

slide-38
SLIDE 38

. . . . . .

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)

slide-39
SLIDE 39

. . . . . .

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)

slide-40
SLIDE 40

. . . . . .

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)