What is a good process semantics?

Robin Cockett [email protected]

University of Calgary

Estonia 2006: What is a good process semantics? July, 2006 – p. 1/61 What is a good process semantics?

1. Where are we? Where should we be? 2. Communication on a channel. 3. Polycategories and representability. 4. Communication on many channels. 5. Communication protocols.

Estonia 2006: What is a good process semantics? July, 2006 – p. 2/61 1. Where are we?

Where should we be?

Estonia 2006: What is a good process semantics? July, 2006 – p. 3/61 Distributed computing: the reality ...

In the 1970’s networks, parallel, and distributed computing was going to solve everything! Practitioners pushed back with “the fallacies” (Joy, Lyon, Deutsch, Gosling): The network is reliable. Latency is zero. Bandwidth is infinite The network is secure. Topology doesn’t change. Transport cost is zero. The network is homogeneous. Computing had blindly entered a new world of expectation and connectedness!

There was no turning back ...

Estonia 2006: What is a good process semantics? July, 2006 – p. 4/61 Practice ahead of theory ...

Where was the theory?

Where was the mathematics of processes, concurrency, communication? Was the theory only develop in response to practice? Was theory simply modeling practice? Should it? Was there a need to develop new theory ...... or was it just taking time to link existing theory and practice?

Does mathematics have anything insightful to say about communicating processes?

Estonia 2006: What is a good process semantics? July, 2006 – p. 5/61 A brief history of process semantics ...

Petri nets, C. A. Petri (1962). Communicating Sequential Processes (CSP), C. A. R. Hoare (1978). Calculus of Communicating Processes (CCS), R. Milner (1979) [book (1989)]. Algebra of Communicating Processes (ACP), J. Bergstra and J. W. Klop (1982). Robin Milner’s quest to find the “λ-calculus of concurrency” produced the π-calculus with J. Parrow (1992) [book (1999)]. Others: ambient calculus L. Cardelli, A.D. Gordon), PEPA (J. Hillston), the fusion calculus (J. Parrow and B. Victor), the spy calculus (M. Abadi and A. Gordon), ... “What are the fundamental structures of concurrency? We still don’t know!” “Is this profusion a scandal of our subject: I used to think so ... now I am not so sure.” Samson Abramsky (2005)

Estonia 2006: What is a good process semantics? July, 2006 – p. 6/61 The complaint ...

Abramsky’s complaints: No Church’s thesis for concurrency ... A tool kit: no unified theory ... Plasticity of definition, carvings in snow: no bedrock ... A profusion of syntax but no semantics ... Physics (quantum computing) and biology (biological modeling) are at our gates: what do we have to show them?

Abramsky’s resolution: Should we expect more than a tool kit? The tool kit is not so bad: bisimulation, hiding, scope extrusion, ... The subject covers a wide range of phenomena ...

Estonia 2006: What is a good process semantics? July, 2006 – p. 7/61 So what is a good process semantics?

______Operational behaviors _ _ _6 _ _O _ _ i _ _

Term logic o / Categorical doctrine hPP kk5 PPP kkk PP kkk PPP kkk PP( ukkk Proof theory

_ _ _) _ _ _ _ _ _ Mathematical models ______

Estonia 2006: What is a good process semantics? July, 2006 – p. 8/61 What is missing?

Term logic: A convenient programming language: the focus of recent work. Categorical doctrine: The algebraic semantics: why is it important? Universally given constructs (properties versus structure). Basic equational rules of equality: allowing (localized) program transformations. Compositional semantics: allowing program construction. Modular description: allows “feature” addition with control over their interactions. Interface to mathematics: models of these settings with different properties. Proof theory: Detailed behavior of the free term model: Term construction Type inference and checking. Compositional behavior from cut elimination.

Estonia 2006: What is a good process semantics? July, 2006 – p. 9/61 ... in other words

BISIMULATION

SUCKS

Estonia 2006: What is a good process semantics? July, 2006 – p. 10/61 So where are we?

Still developing the mathematics!!

... but we are further along than you might think!

Estonia 2006: What is a good process semantics? July, 2006 – p. 11/61 2.

Communication on a channel

(A surprising bit of bedrock!)

Estonia 2006: What is a good process semantics? July, 2006 – p. 12/61 Products and coproducts

Abelian groups, suplattices, relations: A + B = A × B (biproducts) Sets, topoi, cartesian closed categories, extensive and distributive categories A + B = A t B (disjoint union) A × B (cartesian product) A × (B + C) =∼ (A × B) + (A × C)

In all these settings the product and coproducts satisfy some very special properties!

What does ΣΠ(A) the category with free products and coproducts generated by the category A look like? Andre Joyal: Free bicomplete categories.

Estonia 2006: What is a good process semantics? July, 2006 – p. 13/61 Products

Y p7 ? 1 ppp f1 pp  ppp  pp  Π1 pp  Π (f); g = Π (f; g) ppp  k k pp  . X / i Yi . f; (gi)i∈I = (f; gi)i∈I N (f ) . NNNi i ?? NNQ ? (fi)i∈I ; Πk(g) = fk; g NN ?? Πn NNN ? fn NN ?? NN ?? NN' YN where

Πk i Yi / Yk EE Q E Π ; f = Π (f) and Π = Π (1 ) EE f k k k k Yk Πk(f) EE E"  Z

Estonia 2006: What is a good process semantics? July, 2006 – p. 14/61 Coproducts

X 1 ?OO ??OOO ? OO g1 ?? OOO q1 ? OO ?? OO f; q (g) = q (f; g) ? OOO k k . O' . i Xi / Y hfj ij∈J ; g = hfj ; gij∈J . hgii o7 ? oo ‘ oo qk(f); hgj ij∈J = f; gk qn  oo  ooo  oo gn  ooo ooo Xn where

qk Xk / j Yj O y< y ‘ f; q = q (f) and q = q (1 ) f yy k k k k Xk yy qk(f) yy Z

Estonia 2006: What is a good process semantics? July, 2006 – p. 15/61 Interactions

X1 / Y1 < h11 A << ÒÒ << ÒÒ << ÒÒ hn1< Ò . < Ò . h(hij )iij =(hhij ij )i . h <Ò . gives Y . 1mÒÒ << . i Xi / j j ÒÒ << Ò < ‘ Q ÒÒ << ÒÒ < Xn / Yn hnm and some other basic equalities:

Πi(qj (f)) = qj (Πi(f)) Πk((gi)i) = (Πk(gi))i qk (hfj ij ) = hqk(fj )ij

Estonia 2006: What is a good process semantics? July, 2006 – p. 16/61 Logic of products and coproducts

id A `1A A

{Xj `fj Y }j∈J {X `g Yi}i∈I cotuple i tuple j Xj `hfj ij∈J Y X `(gi)i∈I i Yi ‘ Q

X `f Yk Xk `f Y coproj proj X `qk(f) i∈I Yi i∈I Xi `Πk(f) Y ‘ Q

X `f Y Y `g Z cut X `f;g Z

Estonia 2006: What is a good process semantics? July, 2006 – p. 17/61 Cut elimination

... is rewriting modulo equations:

f; 1 +3 f 1; f +3 f f; qk(g) +3 qk(f; g) qk(hfj ij ) hqk(fj )ij Πk(f); g +3 Πk(f; g) Πk((fi)i) (Πk(fi))i hfiii; g +3 hfi; gii Πi(qj (f)) qj (Πi(f)) f; (gi)i +3 (f; gi)i (hfij ii)j h(fij )j ii

qk(f); hgiii +3 f; gk

(fi)i; Πk(g) +3 fk; g

Estonia 2006: What is a good process semantics? July, 2006 – p. 18/61 Process reading ...

k Output “k” on the right = qk(f) ()*+/.-,f

k Output “k” on the left = Πk(g) ()*+/.-,g

4@ ~ @ Listen for input on the left = hf1, f2i ~~ @ 01237654f1 01237654f2

N { CC Listen for input on the right = (g , g ) {{ C 1 2 01237654g1 01237654g2

Estonia 2006: What is a good process semantics? July, 2006 – p. 19/61 Process reading of a map ...

h(Π1(1A), q1(Π2(1B ))) , (Π1(1A), q2(Π2(1C )))i (A × B) + (A × C) / A × (B + C)

q◦MM •6 qq MM ÑÑ 66 qqq MMM 4 ÑÑ 6 •6q •6 p NN Ñ 6 Ø 6 Ø 6 ppp NNN ()*+/.-,A ◦2 Ø 66 Ø 66 Npp NN 2 ØØ ØØ == == 22 A B A C ÒÒ == ÒÒ == 2 ()/.*+-, ()*+/.-, ()*+/.-, ()*+/.-, ÒÒ  ÒÒ  1 1 1 2 ()*+/.-,B ()/.C*+-,   012376541A 2 01761A2354 2

89:;?>=<1B 01761C2354

Estonia 2006: What is a good process semantics? July, 2006 – p. 20/61 Process reading of the identities ...

 4 N  k : < k Ô : ÒÒ << ÔÔ :: ÒÒ << = Ô  Ò  = N 4 k k k k < Õ 99 Ò < ÕÕ 99 ÒÒ << ÕÕ 9 ÒÒ < ()*+/.-,f ()*+/.-,g ()/.f*+-, ()*+/.-,g ()*+/.-,f ()*+/.-,g ()/.f*+-, ()*+/.-,g

  N k j 4K s KK ss KKK ss KK sss KK ss KKK  =  Nss KN = 4ss 4 j k 4 4 4 4 44 44 44 44 4 4 4 4 ()/.f*+-, ()*+/.-,f 89:;?>=f12:;=< 89?>f21:;=< 89?>f22:;=< 89?>f11:;=< 89?>f12:;=< 89:;?>=f22:;=<

Estonia 2006: What is a good process semantics? July, 2006 – p. 21/61 Slogan

The logic of products and coproducts is the logic of communication along a channel.

Joyal: “... the mathematics is saying something.”

Estonia 2006: What is a good process semantics? July, 2006 – p. 22/61 Different readings ...

TYPE THEORY CATEGORIES PROOF THEORY PROCESSES GAMES

Type Object Proposition Protocol Game

Terms Map Proof Process Mediator

Substitution Composition Cut Communication Composition

Variables Identities (Identity) axioms Relay Copy cat

Joyal and Santocanale used the reading of games and mediators (Blass) ... Cockett and Seely used the reading of propositions and proofs ... Pastro used the reading as protocols and processes ...... just products and coproducts.

Estonia 2006: What is a good process semantics? July, 2006 – p. 23/61 Homework:

J.R.B. Cockett and R.A.G. Seely, Finite sum-product logic, TAC 8, 63–99.

Not everything is sorted out!!

The initial and final maps (the additive units) make things more complicated.

Estonia 2006: What is a good process semantics? July, 2006 – p. 24/61 The additive units ...

In ΣΠ(A) coprojections are not necessarily monic but they are weakly disjoint (Cockett and Santocanale):

X 0QQQ 0 QQ f 0 c QQQ 0 QQQ 00 QQQ 0 QQ( g 00 0 / A 00 00 q1 0   B / A + B q2

When there are no additive units equality is easy (algorithm in above paper). In the presence of additive units the complexity of equality is still not known (Luigi Santocanale)! What is their meaning in communication? ... what happens when one party stops listening!

Estonia 2006: What is a good process semantics? July, 2006 – p. 25/61 3.

Polycategories and representation

Estonia 2006: What is a good process semantics? July, 2006 – p. 26/61 Processes connected to many channels

U UUUUα1 β1 iiii UUUU iiii P i ii UUU iαii UUU iiii m βn UUU

α1 : X1, . . . , αm : Xm `P β1 : Y1, . . . , βn : Yn

X1, .., Xm, Y1, ..., Yn are protocols ... These are types determine which events can happen next on each channel (e.g. given by products and coproduct types).

A process can listen or output to any channel to which it is attached. The process is the system and it communicates with its environment.

Estonia 2006: What is a good process semantics? July, 2006 – p. 27/61 Communication

Plugging processes together ...

UU α1 β1 dddd UUUU ddddddd UUU ddddddd P dddd iii MM βn iiαim M iii MMM ψ MM δ1 jj MM jjjj γ1 jjj ddd Q T ddddddd TTT dddddγp δ TTT ddddddd q TT

The combined processes become a composite process with the communication on ψ hidden.

Estonia 2006: What is a good process semantics? July, 2006 – p. 28/61 Miscommunications ...

Plugging processes together in the wrong way can cause or livelock ...

α1=β1 @GF ECD P ii UUU iαii UUU iiii m βn UUU Don’t plug a process to itself..

TT α1 β1=γ1 δ1 j TTTT jjjj TTT jjjj P Q T jjjj TTTT jjα2 β =γ δ2 TT jjj 2 2 TT Don’t connect two processes in two different ways ..

Estonia 2006: What is a good process semantics? July, 2006 – p. 29/61 Polycategories

A polycategory P consists of the data

objects: X1, . . . , Y1, . . . ∈ P0 polymaps: ∀m, n ∈ N a set

P(X1, . . . , Xm ; Y1, . . . , Yn)

identities: for each X ∈ P0 a polymap 1X ∈ P(X; X). composition (cut): A map

P(Γ; ∆1, X, ∆2) × P(Γ1, X, Γ2; ∆) / P(Γ1, Γ, Γ2; ∆1, ∆, ∆2)

where Γ1 or ∆1 is empty and Γ2 or ∆2 is empty. such that identities are identities and cut satisfies associativity and interchange. A polycategory is symmetric in case P(σΓ; τ∆) = P(Γ; ∆) for permutations σ and τ, and certain obvious coherence conditions hold.

Estonia 2006: What is a good process semantics? July, 2006 – p. 30/61 Polycategories

X1 Xn ···

X1, . . . , Xn `f Y1, . . . , Ym f ··· Y1 Ym

Composition is modeled by the cut rule

Γ Γ0

0 Γ `f ∆, γ : Z γ : Z, Γ `g ∆ f 0 0 γ Γ, Γ `f;γ g ∆, ∆ g

∆ ∆0

Composition must have identities (these are wires) ..

Estonia 2006: What is a good process semantics? July, 2006 – p. 31/61 Polycategories

Composition must satisfy the interchange and associative laws

f f αE α β g g h β h

When polycategories are symmetric crossing wires are allowed.

Estonia 2006: What is a good process semantics? July, 2006 – p. 32/61 Pure proof theory of cut-elimination

Symmetric polycategories are the categorical proof theory for cut-elimination. id A `1A A

Γ1, X1, X2, Γ2 ` Γ Γ ` Γ1, X1, X2, Γ2 exchange exchange Γ1, X2, X1, Γ2 ` Γ Γ ` Γ1, X2, X1, Γ2

Γ1 ` Γ2, X X, ∆1 ` ∆2 Γ1 ` X, Γ2 ∆1, X ` ∆2 cut cut Γ1, ∆1 ` Γ2, ∆2 ∆1, Γ1 ` ∆2, Γ2

Γ ` X ∆1, X, ∆2 ` ∆ Γ ` Γ1, X, Γ2 X ` ∆ cut cut ∆1, Γ, ∆2 ` ∆ Γ ` Γ1, ∆, Γ2

Estonia 2006: What is a good process semantics? July, 2006 – p. 33/61 Representability

A polycategory is representable in case there are polynatural equivalences

r P ⊗ P (Γ1, X, Y, Γ2; ∆) ∼ / (Γ1, X ⊗ Y, Γ2; ∆) r P > P (Γ1, Γ2; ∆) ∼ / (Γ1, >, Γ2; ∆) r P ⊕ P (Γ; ∆1, X, Y, ∆2) ∼ / (Γ; ∆1, X ⊕ Y, ∆2) r P ⊥ P (Γ; ∆1, ∆2) ∼ / (Γ; ∆1, ⊥, ∆2)

Replace the commas with composite types ...

Polynatural means that the transformation is invariant under cutting into the non-active position ...

Representability was introduced by Burroni (and used by Hermida) to simplify coherence for bicategories (and tricategories). In any polycategory having tensors is a property (representability) rather than extra structure.

Estonia 2006: What is a good process semantics? July, 2006 – p. 34/61 The multiplicatives

Representability can be presented by sequent calculus rules of inference:

Γ1, Γ2 ` ∆ Γ ` ∆1, ∆2 split > split ⊥ Γ1, >, Γ2 ` ∆ Γ ` ∆1, ⊥, ∆2

Γ1, A, B, Γ2 ` ∆ Γ ` ∆1, A, B, ∆2 split ⊗ split ⊕ Γ1, A ⊗ B, Γ2 ` ∆ Γ ` ∆1, A ⊕ B, ∆2

Γ ` ` ∆ fork > fork ⊥ Γ ` > ⊥ ` ∆

Γ1 ` ∆1, A Γ2 ` B, ∆2 Γ1, A ` ∆1 Γ2, B ` ∆2 fork ⊗ fork ⊕ Γ1, Γ2 ` ∆1, A ⊗ B, ∆2 Γ1, A ⊕ B, Γ2 ` ∆1, ∆2

Estonia 2006: What is a good process semantics? July, 2006 – p. 35/61 Simple derivations

Here is a derivation of the associativity isomorphism:

B ` B C ` C fork A ` A B, C ` B ⊗ C fork A, B, C ` A ⊗ (B ⊗ C) split (A ⊗ B), C ` A ⊗ (B ⊗ C) split (A ⊗ B) ⊗ C ` A ⊗ (B ⊗ C)

Estonia 2006: What is a good process semantics? July, 2006 – p. 36/61 Linearly distributive categories

Theorem 1. Representable polycategories correspond precisely to linearly distributive categories.

That is in a representable polycategory: ⊗, > and ⊕, ⊥ become monoidal structure. There are coherent natural transformations

δL : A ⊗ (B ⊕ C) / (A ⊗ B) ⊕ C

δR : (B ⊕ C) ⊗ A / B ⊕ (C ⊗ A)

called the linear distributions.

Estonia 2006: What is a good process semantics? July, 2006 – p. 37/61 Linear distributivity

Cockett and Seely Weakly distributive categories (now known as linearly distributive categories to emphasize the link to Girard’s linear logic). Here is the derivation of one of the linear distributions:

A ` A B ` B fork ⊗ A, B ` A ⊗ B C ` C fork ⊕ A, B ⊕ C ` A ⊗ B, C split A ⊗ (B ⊕ C) ` (A ⊗ B) ⊕ C

There are many coherence requirements but they are all very natural. A typical coherence requirement is: A ⊗ (B ⊗ (C ⊕ D)) (A ⊗ B) ⊗ (C ⊕ D)) a⊗ /

1⊗δL  A ⊗ ((B ⊗ C) ⊕ D) δL

δL   (A ⊗ (B ⊗ C)) ⊕ D / ((A ⊗ B) ⊗ C) ⊕ D a⊗⊕1

Estonia 2006: What is a good process semantics? July, 2006 – p. 38/61 Examples

A distributive lattice ∧ = ⊗, ∨ = ⊕ (not *-autonomous). A distributive category is a linearly distributive category (with respect to the product and coproduct and the obvious linear distribution) if and only if it is a poset. Any monoidal category is a degenerately a linear distributive category. Any ∗-autonomous category is a linearly distributive category. Any compact closed category is ∗-autonomous. (Joyal) Bicompletions of monoidal / linearly distributive categories are linearly distributive (generally not *-autonomous). (Koslowski) Sets with cartesian product and the following “par”

A if B = 0 A ⊕ B = 8 B if A = 0 > < 1 otherwise > :> is a linearly distributive category (but is not *-autonomous).

Estonia 2006: What is a good process semantics? July, 2006 – p. 39/61 Units again ..

Units cause big problems: If you are French you pretend they don’t exist! This is not wise ... because even if you don’t mention them they are implicitly present. If you are Canadian you think they are the main interest of these settings!! A decision procedure for equality of maps in the symmetric case is known. It is open as to what the complexity of this decision problem is ... (conjecture: it is coNP?). A decision procedure for equality of maps in special cases of the non-symmetric case is known. Blute, Cockett, Seely, Trimble Natural deduction and coherence for weakly distributive categories. JPAA 1996. Schneck Natural deduction and coherence for non-symmetric linearly distributive categories. TAC 1999

Estonia 2006: What is a good process semantics? July, 2006 – p. 40/61 4.

Communication on many channels

Estonia 2006: What is a good process semantics? July, 2006 – p. 41/61 Polyproducts and polycoproducts

There are polynatural equivalences

r P + P P (Γ1, X + Y, Γ2; ∆) ∼ / (Γ1, X, Γ2; ∆) × (Γ1, Y, Γ2; ∆) P r0 (Γ1, 0, Γ2; ∆) ∼ / 1 r P × P P (Γ; ∆1, X × Y, ∆2) ∼ / (Γ; ∆1, X, ∆2) × (Γ; ∆1, Y, ∆2)

P r1 (Γ; ∆1, ∆2) ∼ / 1

When P is representable we have

X ⊗ (A + B) =∼ (X ⊗ A) + (X ⊗ B) and (A + B) ⊕ Y =∼ (A ⊕ Y ) + (B ⊕ Y ).

P(Γ, X ⊗ A, Γ0; ∆) P(Γ, X ⊗ B, Γ0; ∆) e.g. P(Γ, X, A, Γ0; ∆) P(Γ, X, B, Γ0; ∆) P(Γ, X, (A + B), Γ0; ∆) P(Γ, X ⊗ (A + B), Γ0; ∆)

Estonia 2006: What is a good process semantics? July, 2006 – p. 42/61 Polylogic of products and coproducts

id A `1A A

{Γ1, α : Xj , Γ2 `Pj Γ3}j {Γ1 `Q Γ2, α : Yi, Γ3}i cotuple i tuple Γ1, α : j Xj , Γ2 `αhPj ij Γ3 Γ1 `αhQiii Γ2, α : i Yi, Γ3 ‘ Q

Γ1 `P Γ2, α : Yk, Γ3 Γ1, α : Xk, Γ2 `Q Γ3 coproj proj Γ1 `α[k]·P Γ2, α : i Yi, Γ3 Γ1, α : i Xi, Γ2 `α[k]·Q Γ3 ‘ Q

Γ1 `P Γ2, α : X, Γ3 ∆1, α : X, ∆2 `Q ∆3 cut ∆1, Γ1, ∆2 `P ;αQ Γ2, ∆3, Γ3

Estonia 2006: What is a good process semantics? July, 2006 – p. 43/61 Cut elimination ...

... is rewriting modulo equations:

α 6= β

(α[k] · P ) ;γ Q +3 α[k] · (P ;γ Q) P ;γ (β[k] · Q) +3 β[k] · (P ;γ Q) αhβhPij ij ii βhαhPij iiij αhPiii ;γ Q +3 αhPi ;γ Qii α[k] · βhPj ij βhα[k] · Pj ij P ;γ βhQj ij +3 βhP ;γ Qj ij α[k] · β[l] · P β[l] · α[k] · P γ[k] · P ;γ γhQj ij +3 P ;γ Qk

γhPiii ;γ γ[k] · Q +3 Pk ;γ Q

Estonia 2006: What is a good process semantics? July, 2006 – p. 44/61 A multi-channel process example f : A, E / G, I g : B, E / G, J

h : C, F / H, I k : D, F / H, K

◦ ◦ 0 3 0 a y EE b a 3 b y E γ : 0 33 1 0 yy EE 1 Ö  y| y E" G H α : • • B C B 2 2 C B c 2 d e 2 f C @ A B 22 22 C B Ö  Ö  C −−−−−−−−→ • B A B C D C 0 1 0 B C c 1 d @ A 0 11 1 • Ö  δ : I ◦ g 2 B C 2 h B 0 2 0 C β : 0 22 1 B e 22f C Õ  B 2 C E F B Ö  C B C B J K C @ A B C @ A c0 7→ α[c](f) a 7→ β[g](γ[a0](δ )) 0 d0 7→ α[d](δ[e0](g)) 1 α * @ c0 7→ α[e](h) A + b 7→ β[h](γ[b0](δ )) 0 d0 7→ α[f](δ[f 0](k)) 1 @ A

Estonia 2006: What is a good process semantics? July, 2006 – p. 45/61 An example of cut-elimination

Suppose f : A / D, g : B / C, and h : D / E are atomic axioms.

α γ β ◦ ◦ ◦ - . - a - c . e - f  - b −−−−−−−−−−−−−−−−→  . d −−−−−−−−−−−−−−−−−−→  - Ø  - Ø  . Ø  - A B a 7→ γ[c](f) C D c 7→ β[f](1C ) E C α γ * b 7→ γ[d](g) + 0 d 7→ β[e](h) 1 @ A

Estonia 2006: What is a good process semantics? July, 2006 – p. 46/61 An example cont.

a 7→ γ[c](f) c 7→ β[f](h) α ;γ γ * b 7→ γ[d](g) + 0 d 7→ β[e](1C ) 1 @ A c 7→ β[f](h) a 7→ γ[c](f) ;γ γ 0 d 7→ β[e](1C ) 1 ⇒ α * @ c 7→ β[f](h) A + b 7→ γ[d](g) ;γ γ 0 d 7→ β[e](1C ) 1 @ A a 7→ f;γ β[f](h) a 7→ β[f](f;γ h) a 7→ β[f](f;γ h) ⇒ α ⇒ α ⇒ α * b 7→ g;γ β[e](1C ) + * b 7→ β[e](g;γ 1C ) + * b 7→ β[e](g) +

α β ◦ • 2 2 f a 22b −−−−−−−−−−−−−→ e 22 Ö 2 Õ 2 A B E C

Estonia 2006: What is a good process semantics? July, 2006 – p. 47/61 Forking and splitting

Γ1, α1 : X, α2 : Y, Γ2 `P Γ3 Γ1 `Q Γ2, β1 : X, β2 : Y, Γ3

Γ1, α : X ⊗ Y, Γ2 `αhα1,α27→P i Γ3 Γ1 `βhβ1,β27→Qi Γ2, β : X ⊗ Y, Γ3

γ1 : Γ1 `P γ2 : Γ2, α1 : X δ1 : ∆1 `Q α2 : Y, δ2 : ∆2

γ1 : Γ1, δ1 : ∆1 ` γ2 : Γ2, α : X ⊗ Y, δ2 : ∆2 α1 | γ1, γ2 7→ P α * α2 | δ1, δ2 7→ Q +

βhβ1, β2 7→ Qi ≡ split β as β1, β2 in Q

α1 | γ1, γ2 7→ P α1 | γ1, γ2 7→ P α ≡ fork α as * α2 | δ1, δ2 7→ Q + α2 | δ1, δ2 7→ Q

Estonia 2006: What is a good process semantics? July, 2006 – p. 48/61 More rewrites and identities

α | Λ 7→ f γ ;γ γh(α, β) 7→ hi +3 g;β (f;α h)) * β | Φ 7→ g +

α1 | Λ1 7→ f α1 | Λ1 7→ f a1 7→ α 0 * α2 | Λ2 7→ g1 + 1 α a1 7→ g1 β * α2 | Λ2 7→ β + B α1 | Λ1 7→ f C 0 1 B C a2 7→ g2 B a2 7→ α C B * α2 | Λ2 7→ g2 + C @ A B C @ A There are many more identities. See Cockett and Pastro, A language for multiplicative-additive linear logic, ENTCS, 2005.

The multiplicative-additive fragment has map equality decidable. However, the complexity of deciding equality is unknown. The unit-free case was handled very neatly by: Hughes and Glabbeek, Proof nets for unit-free multiplicative-additive linear logic, LICS 2003.

Work in progress: Craig Pastro and I have a detailed process reading of the initial additive ∗-autonomous category. The system uses rules which respond to histories of interaction.

Estonia 2006: What is a good process semantics? July, 2006 – p. 49/61 5.

Communication Protocols

Estonia 2006: What is a good process semantics? July, 2006 – p. 50/61 Protocols

So far we have only handled simple protocols (using products and coproducts) which are finite. More sophisticated protocols can be introduced through datatypes. There are two formulations: Lambek style datatypes: the fixed point formulation of inductive and coinductive datatypes. Mendler style datatypes (Vene, Uustalu) and circular style datatypes (Santocanale). ... for polycategories only the second formulation works.

Estonia 2006: What is a good process semantics? July, 2006 – p. 51/61 Inductive datatypes

X a category and F : X −→ X an endofunctor. An inductive datatype for F is an object µx.F (x) ∈ X together with a map

consF : F (µx.F (x)) −→ µx.F (x) such that the inductive axiom holds: Given Z ∈ X and a map g : F (Z) −→ Z then there is a unique map {|g|}F , such that

consF F (µx.F (x)) / µx.F (x)

F ({|g|}F ) {|g|}F

  F (Z) g / Z commutes.

Estonia 2006: What is a good process semantics? July, 2006 – p. 52/61 Coinductive datatypes

X a category and F : X −→ X an endofunctor. An coinductive datatype for F is an object νx.F (x) ∈ X together with a map

destF : νx.F (x) −→ F (µx.F (x)) such that the coinductive axiom holds: Given Z ∈ X and a map g : Z −→ F (Z) then there is a unique map (|g|)F , such that

g Z / F (Z)

(|g|)F F ((|g|)F )

  µx.F (x) / µx.F (x) destF commutes.

Estonia 2006: What is a good process semantics? July, 2006 – p. 53/61 Circular datatypes: combinators

A combinator provides a manner of taking arrows f : F (X) −→ G(X) defined parametrically over a type variable X ∈ X and producing a map c[f] : H(X) −→ K(X) written as an inference: f F (X) −−→ G(X) H(X) −−−−→ K(X) . c[f]

The sense in which this is parametric is that we have the following extension of this inference for commuting diagrams:

c[f] f H(X) / K(X) F (X) / G(X)

H(x) K(x) implies F (x) G(x)     H(X0) / K(X0) F (X0) / G(X0) c[h] h

{|−|} and (|−|) are examples of combinators.

Estonia 2006: What is a good process semantics? July, 2006 – p. 54/61 Inductice circular datatypes

A combinator: f : X −→ B c[f] : F (X) −→ B where F (r) r F (X) / F (X0) ⇒ X / X0 D @ D y @@ }} DD yy @@ } D y 0 x @ } 0 c[x] DD yy c[x ] @ }} x D" |yy @ }~ } B B delivers a circular map µa.c[a] : µx.F (x) −→ B such that the following diagram commutes

cons F (µx.F (x)) / µx.F (x) JJ w JJ ww JJ ww c[h] JJ ww h JJ {ww $ B if and only if h = µa.c[a]. Note that, in particular this means, substituting µa.c[a] for h, that cons; µa.c[a] = c[µa.c[a]].

Estonia 2006: What is a good process semantics? July, 2006 – p. 55/61 Coinductive circular datatypes

Dually we have for coinductive datatypes the following circular style definition. Given a combinator c G//B / X//B DD z DD zz U DD zzU DD zz " X z| where B is a fixed object in X, there is a cocircular map νb.c[b] : B −→ νx.G(x) such that

B J w JJ u ww JJ c[u] ww JJ ww JJ w{ w J$ νx.G(x) G(νx.G(x)) dest / commutes if and only if u = νb.c[b]. In particular, this means (νb.c[b]); dest = c[νb.c[b]].

See also Tarmo Uustalu and Varmo Vene (thesis).

Estonia 2006: What is a good process semantics? July, 2006 – p. 56/61 Circular rules for polycategories

Given morphism of polycategories P and Q here are the term formation rules for circular terms:

0 0 Γ `A ∆, β : P (µx.P (x)), ∆ Γ, α : Q(νx.Q(x)), Γ `A ∆ 0 µ-Cons 0 ν-Cons Γ `β[µ]·A ∆, β : µx.P (x), ∆ Γ, α : νx.Q(x), Γ `α[ν]·A ∆

0 0 X = µx.P (x) | Γ, α : X, Γ `X ∆ X = νx.Q(x) | Γ `X ∆, X, ∆

...... 0 0 Γ, α : P (X), Γ `A(X) ∆ Γ `A(X) ∆, Q(X), ∆

0 0 Γ, α : µx.P (x), Γ `α[µ]X·A(X) ∆ Γ `β[µ]X·A(X) ∆, β : νx.Q(x), ∆

Estonia 2006: What is a good process semantics? July, 2006 – p. 57/61 Expressiveness of datatypes

Adding datatypes increases expressiveness dramatically! One can defne the Burroni natural numbers by:

N(A) = µX.A + X

Having the Burroni natural numbers means: All primitive recursive functions on the natural numbers are present (Pare and Roman)! The decision problem for equality of maps is undecideable.

Estonia 2006: What is a good process semantics? July, 2006 – p. 58/61 Conclusions ...

Was this carving in snow!!??? Logic of products and coproducts precisely describes communication on a channel. Polycategories (the logic of cut) and polyadditives model communication on many channels. Multiplicatives given by representability. Protocols given by datatypes. There is no choice! S0 linearly distributive categories with products and coproducts provide a basic setting for the semantics of communication ... (mutually recursive) datatypes give sophisticated communication protocols.

Estonia 2006: What is a good process semantics? July, 2006 – p. 59/61 Conclusions ...

Mathematics had something to say ...

... and the foundations of the mathematics involved was not exactly new!

Estonia 2006: What is a good process semantics? July, 2006 – p. 60/61 More conclusions ...

Is that all? NO! Message passing ... What can you do with protocols ... Details of implementing these interactions ... A formal programming language for communicating processes which has a guarantee of no deadlock, no livelock ... this will be very neat!!

Looking for volunteers!

Estonia 2006: What is a good process semantics? July, 2006 – p. 61/61