<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">% flag to use fancy fonts / graphics
\newif\ifjnf\jnftrue

\documentclass[11pt]{article}

\usepackage{tikz}
\usetikzlibrary{arrows}
\usepackage{cmtt}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{url}
\usepackage{textcomp}
\usepackage[margin=1in]{geometry}
\usepackage{filecontents}
\usepackage{cite}

\usepackage{csnotes}

% local definitions for this lecture
\setbox0=\hbox{$\tt\global\chardef\ttfam=\the\fam$}
\newcommand{\thickbar}
{\hbox to\fontdimen2\textfont\ttfam{\hss\the\textfont\ttfam [$\!\!$]\hss}}

\begin{document}

\header{29 September 2011}{Carlos Otero}

\section{$\pi$-Calculus Review}

\begin{eqnarray*}
P::M\ \vert\ P_1 | P_2\ \vert\ \nu x\ P\ \vert\ !P \\
M::= 0\ \vert\ \pi.P\ \vert\ M_1 + M_2 \\
\pi:= \tau\ \vert\ \overline{x}\left\langle y \right\rangle\ \vert\ [x=y]\pi \\
\end{eqnarray*}


\section{Introduction}

This session we will talk about Asynchronous $\pi$-Calculus.

Asynchronous $\pi$-Calculus accurately models real time systems that have some characteristics like:
\begin{itemize}
 \item There exists delay on channels
 \item There are buffers on channels
 \item Information might be dropped if buffers overflow
\end{itemize}

Besides its practical implications, Asynchronous $\pi$-Calculus present interesting theoretical challenges. All the  equivalent relationships we built for
CCS become more subtle once we incorporate the model of Asynchronous $\pi$-Calculus.

In full $\pi$-Calculus, synchronization occurs on guards since residual processes fire whenever a guard evaluates \emph{true},
in Asynchronous $\pi$-Calculus, we would like to avoid unnecessary synchrononization happening because of the guards. We would like synchronization to only happen whenever \emph{send} and \emph{receive} operations happen. 

For the rest of the session we will:
\begin {itemize}
 \item {Define Asynchronous $\pi$-Calculus}
 \item {Examples how Asynchronous $\pi$-Calculus is used}
 \item {How to convert $\pi$-Calculus into Asynchronous $\pi$-Calculus}
\end{itemize}

\section{Definition. Asynchronous $\pi$-Calculus}
This method is described by Kohei Honda \cite{async_pi_honda}. 
\begin{eqnarray*}
 P&amp;::= &amp;\overline{x}y\ \vert\ M\ \vert\ P_1|P_2\ \vert\ \nu x\ P\  \vert\ !P \\
 M&amp;::= &amp;0\ \vert\ x(y).P\ \vert\ \tau.P\ |\ M_1 + M_2 \\
\end{eqnarray*}
\\
Note: The \emph{send} notation used by Kohei Honda  does not use $\left\langle . \right\rangle$ for \emph{sends}.
\\
\emph{Sends} are banned to guard processes, in order to avoid unnecessary synchronization. \emph{Receives} can guard processes, and \emph{sends} can only guard the null process.
By using this method whenever we attempt to send, it immediately commits.  If one would like to do sequencing, then an explicity acknowledge channel is required 
to send back the value that was sent.

A \emph{send} is waiting to react with a symmetric \emph{receive} action. Sequencing can still happening by using private channels to acknowledge a channel.
to perform \emph{send} and \emph{receive} actions.

Summations are also restricted so that only \emph{sends} and $\tau$ guarded processes can appear.  Hence it is impossible to build a process
that looks like:
\begin {equation*}
\overline{x}y + w (x).P
\end{equation*}

The reaction rule for this process is:
\begin{equation*}
 \dfrac{}{\overline{x}\left\langle y \right\rangle \ \vert\ (x(z).P  + M) \rightarrow P\{y/z\}}:React
\end{equation*}


\subsection{Lossy channels}
This model correctly handles delay and buffering on the channel, however it still considers lossless channels.

To allow lossy channels, once could explicitly model \emph{loss} usign a  loss  process:
\begin{eqnarray*}
 lserver \equiv !x(y).0 
\end{eqnarray*}

One can make the analogy of this process to the  the /dev/null device in any Unix-like operating system.

\subsection{Order and sequencing}
We can enforce ordering by intentionally introducing data dependencies.
The following example shows how we can enforce particular ordering of events:
\begin{eqnarray*}
 P\equiv \nu x,\ w &amp; &amp;( \overline{x}w\ \ \vert\ \ w(u).(\overline{u}a \  \vert \ w(z).\overline{z}b) \ \vert \\
          &amp; &amp;x(w).\nu u(\overline{w}u\ \vert\ \ u(y).\nu\ z( \overline{w}z\ \vert\ z(s).Q)))
\end{eqnarray*}
\\
In this example, the sequence of events that happen are:
\begin{itemize}
 \item $w$ is sent on channel $x$ 
 \item $u$ is sent on channel $w$
 \item $a$ is sent on channel $u$ and it is stored in $y$
 \item $z$ is sent on channel $w$
 \item $b$ is sent on channel $z$ and it is stored in $s$
\end{itemize}
At the end, we have a residual process $Q\{a/y, b/s\}$.  This process shows how sequencing was achieved between channels $x\rightarrow y \rightarrow z$
using private channels $w$ and $u$ for sequencing.



\section{$\pi$-Calculus translation into Asynchronous $\pi$-Calculus}
This section describes a way to integrate and encode any process of the $\pi$-Calculus into asynchronous $\pi$-Calculus. \\
\textlbrackdbl\textrbrackdbl:Operator that defines the equivalence between full $\pi$-Calculus into Asynchronous $\pi$-Calculus.

\subsection{Translation of \emph{send} and \emph{receive} actions}

First, we need to change the protocols for \emph{sends} and \emph{receives}:
\begin {eqnarray*}
 \text{\textlbrackdbl} \overline{x}\left\langle y \right\rangle .P \text{\textrbrackdbl}  &amp; \triangleq  &amp; \nu \ w(\overline{x}w\ \vert\ w(u).(\overline{u}\left\langle y \right\rangle \ \vert\ \text{\textlbrackdbl}P\text{\textrbrackdbl})) \\
 \text{\textlbrackdbl} x(z).Q \text{\textrbrackdbl} &amp; \triangleq &amp; x(w). \nu\ u(\overline{w} u \  \vert\ u \left\langle z \right\rangle.\text{\textlbrackdbl}Q\text{\textrbrackdbl})
\end {eqnarray*}

The translation above will \emph{send} a channel on $x$. The symmetric \emph{receive} action happens.  Afterwards, the data is sent along with that channel in parallel with the execution of the residual 
process $P$.\\

\subsection{Translation of sums}
We need to split a sum comprising \emph{send}, \emph{receive} and $\tau$ actions into an equivalent program that includes only sums of \emph{send} \underline{OR} \emph{receives}.\\
We will first extend the encoding of asynchronous $\pi$-Calculus:
\begin{eqnarray*}
 P &amp;::= &amp;\overline{x}y\ \vert\ M\ \vert\ P_1|P_2\ \vert\ \nu x P\  \vert\ !P\ \vert\ N \\
 M &amp;::= &amp;\sum_i x_i(z).P_i\\
\end{eqnarray*}

Sums are not essential constructs with the exception of unary sums. $\tau$ transitions could be added to the model described above without much difficulty. \\

To translate a summation from $\pi$-Calculus into asynchronous $\pi$-Calculus we could use the $(|.|)$ translation.

$(|.|)$ is a homomorphic translation except for sums

\begin{eqnarray*}
(| \sum_i x_i(z).P_i|) &amp; \triangleq  \nu\ l&amp;(Proceed \left\langle l \right\rangle )\\
		      &amp;  	           &amp; \vert\ \prod_i x_i(z).\nu\ p_i,\ f_i( \overline{l} \left\langle p,f \right\rangle )\\
		      &amp; 	           &amp; \vert\ p.(Fail\left\langle l \right\rangle )\ \vert\ (|P_i|) ) \\
		      &amp;		           &amp; \vert\ f.(Fail\left\langle l \right\rangle ) \vert ( \overline{x}_i z)))
\end{eqnarray*}
 Where:\\
\begin{eqnarray*}
		       Proceed(l) &amp; \equiv  &amp; l(p,f).\overline{p} \\
		       Fail(l) &amp; \equiv &amp; l(p,f).\overline{f}
\end{eqnarray*}

Note that in the previous equation $p_i$ and $f_i$ are private channels to each process. $\prod$ is used to denote the parallel composition of processes.

Whenever a \emph{send} executes, they will get a $lock$, execute the residual process attached to the \emph{receive} and then pass the lock to the next process. We spawn parallel servers
that will determine if a specific process is allowed to proceed or not.   Since the \emph{send} is destined to a specific process, one of the parallel process will interact with \emph{Proceed}
while the other processes will interact with \emph{Fail}. The processes will keep sending \emph{Fail} to each other, creating a cascading domino effect. At the end, this 
process will leave a residual \emph{Fail} that can not communicate to any other process.


Ideally we would like to have translations of processes that contains summations of both \emph{send} and \emph{receives} like the one described below:

\begin{eqnarray*}
 P &amp;::= &amp;\overline{x}y\ \vert\ M\ \vert\ P_1|P_2\ \vert\ \nu x P\  \vert\ !P\ \vert\ N \\
 M &amp;::= &amp;\sum_i x_i(z).P_i\\
 N &amp;::= &amp;\sum_i \overline{x_i} d_i.P
\end{eqnarray*}
When a non-deterministic receive fails, it can send back out the value it received. 

\{\{.\}\} is an homomorphic translation except for sums of sends and receives.

First, we translate a sum of receives
\begin{eqnarray*}
 {{\sum_i\overline{x_i}d_i.P_i}} \triangleq \nu s(Proceed\left\langle s \right\rangle | \prod_i \nu a.\overline{x_i}\left\langle d_i,s,a \right\rangle.\nu p,\ f(\overline{a}\left\langle p,f \right\rangle \vert p.{{P_i}}|f.0)
\end{eqnarray*}


${{\sum_i y_i(z).qi}} \triangleq$ \\
\hspace*{20mm} $\nu r  (Proceed \left\langle r \right\rangle \vert$ \\
\hspace*{25mm} 		$\prod_i \nu g \   (\overline{g}  \vert $ \\
\hspace*{35mm} 				    $!(g.y_i(z,s,a). \nu p_1,f_1 (\overline{r} \left\langle p_1,\ f_1 \right\rangle  $\\
\hspace*{70mm}			           		     $\vert P_i ( \nu p_2,f_2(\overline{s} \left\langle p_2, f_2 \right\rangle $ \\
\hspace*{80mm}								              $\vert p_2.(Fail\left\langle r \right\rangle ) \vert Fail \left\langle s\right\rangle \ | Proceed\left\langle a\right\rangle  | \{\{Q_i\}\})$ \\
\hspace*{80mm}									      $\vert f_2.((Proceed \left\langle r\right\rangle | Fail\left\langle s\right\rangle\ | Fail\left\langle a\right\rangle  | \overline{g}$ \\
\hspace*{80mm}									      $\vert f_1.(Fail\left\langle r \right\rangle\ |\ \overline{y_1}\left\langle z,s,a\right\rangle))))$ \\


At the beginning of execution all processes have the lock, and the processes receive channel names on y, z as well as 2 locks $a$ (for this sender) and $s$ for the rest of the receivers. 
The channels $p_1$ and $f_1$ are private channels that allow us the process to check if they should \emph{proceed} or \emph{fail}. 

If we get \emph{proceed}, then we have been selected, otherwise the whole communication has failed. In that case we should roll back by repetitevely sending \emph{proceed} and \emph{fails}.
It is important to mention that only one copy interacts at any specific time. 

The tranlation of a sum of \emph{sends} is left as an exercise to the reader.

\section{Conclusion and Final remarks}
The final translation was omitted in class, but the reader can refer to \cite{pi_book} for more information.

During this section, we described the importance of Asynchronous $\pi$-Calculus, since it properly models real-life situations.
We removed extra synchronization by disallowing processes guarded by \emph{send} actions as well as limiting the summations.

During the last part of the section we defined some translations that allows us to move from full $\pi$-Calculus into a more leaner version of Asynchronous $\pi$-Calculus.

It is still an open-research question to make this translation fully abstracted with respect to the equivalence relations that we have discussed for full $\pi$-Calculus (eg. bisimulation).
There are ongoing efforts to find the solution to this translations.  One of such methods was done by Palamidessi\cite{popl97} that proposes the following:
\begin{theorem}
There does not exist a translation from Asynchronous $\pi$-Calculus to $\pi$-Calculus with the following properties:
\begin{equation}
 \text{\textlbrackdbl} P\sigma \text{\textrbrackdbl} = \text{\textlbrackdbl} P \text{\textrbrackdbl} \sigma \\
\end{equation}
\begin{equation}
 \text{\textlbrackdbl} P|Q\text{\textrbrackdbl} = \text{\textlbrackdbl}P\text{\textrbrackdbl}\vert \text{\textlbrackdbl}Q\text{\textrbrackdbl}\\
\end{equation}
\begin{eqnarray}
 \forall P, \ N &amp; \subseteq Fv(P), n\in N, n \notin E, n \notin S\\ \nonumber
 &amp; for\ all\ maximal\ computations \\ \nonumber
 &amp; if P \xrightarrow{s}^* \xrightarrow{n} \xrightarrow{t}^*P' , n\in N, n \notin E, n \notin S\\ \nonumber
 &amp; \text{\textlbrackdbl} P \text{\textrbrackdbl}  \xrightarrow{s}^* \xrightarrow{n} \xrightarrow{t}^*  \text{\textlbrackdbl} P' \text{\textrbrackdbl}
\end {eqnarray}
\end{theorem}

The first equation states that one might need variable renaming while performing the translation. The second equation establishes that the parallel composition 
of two processes might result in something different than the parallel composition of the translation of each individual process.   The last equation explains that
if a process steps from $P$ to $P'$, we might required extra communication actions in order to achieve a translation that makes the equivalent process
\textlbrackdbl$P$\textrbrackdbl  step to \textlbrackdbl$P'$\textrbrackdbl.

\begin{thebibliography}{9}
 \bibitem{pi_book}
 The $\pi$-Calculus: A theory of Mobile Processes. Sangiorgi D., Walker D. Cambridge University Press, 2003, 978-0521543279.
 \bibitem{popl97}
 Comparing the expressive power of the synchronous and the asynchronous $\pi$-Calculus, Palamidessi C, Proc of the 24th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL), 1997
 \bibitem{async_pi_honda}
 An Object Calculus for Asynchronous Communication. Honda Kohei, Tokoro M. Proc of the European Conference on Object-Oriented Programming (ECOOP), 1991.
\end{thebibliography}





\end{document}



</pre></body></html>