when computational monads go clubbing
play

When computational monads go clubbing Category Theory 2017 - PowerPoint PPT Presentation

Pierre Cagne for Kan Extension Seminar II Universit Paris Diderot When computational monads go clubbing Category Theory 2017 Vancouver 1. Crash course in computational monads 2. Clubs 3. Strong monads 4. Computational monads as clubs


  1. Pierre Cagne for Kan Extension Seminar II Université Paris Diderot When computational monads go clubbing Category Theory 2017 – Vancouver

  2. 1. Crash course in computational monads 2. Clubs 3. Strong monads 4. Computational monads as clubs

  3. 1 Crash course in computational monads

  4. Program Modelization f : 1 → N def f(): x = input (”Enter a number:”) return 2* int (x) g : N → N def g(y): return y*y a = g(f()) b = g(f())

  5. Program Modelization f : 1 → N def f(): x = input (”Enter a number:”) return 2* int (x) g : N → N def g(y): return y*y a = g(f()) Hence f is just a constant integer n ∈ N , b = g(f()) and we should get a = b = g ( n ) ...

  6. Program Modelization f : 1 → N N def f(): x = input (”Enter a number:”) return 2* int (x) g : N → N def g(y): return y*y a = g(f()) Now f is not constant anymore. b = g(f())

  7. Program Modelization f : 1 → N N def f(): x = input (”Enter a number:”) return 2* int (x) g : N → N def g(y): return y*y a = g(f()) Now f is not constant anymore. b = g(f()) But how to compose g with f now?

  8. Program Modelization f : 1 → N N def f(): x = input (”Enter a number:”) return 2* int (x) g : N → N def g(y): return y*y a = g(f()) Now f is not constant anymore. b = g(f()) But how to compose g with f now? Use Kleisli composition of the monad ( − ) N : Set → Set

  9. Program Modelization f : N 2 → N def f(a,b): if b == 0: raise Error else : return a/b g : N → N def g(y): return y*y a = g(f(4,0)) b = g(f(4,2))

  10. Program Modelization f : N 2 → N def f(a,b): if b == 0: raise Error else : return a/b g : N → N def g(y): return y*y a = g(f(4,0)) Hence a as well as b should have a b = g(f(4,2)) defined value in N ...

  11. Program Modelization f : N 2 → N + e def f(a,b): if b == 0: raise Error else : return a/b g : N → N def g(y): return y*y a = g(f(4,0)) e is a singleton b = g(f(4,2)) Now f is only partially defined.

  12. Program Modelization f : N 2 → N + e def f(a,b): if b == 0: raise Error else : return a/b g : N → N def g(y): return y*y a = g(f(4,0)) e is a singleton b = g(f(4,2)) Now f is only partially defined. But how to compose g with f now?

  13. Program Modelization f : N 2 → N + e def f(a,b): if b == 0: raise Error else : return a/b g : N → N def g(y): return y*y a = g(f(4,0)) e is a singleton b = g(f(4,2)) Now f is only partially defined. But how to compose g with f now? Use Kleisli composition of the monad − + e : Set → Set

  14. Distinguish values (objects A ) from computations (images TA ). Programs are interpreted by morphisms A TB . Composition of programs occurs in the Kleisli category of T . (One wants good properties for T : strong, pullbacks preserving, etc.) Big picture (Moggi) Side effects of a programming language can be encoded by a monad T .

  15. Programs are interpreted by morphisms A TB . Composition of programs occurs in the Kleisli category of T . (One wants good properties for T : strong, pullbacks preserving, etc.) Big picture (Moggi) Side effects of a programming language can be encoded by a monad T . Distinguish values (objects A ) from computations (images TA ).

  16. (One wants good properties for T : strong, pullbacks preserving, etc.) Big picture (Moggi) Side effects of a programming language can be encoded by a monad T . Distinguish values (objects A ) from computations (images TA ). Programs are interpreted by morphisms A → TB . Composition of programs occurs in the Kleisli category of T .

  17. Big picture (Moggi) Side effects of a programming language can be encoded by a monad T . Distinguish values (objects A ) from computations (images TA ). Programs are interpreted by morphisms A → TB . Composition of programs occurs in the Kleisli category of T . (One wants good properties for T : strong, pullbacks preserving, etc.)

  18. 2 Clubs

  19. S is cartesian when each T TX SX TX SY Definition (Clubs) is a pullback square. A monad S j n on is a club whenever S is monoidal for: n S T S T S TT SS Remark : in particular, cartesian monads are clubs. Idea When has a terminal , exploits the equivalence S S . Clubs over S are now easily spotted as monoids in S . Clubs M : cartesian natural transformations in [ A , A ] .

  20. Definition (Clubs) A monad S j n on is a club whenever S is monoidal for: n S T S T S TT SS Remark : in particular, cartesian monads are clubs. Idea When has a terminal , exploits the equivalence S S . Clubs over S are now easily spotted as monoids in S . Clubs α : T → S is cartesian when each M : cartesian natural transformations in [ A , A ] . TX SX TX SY is a pullback square.

  21. S is cartesian when each T TX SX TX SY is a pullback square. Remark : in particular, cartesian monads are clubs. Idea When has a terminal , exploits the equivalence S S . Clubs over S are now easily spotted as monoids in S . Clubs M : cartesian natural transformations in [ A , A ] . Definition (Clubs) A monad ( S , j , n ) on A is a club whenever M / S is monoidal for: n → S ) = TT ′ αβ β α ( T → S ) ⊗ ( T ′ → SS → S

  22. S is cartesian when each T TX SX TX SY is a pullback square. Idea When has a terminal , exploits the equivalence S S . Clubs over S are now easily spotted as monoids in S . Clubs M : cartesian natural transformations in [ A , A ] . Definition (Clubs) A monad ( S , j , n ) on A is a club whenever M / S is monoidal for: n → S ) = TT ′ αβ β α ( T → S ) ⊗ ( T ′ → SS → S Remark : in particular, cartesian monads are clubs.

  23. S is cartesian when each T TX SX TX SY is a pullback square. Clubs M : cartesian natural transformations in [ A , A ] . Definition (Clubs) A monad ( S , j , n ) on A is a club whenever M / S is monoidal for: n → S ) = TT ′ αβ β α ( T → S ) ⊗ ( T ′ → SS → S Remark : in particular, cartesian monads are clubs. Idea When A has a terminal 1 , exploits the equivalence A / S 1 ≃ M / S . Clubs over S are now easily spotted as monoids in A / S 1 .

  24. Remark Warning Reminiscent of the operadic Highly non symmetric! substitution product. Tensoring in A / S 1 g f For K → S 1 and X → S 1 , the tensor f ⊗ g is obtained as: K × S 1 SX K � f SX S 1 S ( g ) SS 1 n 1 S 1

  25. Tensoring in A / S 1 g f For K → S 1 and X → S 1 , the tensor f ⊗ g is obtained as: K × S 1 SX K � f SX S 1 S ( g ) SS 1 n 1 S 1 Remark Warning Reminiscent of the operadic Highly non symmetric! substitution product.

  26. Definition A -monad S j n on a -category is a enriched club whenever S j n is an ordinary one on . Key feature There is still a one-to-one correspondance between clubs over S and monoids in S . Enriched clubs V : “nice” cartesian closed category

  27. Key feature There is still a one-to-one correspondance between clubs over S and monoids in S . Enriched clubs V : “nice” cartesian closed category Definition A V -monad ( S , j , n ) on a V -category A is a enriched club whenever ( S 0 , j , n ) is an ordinary one on A 0 .

  28. Enriched clubs V : “nice” cartesian closed category Definition A V -monad ( S , j , n ) on a V -category A is a enriched club whenever ( S 0 , j , n ) is an ordinary one on A 0 . Key feature There is still a one-to-one correspondance between clubs over S and monoids in A 0 / S 0 1 .

  29. 3 Strong monads

  30. A -monad is then an ordinary monad T j n on together with a natural map SA C S A C that makes T a strong monad. A C Conclusion Cartesian strong monads are enriched clubs. Conversely, -clubs are good enough to be effects. Every category is canonically enriched Fact Every small category A with products is enriched over V = Psh ( A ) , by defining A ( A , B ) : C �→ A ( A × C , B )

  31. Conclusion Cartesian strong monads are enriched clubs. Conversely, -clubs are good enough to be effects. Every category is canonically enriched Fact Every small category A with products is enriched over V = Psh ( A ) , by defining A ( A , B ) : C �→ A ( A × C , B ) A V -monad is then an ordinary monad ( T 0 , j , n ) on A together with a natural map σ A , C : SA × C → S ( A × C ) that makes T 0 a strong monad.

  32. Every category is canonically enriched Fact Every small category A with products is enriched over V = Psh ( A ) , by defining A ( A , B ) : C �→ A ( A × C , B ) A V -monad is then an ordinary monad ( T 0 , j , n ) on A together with a natural map σ A , C : SA × C → S ( A × C ) that makes T 0 a strong monad. Conclusion Cartesian strong monads are enriched clubs. Conversely, V -clubs are good enough to be effects.

  33. 4 Computational monads as clubs

  34. The monad S Set Set is strong and cartesian. Hence it is an enriched club, and clubs over S are easily spotted as monoids in Set e . Those are M K e e where M is a plain monoid, which induces the club T X M X K e e Clubs over Error Take A = Set for the following.

  35. Hence it is an enriched club, and clubs over S are easily spotted as monoids in Set e . Those are M K e e where M is a plain monoid, which induces the club T X M X K e Clubs over Error Take A = Set for the following. The monad S = − + e : Set → Set is strong and cartesian.

  36. Those are M K e e where M is a plain monoid, which induces the club T X M X K e Clubs over Error Take A = Set for the following. The monad S = − + e : Set → Set is strong and cartesian. Hence it is an enriched club, and clubs over S are easily spotted as monoids in Set /1 + e .

Recommend


More recommend