# Sequential execution in $\pi$-calculus

I am relatively new to $\pi$-Caculus and have a doubt wrt sequential execution in In $\pi$-Calculus .

Does passing of common names over common channels shared between two Agents, represent a sequential execution ? so is the below reduction semantics correct if I have to represent a sequential execution between Agent A,B and C where A and B share common channel x and share data c' and similarly B and C share channel y?

$$\begin{gathered} \label{eq23} \frac{A \xrightarrow{\overline{x}(c)} A' \quad B \xrightarrow{{x}(c').\overline{y}(c'')} B' \quad C \xrightarrow{y(c''')}C' \ } {A|B|C \xrightarrow{\tau} A'| B'\left\{c/c' \right\}|C'\left\{c''/c''' \right\}} \end{gathered}$$

$\pi$-calculus can represent all sequential behaviour. The key rule responsible for sequential behaviour is that for input:

$$\overline{x}y \ |\ x(v).P \quad \rightarrow\quad P\{y/v\}$$

(and its replicated variant). The process $P$ becomes active only after the interaction at $x$ has taken place. You can generalise this: if $X$ and $Y$ are two arbitrary processes such that $Y$ should execute only after $X$ has terminated, you can use something like:

$$(\nu a)(X' \ |\ a().Y)$$

Here $a$ is a fresh name, i.e. does not occur in $X$ and $Y$. The process $X'$ is exactly like $X$, except it outputs an empty message on $a$ upon termination of $X$. Defining $X'$ depends on the precise nature of $X$ since $X$ may itself have multiple threads. If $X$ is sequential, then it's easy to define $X'$, just replace $0$ by $\overline{a}\langle\rangle$. The whole purpose of the handshake on $a$ is to exchange one bit of information, namely that $X'$ has terminated.

The answer to your question "Does passing of common names over common channels shared between two Agents, represent a sequential execution?" is positive in a narrow sense that the continuation of the input side will only start after this interaction. However the sender might do other things in parallel. BTW, the rule you give isn't quite right. You need two $\tau$-actions because you are doing two interactions. Moreover, it looks like you are doing a bound output of $c$ abd $c''$, so the resulting processes should have an outermost $(\nu c'')(\nu c)$, or something like that.

You can also define subcalculi of $\pi$-calculus where all computation is sequential: for example by considering only processes that have at most one active output (heriditarily). An output is active, it it's not under an input. This property being heriditary means simply that it's stable under reduction.

I close with a quote of R. Milner's from his "Elements of interaction":

I make a disclaimer. I reject the idea that there can be a unique conceptual model, or one preferred formalism, for all aspects of something as large as concurrent computation, which is in a sense the whole of our subject -- containing sequential computation as a well-behaved special area.

• Thank you @Martin Berger that was a simple and really intuitive explanation. – anil keshav Jul 20 '16 at 17:08