Adjunctions and monads Paul-Andr Mellis IT University of Copenhagen - - PowerPoint PPT Presentation

adjunctions and monads
SMART_READER_LITE
LIVE PREVIEW

Adjunctions and monads Paul-Andr Mellis IT University of Copenhagen - - PowerPoint PPT Presentation

String Diagrams in Logic & Computer Science [ four ] Adjunctions and monads Paul-Andr Mellis IT University of Copenhagen April 2011 Adjunctions 2 Adjonction An adjunction is a triple ( L , R , ) where L and R are two functors L


slide-1
SLIDE 1

String Diagrams in Logic & Computer Science [ four ]

Adjunctions and monads

Paul-André Melliès IT University of Copenhagen April 2011

slide-2
SLIDE 2

Adjunctions

2

slide-3
SLIDE 3

Adjonction

An adjunction is a triple (L, R, φ) where L and R are two functors L : A −→ B R : B −→ A and φ is a family of bijections, for every pair of objects A in A and B in B, φA,B : B(LA, B) A(A, RB) natural in A et B. One also writes LA −→B B A −→A RB φA,B One says that L is left adjoint to R, noted L ⊣ R. The 2-dimensional version of isomorphism

3

slide-4
SLIDE 4

The naturality of the bijection φ

Natural in A and B means that the family of bijections φA,B transforms every com- mutative diagram LA

g

B

hB

  • LA′

LhA

  • f

B′

into a commutative diagram A

φA,B(g)

RB

RhB

  • A′

hA

  • φA′,B′( f)

RB′

4

slide-5
SLIDE 5

Example: the free vector space

Set

L

Vect

R

  • where

A = Set

: the category of sets and functions

B = Vect

: the category of vector spaces on a field k R : the « forgetful » functor V → U(V) L : the « free vector space » functor X → kX kX :=

  • x∈X

λx x | λx ∈ k null almost everywhere.

  • 5
slide-6
SLIDE 6

Illustration: the tensor algebra

Vect

L

Alg

R

  • where

A = Vect

: the category of vector spaces

B = Alg

: the category of algebras and homomorphisms, R : the « forgetful » functor A → U(A). L : the « free algebra » functor V → TV. TV :=

  • n∈N

V⊗n

6

slide-7
SLIDE 7

Definition of a Lie algebra

Vector space g equipped with a Lie bracket Anti-symmetry: [x, y] = −[y, x] Jacobi identity: [x, [y, z]] + [y, [z, x]] + [z, [x, y]] = Example: the vector space of vector fields on a smooth manifold.

7

slide-8
SLIDE 8

Illustration: the enveloping algebra of a Lie algebra

Lie

L

Alg

R

  • where

A = Lie

: the category of Lie algebras,

B = Alg

: the category of algebras, R : equips A with the canonical Lie bracket [a, b] = ab − ba, L : « enveloping algebra » functor g → U(g). U(g) := Tg / I(g) where I(g) is the ideal generated by ab − ba − [a, b].

8

slide-9
SLIDE 9

Illustration: the free category

Graph

L

Cat

R

  • where

A = Graph

: the category of graphs,

B = Cat

: the category of categories and functors, R : the « forgetful » functor L : the « free category » functor

9

slide-10
SLIDE 10

Illustration : the terminal object

C

L

R

  • where

A = C

: any category equipped with a terminal object 1,

B = ✶

: the singleton category, R : the functor whose image is the terminal object 1, L : the canonical (and unique) functor

10

slide-11
SLIDE 11

Adjunction in the 2-category Cat

A bijection φ between the natural transformations

A

L

[A]

  • [B]

B

φA,B

−→

A ✶

[A]

  • [B]

B

R

  • Here, a morphism X −→ Y in the category C

is seen as a natural transformation [X] −→ [Y].

[Y]

[X]

C

11

slide-12
SLIDE 12

Adjunction in the 2-category Cat

A bijection φ between the natural transformations

A

L

A

  • B

B

φA,B

−→

A ✶

A

  • B

B

R

  • Here, a morphism X −→ Y in the category C

seen as a natural transformation [X] −→ [Y].

Y

X

C

12

slide-13
SLIDE 13

A 2-dimensional naturality condition

One reformulates the naturality condition in that way: The bijection φ is natural with respect to the natural transformations α and β.

A

L

A′

  • B′
  • ⇓α

⇓β

A

  • B
  • ⇓θ

B

φA′,B′

−→

A ✶

A′

  • B′
  • ⇓α

⇓β

A

  • B
  • ⇓ζ

B

R

  • 13
slide-14
SLIDE 14

Adjunction in the 2-category Cat

This point of view leads to a more satisfactory definition of adjunction: A bijection φ between the natural transformations

A

L

  • C

A

  • B

B

φA,B

−→

A C

A

  • B

B

R

  • 14
slide-15
SLIDE 15

Adjunction in the 2-category Cat

One reformulates the naturality condition as follows: The bijection φ is natural with respect to the natural transformations α et β.

A

L

  • D

A′

  • B′
  • ⇓α

⇓β

C

A

  • B
  • ⇓θ

B

φA′,B′

−→

A D

A′

  • B′
  • ⇓α

⇓β

C

A

  • B
  • ⇓ζ

B

R

  • 15
slide-16
SLIDE 16

Algebraic presentation of the adjunction

An adjonction is a quadruple (L, R, η, ε) where L and R are functors L :

A −→ B

R :

B −→ A

and η and ε are natural transformations: η : IdA

·

−→ RL ε : LR

·

−→ IdB such that the composite are the identities: (of L and R respectively). R

ηR

RLR

R

L

LRL

εF

L

The situation is depicted as follows:

A

L

  • IdA
  • B

R

  • IdB
  • ⇓η

A

L

  • ⇓ε

B

16

slide-17
SLIDE 17

Dual definition (but equivalent) of adjunction

By duality, an adjunction is given by a family of bijections ψ between the sets of 2-cells

A

A

  • L
  • C

⇓θ

B

B

  • ψA,B

−→

A

A

  • C

⇓ζ

B

B

  • R
  • natural in A and B.

17

slide-18
SLIDE 18

Illustration: duality in a monoidal category

Let (C, ⊗, e) denote a monoidal category. An object A is left dual to an object B when there exists two morphisms η : e −→ B ⊗ A ε : A ⊗ B −→ e such that A

A⊗η

A ⊗ B ⊗ A

ε⊗A

A

= A

idA

A

et B

η⊗B

B ⊗ A ⊗ B

B⊗ε

B

= B

idB

B

A is left dual to B in C iff A is left adjoint to B in the suspension Σ C.

18

slide-19
SLIDE 19

The 2-dimensional presentation of adjunctions

The unit and counit of the adjunction L ⊣ R are depicted as η : Id −→ R ◦ L L R η ε : L ◦ R −→ Id R L ε

19

slide-20
SLIDE 20

The 2-dimensional presentation of adjunctions

ε η L L

=

L L

η ε R R

=

R R

An adjunction is a polychrome version of a dual pair

20

slide-21
SLIDE 21

Monads

21

slide-22
SLIDE 22

Monads

A monad s on a 0-cell A is a 1-cell s : A −→ A equipped with a multiplication µ : s ◦ s ⇒ s : A −→ A and a unit η : IdA ⇒ s : A −→ A satisfying the associativity and unit laws.

22

slide-23
SLIDE 23

Every adjunction defines a monad

(by a graphical argument)

23

slide-24
SLIDE 24

T-modules

A T-module of the monad (T, µ, η) is a pair ( A , h ) consisting of an object A and a morphism h : TA −→ A making the two diagrams below commute TA

h

  • A

ηA

  • id

A

T2A

µA

  • Th
  • TA

h

  • TA

h

A

A T-module is usually called a T-algebra in the literature

24

slide-25
SLIDE 25

Homomorphisms of T-modules

A homomorphism of T-module f : (A, hA) −→ (B, hB) is a morphism f : A −→ B between the underlying objects making the diagram TA

hA

  • T f

TB

hB

  • A

f

B

commute.

25

slide-26
SLIDE 26

Free T-modules

The free T-module generated by an object A is defined as ( TA , µA : TTA −→ TA ) Given any T-module ( B , hB : TB −→ B ) there exists a bijection between the homomorphisms ( TA , µA ) −→ ( B , hB ) and the morphisms TA −→ B in the underlying category.

26

slide-27
SLIDE 27

The Eilenberg-Moore adjunction

This induces an adjunction

C

L

R

  • T−Mod

whose associated monad is precisely the monad T. L : the « free » functor A → (TA, µA) R : the « forgetful » functor (A, hA) → A

27

slide-28
SLIDE 28

The category of free T-modules

The Kleisli category T−FreeMod associated to a monad (T, µ, η) – its objects are the objects the underlying category C – its morphisms A B the morphisms A −→ TB in the category C The identity morphism A A is defined as ηA : A −→ TA The composite of f : A B and g : B C is defined as g ◦K f := TTC

µC

  • TB

Tg

  • TC

A

f

  • B

g

  • 28
slide-29
SLIDE 29

Exercise

Show that composition is associative. Hint: consider the diagram T3D

  • T2C

T2h

  • µ
  • T2D

µ

  • TB

Tg

  • TC

Th

  • TD

A

f

  • B

g

  • C

h

  • D

in the category C, and check that the two morphisms A −→ TD coincide.

29

slide-30
SLIDE 30

The Kleisli adjunction

This induces an adjunction

C

L

R

  • T−FreeMod

whose associated monad is precisely the monad T. L : the « free » functor A → A R : the « forgetful » functor A → TA

30

slide-31
SLIDE 31

Representation principle

Every monad (in the 2-categorical sense) t : A −→ A induces a monad (in the categorical sense) B(X, t) : B(X, A) −→ B(X, A) defined by post-composition X

f

A

→ X

f

A t A

for every 0-cell X of the underlying 2-category B.

31

slide-32
SLIDE 32

Eilenberg-Moore object

When the 2-dimensional functor X → B(X, t)−Mod : B op(1) −→ Cat is 2-representable by an object At of the 2-category B. In other words, there exists an isomorphism of categories φX,A : B(X, t)−Mod

  • B ( X , At )

which is 2-natural in the object X.

32

slide-33
SLIDE 33

What 2-naturality means here

For every 1-cell X

f

  • Y

the diagram B(Y , t)−Mod

φY

,A

  • B(f,t)−Mod
  • B(Y

, At)

B(f,At)

  • B(X, t)−Mod

φX,A

B(X, At)

commutes.

33

slide-34
SLIDE 34

What 2-naturality means here

For every 2-cell X

f

  • g
  • ⇓θ

Y the natural transformations coincide: B(Y , t)−Mod

φY

,A

  • B( f,t)−Mod
  • B(g,t)−Mod

B(Y , At)

B(g,At)

  • B(X, t)−Mod

φX,A

B(X, At)

B(Y , t)−Mod

φY

,A

  • B(f,t)−Mod
  • B(Y

, At)

B( f,At)

B(g,At)

  • B(X, t)−Mod

φX,A

B(X, At)

34

slide-35
SLIDE 35

Strong monads

35

slide-36
SLIDE 36

Tensorial strength

A left strength tA,B : A ⊗ TB −→ T(A ⊗ B)

  • n a monad T on a monoidal category

( C , ⊗ , 1 ) is a natural family making the diagrams below commute.

36

slide-37
SLIDE 37

Tensorial strength

A ⊗ B ⊗ TC

A⊗tB,C

  • tA⊗B,C

T(A ⊗ B ⊗ C)

A ⊗ T(B ⊗ C)

tA,B⊗C

  • 1 ⊗ TA

t

  • λ

TA

T(1 ⊗ A)

  • 37
slide-38
SLIDE 38

Tensorial strength

A ⊗ TTB

t

  • A⊗µ
  • T(A ⊗ TB)

Tt

TT(A ⊗ B)

µ

  • A ⊗ TB

t

T(A ⊗ B)

A ⊗ B

id

  • A⊗η
  • A ⊗ B

η

  • A ⊗ TB

t

T(A ⊗ B)

38

slide-39
SLIDE 39

Three illustrations

The continuation monad in any dialogue category T : A → ¬ ¬ A = (A ⊸ ⊥) ⊸ ⊥ The state monad in the category Set T : A → S ⇒ ( S × A ) The exception monad in the category Set T : A → A + E The general theory of computational monads

39

slide-40
SLIDE 40

Interpretation of a pair of computations

One chooses an order of evaluation for the pair: P, Q The order is typically left-to-right, interpreted by the morphism TA × TB −→ T(A × TB) −→ TT(A × B)

µ

−→ T(A × B).

40

slide-41
SLIDE 41

Strong monads

The enriched approach

41

slide-42
SLIDE 42

Enriched categories

An E-category C is given by — a class of objects, — an E-space C (A, B) for every pair of objects (A, B) — a composition morphism

  • :

C (B, C) ⊗ C (A, B)

−→

C (A, C)

— an identity morphism idA : I −→

C (A, A)

for all objects A, B, C. By convention, we call E-spaces the objects of the monoidal category (E, ⊗, I).

42

slide-43
SLIDE 43

Enriched categories

We require moreover that: 1— the composition law ◦ is associative. This means that the diagram

C (C, D) ⊗ C (B, C) ⊗ C (A, B)

  • ⊗ C (A,B)
  • C (C,D) ⊗◦
  • C (B, D) ⊗ C (A, B)
  • C (C, D) ⊗ C (A, C)
  • ❉ (A, D)

commutes for all objects A, B, C, D.

43

slide-44
SLIDE 44

Enriched categories

2— that the morphism id is neutral for composition. This means that the two diagrams

C (A, B)

  • C (A, B)

C (A, B) ⊗ I

C (A,B) ⊗idA

C (A, B) × C (A, A)

  • C (A, B)
  • C (A, B)

I ⊗ C (A, B)

idB ⊗C (A,B)

C (B, B) × C (A, B)

  • commute for all objects A, B.

44

slide-45
SLIDE 45

Enriched functors

An E-functor F :

C

−→

D

between E-categories is defined as – a function from the objects of C to the objects of D, – a morphism FA,B :

C(A, B)

−→

D(FA, FB)

for every pair of objects A, B in the E-category C,

45

slide-46
SLIDE 46

Enriched functors

...making the diagrams below commute:

C(B, C) ⊗ C(A, B)

FB,C ⊗ FA,B

  • D(FB, FC) ⊗ D(FA, FB)
  • C(A, C)

FA,C

D(FA, FC)

I

idA

  • idFA
  • C(A, A)

FA,A

D(FA, FA)

46

slide-47
SLIDE 47

Enriched natural transformations

An E-natural transformation

C

F

  • G

D

⇓ θ

between E-functors is given a family of morphisms FA −→ GA making the diagram

C(A, B)

FA,B

  • GA,B
  • D(FA, FB)

D(FA,θB)

  • D(GA, GB)

D(θA,GB)

D(FA, GB)

commutes for all objects A, B.

47

slide-48
SLIDE 48

The 2-category of enriched categories

The 2-category E − Cat has –

E-categories as objects

E-functors as morphisms

E-natural transformations as 2-dimensional cells.

The set of 2-cells generally defines an E-space.

48

slide-49
SLIDE 49

Strong monads as enriched monads

Suppose that the category E is symmetric monoidal closed. A well-known correspondence tells that: a strong monad T in the category E ⇐⇒ a monad on the object E in the 2-category E−Cat

49

slide-50
SLIDE 50

Tensored E-categories

A E-enriched category C is E-tensored when the functor B →

C(A, B)

:

C

−→

E

admits a left adjoint (in the enriched sense) X → X • A :

E

−→

C

for every object A of the E-enriched category C. This means that

E(X, C(A, B))

  • C(X • A, B)

50

slide-51
SLIDE 51

Tensored E-categories

Moreover, the tensor structure is equipped with

  • 1. an isomorphism

I • A

  • A

which is E-natural in A.

  • 2. an isomorphism

(X ⊗ Y) • A

  • X • (Y • A)

which is E-natural in X, Y and E. Here, we need to suppose that E is symmetric closed.

51

slide-52
SLIDE 52

Tensorial strength

A left strength on a functor F :

C

−→ D between tensored E-categories is a family of morphisms tX,A : X • FA −→ F(X • A) natural in A...

52

slide-53
SLIDE 53

Tensorial strength

...making the two diagrams commute: (X ⊗ Y) • FA

X•tY

,A

  • tX⊗Y

,A

F((X ⊗ Y) • A)

X • F(Y • A)

tX,Y•A

  • I • FA

t

  • λ

FA

F(I • A)

  • 53
slide-54
SLIDE 54

Strong natural transformation

A strong natural transformation

C

( F , σ )

  • ( G , τ )

D

⇓ θ

is a family of morphisms θA : F A −→ G A natural in A...

54

slide-55
SLIDE 55

Strong natural transformations

...making the diagram X • F(A)

σX,A

  • X• θA
  • F(X • A)

θX•A

  • X • G(A)

τX,A

G(X • A)

commute for all objects A.

55

slide-56
SLIDE 56

A correspondence between strengths and enrichments

The 2-category with –

E-tensored E-categories as objects

– strong functors as morphisms – strong natural transformations as 2-dimensional cells is isomorphic to E−Cat restricted to its E-tensored E-categories. See Kruna Segrt’s PhD manuscript for a proof

56

slide-57
SLIDE 57

Strong monads

The lax bimodule approach

57

slide-58
SLIDE 58

Lax T-module

Suppose given a 2-dimensional monad T in a 2-category B. A lax T-module is defined as a pair ( A , h ) consisting of an object A and a morphism h : TA −→ A together with a pair of 2-dimensional cells A

ηA

  • id

A

⇓ TA

h

  • TA

h

  • T2A

Th

  • µA

A TA

h

  • 58
slide-59
SLIDE 59

Lax T-module

These 2-dimensional cells are required to make the diagrams below commute:

Th µ Tµ TA TA T 2A T 2A A T 3A h Th T 2h h µ Tµ

=

TA TA Th µ h T 2A T 2A A T 3A h Th T 2h h µ Tµ

59

slide-60
SLIDE 60

Lax T-module

Th µ η TA TA TA TA A TA h id id h id id

=

TA TA h h id

TA A Th η h A T 2A A TA id id h h µ η

=

T 2A µ h A TA id η

60

slide-61
SLIDE 61

A general phenomenon of adjunctions

Given a 2-monad T and an adjunction

A

L

B

R

  • every lax T-module

TB

b

−→ B induces a lax T-module TA TL −→ TB

b

−→ B

R

−→ A

61

slide-62
SLIDE 62

A general phenomenon of adjunctions

In particular, every adjunction with a monoidal category B

A

L

B

R

  • induces a lax action of B on the category A

B × A

B×L

−→

B × B

⊗B

−→

B

R

−→

A

62

slide-63
SLIDE 63

The monadic strength as a lax bimodule

The strength A ⊗ TB

σ

−→ T(A ⊗ B) may be seen as a lax notion of bimodule: A ⊲ ( B ⊳ ∗) −→ A ⊲ (B ⊳ ∗) where B ⊳ ∗ := TB.

63

slide-64
SLIDE 64

Short bibliography of the course

On adjunctions in 2-categories:

Ross Street The formal theory of monads Journal of Pure and Applied Algebra 2 (1972) 149-168. Categorical semantics of linear logic. Survey published in « Interactive models of computation and program behaviour ». Pierre-Louis Curien, Hugo Herbelin, Jean-Louis Krivine, Paul-André Melliès. Panoramas et Synthèses 27, Société Mathématique de France, 2009.

On enriched categories:

Max Kelly Basic Concepts of Enriched Category Theory Lecture Notes in Mathematics 64, Cambridge University Press, 1982. Available online as a « Theory and Applications of Categories » reprint.

64