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 Crash course in computational monads
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())
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 ) ...
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())
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?
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
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))
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 ...
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.
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?
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
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 .
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 ).
(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 .
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.)
2 Clubs
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 ] .
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.
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
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.
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 .
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
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.
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
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 .
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 .
3 Strong monads
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 )
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.
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.
4 Computational monads as clubs
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.
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.
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