String diagrams
a functorial semantics of proofs and programs
Paul-André Melliès
CNRS, Université Paris Denis Diderot
Hopf-in-Lux
Luxembourg 17 July 2009
1
Connecting 2-dimensional cobordism and logic
2
Part 1
Categories as monads
3
Starting point: categories as monads
Depending on the bicategory, the point of view federates:
Enriched categories a bicategory ofV-matrices
Internal categories a bicategory of spans
Algebra a bicategory of comodules
The last connection appears in Marcelo Aguiar’s PhD thesis
4
The bicategory−−→Cat(B)
– the 0-cells are the monads (A, s) of the bicategory B
– the 1-cells
( f , f̃ ) : (A, s) // (B, t)
are the pairs consisting of a 1-cell
f : A −→ B
and of a 2-cell
f̃ : f ⊗ s ⇒ t ⊗ f : A −→ B
5
The bicategory−−→Cat(B)
Diagrammatically:
Af
//
s
��
B
t
��
f̃⇒
A f// B
satisfying the equalities below:
6
The bicategory−−→Cat(B)
Af
//
s
��
id
''
B
t
��
η ⇒ f̃ ⇒
Af
// B
=
Af
//
id
''
B
id
''
t
��
η ⇒
Af
// B
Af
//
s
��
s��������������
B
t
��
A µ ⇒
s��???????????? f̃ ⇒
Af
// B
=
Af
//
s��������������
f̃ ⇒
B
t
��
t���������������
A f //
t��???????????? B
t��>>>>>>>>>>>>>
µ ⇒
A f//
f̃ ⇒
B
7
An alternative formulation in string diagrams
= =
f
f
f
f
f
f
f
f s s
tt
s s
t t
8
The bicategory←−−Cat(B)
Same definition, except that the direction of the 2-cell changes:
Af
//
s
��
B
t
��
f̃⇐
A f// B
A kind of “fibration without its functor”
9
The 2-cells of the bicategory−−→Cat(B)
– the 2-cells
θ : f ⇒ g : s −→ t
are the 2-cells
θ : f ⇒ t ⊗ g : A −→ B
such that the diagram of 2-cells commute:
f ⊗ sf̃
+3
�
t ⊗ f θ +3 t ⊗ t ⊗ g
µ
��
t ⊗ g ⊗ sg̃
+3 t ⊗ t ⊗ gµ
+3 t ⊗ g
Reduced form
10
An alternative formulation in string diagrams
=
g
f
g
f
t
s
t
t
s
Reduced form11
The 2-cells of the bicategory−−→Cat(B)
– the 2-cells
θ : f ⇒ g : s −→ t
are the 2-cells
θ : f ⊗ s⇒ t ⊗ g : A −→ B
making the diagram of 2-cells commute:
f ⊗ s ⊗ sf̃
+3
�
t ⊗ f ⊗ s θ +3 t ⊗ t ⊗ g
µ
��
t ⊗ g ⊗ sg̃
+3 t ⊗ t ⊗ gµ
+3 t ⊗ g
Non reduced form
12
Alternative formulation in string diagrams
=
g
f
g
f
t
sss s
t
Non reduced form13
From the reduced form to the non reduced form(and conversely)
= =
f
g
f
gg
f
g
fs
tt
s
tt
14
First equation
= = =
g
f
g
f
g
f
g
f s
t t
s
t
s s
t
15
Second equation
= =
f
g
f
gg
f
t t t
16
Property of the non reduced form
= =
f
g g
f
g
f s s
t t
s
t
s s s
17
Illustration: internal categories
Given a category C with finite limits...
the bicategory−−→Cat(Span) has
– the same 0-cells as the category C,
– the 1-cells are the spans,
– the 2-cells are morphisms between spans.
Fact: a monad in Span is an internal category in C
18
Part 2
Modules between categories
categories seen as rings with several objects
19
Representation principle
Every monad (in the bicategorical sense)
t : A −→ A
induces a monad (in the categorical sense)
B(X, t) : B(X,A) −→ B(X,A)
defined by post-composition
Xf
// A 7→ Xf
// A t // A
for every 0-cell X of the bicategory B.
20
Representation principle (dual)
Dually, every monad (in the bicategorical sense)
t : A −→ A
induces a monad (in the categorical sense)
B(t,X) : B(A,X) −→ B(A,X)
defined this time by pre-composition:
Af
// X 7→ A t // Af
// X
for every 0-cell X of the bicategory B.
21
Representation principle (on both sides)
Every pair of monads (in the bicategorical sense)
s : A −→ A t : B −→ B
induces a monad (in the categorical sense)
B(s, t) : B(A,B) −→ B(A,B)
defined by pre- and post- composition:
Af
// B 7→
Af
// B
t��
A
s
OO
Bfor every 0-cell X of the bicategory B.
22
The bicategory Module(B)
– the 0-cells are the monads (A, s) of the bicategory B
– the 1-cells
(A, s) // (B, t)
are the algebras of the monad
B(s, t) : B(A,B) −→ B(A,B).
So, they are pairs ( f , φ) consisting of a 1-cell
Af
// B
23
and a 2-cell
Af
// B
t
��
⇓ φ
A
s
OO
f// B
in the bicategory B, satisfying the coherence diagrams:
The bicategory Module(B)
Af
// Bt
��==============
t
��
A
s??�������������� µ
⇒⇓ φ µ
⇐ B
t����������������
A f//
s
OO
s
__>>>>>>>>>>>>>>
B
=
Af
// Bt
��5555555555555
⇓ φ
A
sDD�������������
f // B
t��
⇓ φ
A f//
s
ZZ6666666666666
B
24
Af
// B
id
zz
t
��
η⇒
⇓ φ η⇐
A f//
s
OO
id
::
B
=
Af
// B
id
yy
⇓ id
A f//
id
99
B
The bicategory Module(B)
– the 2-cells
(A, s)
( f ,φ)
%%
(g,ψ)
99⇓ θ (B, t)
are the morphisms of B(s, t)-algèbres in the category B(A,B).
25
The bicategory Module(B)
In other words, a 2-cell
(A, s)
( f ,φ)
%%
(g,ψ)
99⇓ θ (B, t) is a 2-cell A
f
""
g
<<⇓ θ B
26
satisfying the equality:
A
f
��
B
t
��
⇓ φ
A
f
��
g
@@
s
OO
⇓ θ B
=
A
f
��
g
@@⇓ θ B
t
��
⇓ ψ
A
g
@@
s
OO
B
The bicategory Module(B)
The composite of the two 1-cells
(A, s)( f ,φ)
// (B, t)(g,ψ)
// (C,u)
is defined as the co-equalizer of the 2-cells described by the twodifferent ways to compose:
B t // B
g
��,,,,,,,,,,,,,,,,,,,,,,,
⇓�φ
A
f
II�����������������������
f
::ttttttttttttttttttttttttttttttttttttttttt g⊗ f// C
B t //
g
$$JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ B
g
��,,,,,,,,,,,,,,,,,,,,,,,
ψ� ⇓
A
f
II����������������������� g⊗ f// C
27
We make the hypothesis(1) that the category B(A,B) has coequalizers, for every A,B,(2) the horizontal composition ⊗ in B preserves these co-equalizers.
Part 3
Game cobordism
28
Dialogue categories
A symmetric monoidal category C equipped with a functor
¬ : Cop−→ C
and a natural bijection
ϕA,B,C : C(A ⊗ B , ¬C) � C(A , ¬ ( B ⊗ C ) )
¬
CBA
⊗ �
¬
CBA
⊗
29
Cobordism
30
Frobenius objects
A Frobenius object F is a monoid and a comonoid satisfying
m
d
=m
d
=m
d
an alternative formulation of cobordism
31
Frobenius objects
Equivalently, a Frobenius object F is a monoid with an isomorphism
S : F −→ F∗
to its dual object F∗ such that
S
FFF
• =
S
FFF
•
32
Lax dualities in a 3-dimensional category
LL⇒
ε
η
L
L
η
εR
R
⇒RR
33
satisfying two coherence properties (a)
η
η
L
L
R
R
is the identity 3-cell on the unit η of the 2-adjunction L a R,
34
satisfying two coherence properties (b)
ε
ε
L
L
R
R
is the identity 3-cell on the counit ε of the 2-adjunction L a R.
35
Pseudo Frobenius objects
A pseudo Frobenius object in the bicategory of modules
m
d
�m
d
�m
d
is the same thing as a ∗-autonomous category... when the two mod-ules m and e are functors.
An observation by Brian Day and Ross Street (2003)
36
Lax Frobenius objects
Relax the self-duality equivalence
C � Cop
into an adjunction
C
L%%
⊥ Cop
R
dd
this connects game semantics and quantum groups
37
Game semantics in ribbon diagrams
=
C opC opC opC opC opC op
S
C (x, y) C (x,¬ y)
Idea: replace the elementary particles by the game boards
38
Game semantics in ribbon diagrams
=
C opC opC opC opC opC op
C (x,¬ y)C (x,¬ y)
Idea: replace the elementary particles by the game boards
39
Game semantics in ribbon diagrams
=
C opC opC opC opC opC op
C (x, y)C (x,¬ y)
Idea: replace the elementary particles by the game boards
40
Conclusion
Logic = Data Structure + Duality
This point of view is accessible thanks to 2-dimensional algebra
41