Planche 1
Concurrency 3
CCS
Jean-Jacques Lévy
jeanjacqueslevy.net/dea

Planche 2

Minimal language for concurrency

The l-calculus is a minimal language for functional languages. It can also be used as a basis for imperative languages (via continuations).

What is a minimal language for concurrent processes ?
Planche 3

CCS (1/4)

Language
a, b, c ::= (channel) names
a
,
b
,
c
::=
co-names
a
=a
a ::=
a |
a
| t
actions
P,Q,R ::= 0 | a.P | P+Q | (P | Q) | (n a) P | K processes
K
def
=
 
P
::= constant definitions

Act = { a, b, c, ... } È { a, b, c, ... } È { t } Notation: a for a.0
Planche 4

CCS (2/4)

Examples (coffee machine revisited)
P0 = A
A = c.(k.d.A + t.d.A)
P0' = B C = (k.d.D + t.d.D)
B = c.C D = c.C

P0'' = E
E = (c.k.d.E + c.t.d.E)
P0''' = F
F = c+(c.k.d.F + c.t.d.F)

Interaction with coffee machine

P
0 | c.k.d P0 | c.k.d | c.t.d

P
0 | Client1P0' | Client1P0'' | Client1 P0''' | Client1

P
0 | Client2P0'' | Client2 | Client2 P0 | Client1 | Client2

where

Client1 =
def c.k.d.Client1 Client2 =def c.t.d.Client2


Planche 5

CCS (3/4)

Semantics (SOS)
[Act]  a.P
a
¾®
 
P
[Sum1] 
P ¾®a P'
P+Q ¾®a P'
[Sum2] 
Q ¾®a Q'
P+Q ¾®a Q'
[Par1] 
P ¾®a P'
P | Q ¾®a P' | Q
[Par2] 
Q ¾®a Q'
P | Q ¾®a P | Q'
[Com] 
P ¾®a P' Q ¾®a Q'
P | Q ¾®t P' | Q'
[Res] 
P ¾®a P' a Ï{a,a}
(n a) P ¾®a (n a) P'
[Rec] 
P ¾®a P' K =def P
K ¾®a P'

¾®
t internal move
¾®
a (a¹t) interaction on external a-channel

By convention, ¾®
a input on a-channel and ¾®a output on a-channel

Sum ¹ internal choice P+Q ¾®
t P or P+Q ¾®t Q.


Planche 6

CCS (4/4)

At present time, no values passed on communication channels.
(see later for value passing calculi)

No buffering in communications. Different from TCP sockets, from Kahn/MacQueen flow systems.
Þ communication by rendez-vous.
º more basic calculus.

Rendez-vous exist in Occam, Ada, CML, Ocaml's processes.


Planche 7

CCS and strong bisimulation (1/4)

Theorem 1 Following relations hold.
P+0 ~ P P | 0 ~ P
P+Q ~ Q+P P | Q ~ Q | P
(P + Q) + R ~ P + (Q + R) (P | Q) | R ~ P | (Q | R)
P+P ~ P
 
(n a)(P | Q) ~ ((n a) P) | Q if a not free in Q
(n a)(n b)P ~ (n b)(n a)P
(n a) P ~ (n b) P{b/a} if b not bound in Q
(n a) a.P ~ 0 if a=a or a=a
(n a) a.P ~ a. (n a).P otherwise
 
K ~ P if K =def P

Planche 8

CCS and strong bisimulation (2/4)

Proof of previous theorem
Planche 9

CCS and strong bisimulation (3/4)

Proof of theorem (continued) Exercice 1 Give full proof of theorem.

Planche 10

CCS and strong bisimulation (4/4)

Theorem 2[Expansion]
a.P | b.Q ~ a.(P | b.Q) + b.(a.P | Q)
a.P |
a
.Q
~
a.(P |
a
.Q) +
a
.(a.P | Q) + t.(P | Q)

Exercice 2 Prove it.

Concurrency in CCS relies on interleaving. Never two actions occur at same time. Different from ``true concurrency''.

Exercice 3 Draw LTS for following processes:
P =
(n a)((a+b) |
a
)
K2
def
=
 
t.(n a) (a | (
a
+ b)) + c.K3
K1
def
=
 
a.(t.K1 + b) + t.a.K1 K3
def
=
 
d.K3
Exercice 4 Draw LTS for (n c) (K1 | K2) where
K1
def
=
 
a.
c
.K1
K2
def
=
 
b.c.K2

Exercice 5 Give a CCS term for boolean semaphores.
Exercice 6 Give a CCS term for n-ary semaphores.


Planche 11

Strong bisimulation and congruence

Theorem 3 Strong bisimulation ~ is a congruence. Namely:
P ~ Q   Þ   C[P] ~ C[Q] for any context C[ ].

Exercice 7 Prove it.

This means that ~ can be used as standard equations.

Exercice 8 Prove by using equations of Theorems 1 and 2 that: (n b) (a.(b |
c) + t.(b | b.c)) ~ a.c + t.t.c

Exercice 9 Show K |
K ~ K when K =def a.K.

Exercice 10 Show K ~ K' when K =
def a.K and K' =def a.a.K'.

Exercice 11 Show K ~ a.K' when K =
def a.b.K and K' =def b.a.K'.

Exercice 12 Show that a.(b+c) ¬ ~ab + ac.



This document was translated from LATEX by HEVEA.