% 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[margin=1in]{geometry}

\usepackage{bcprules}
\usepackage{csnotes}

% local definitions for this lecture
%P \{^y/_z\}
\newcommand{\subst}[3]{\ensuremath{#1[^{#2}/_{#3}]}}
\newcommand{\steps}[1]{\ensuremath{\overset{#1}\longrightarrow}}
\newcommand{\new}[1]{\ensuremath{\nu \; #1 \; }}
\newcommand{\sbbisim}{\ensuremath{\overset{.}\sim\;}}
\begin{document}

\header{4 October 2011}{Owen Arden}

\section{Bi-simulation and congruency in $\pi$-calculus}
\begin{eqnarray*}
\pi & ::= & \bar{x}~y \mid x(z) \mid \tau \mid [x = y] \pi \\
P & ::= & M \mid P_1|P_2 \mid \nu x P \mid !P\\
M &::= & 0 \mid \pi .P \mid M_1 + M_2
\end{eqnarray*}

We write labeled transitions for processes as $P \overset{\alpha}\longrightarrow P^\prime$ where $\alpha$ is taken from
\begin{eqnarray*}
\alpha ::= \bar{x}~y \mid x(z) \mid \bar{x}(z) \mid \tau
\end{eqnarray*}
$\bar{x}(z)$ is a ``bound send'' and is used to identify when scope
extrusion occurs.

\subsection{LTS Operational semantics}
\infax[\textsc{Out}]             {\bar{x}~y . P \steps{\bar{x}y} P}

\infax[\textsc{InP}]              {x(z).P \steps{x(y)} \subst{P}{y}{z}}

\infax[\textsc{Tau}]             {\tau . P \steps{\tau} P} 

\infrule[\textsc{Sum-L}]     {P\steps{\alpha} P^\prime}
                                            {P + Q\steps{\alpha}  P^\prime} 

\infrule[\textsc{Sum-R}]     {Q \steps{\alpha} Q^\prime}
                                            {P + Q \steps{\alpha} Q^\prime}

\infrule[\textsc{Match}]      {\pi.P \steps{\alpha} P^\prime}
                                            {[x=x]\pi.P\steps{\alpha}P^\prime}

\infrule[\textsc{Par-L}]      {P\steps{\alpha} P^\prime \quad \alpha=\bar{x}(z) \implies x \notin fv(Q)}
                                           {P \mid Q\steps{\alpha} P^\prime \mid Q} 

\infrule[\textsc{Par-R}]      {Q\steps{\alpha} Q^\prime \qquad \alpha=\bar{x}(z) \implies x \notin fv(P)}
                                           {P \mid Q\steps{\alpha} P
                                             \mid Q^\prime}

\infrule[\textsc{Restriction}]  {P\steps{\alpha} P^\prime \quad z \notin names(\alpha)}
                                               {\new{z} \; P \steps{\alpha} \new {z} \; P^\prime} 

\infrule[\textsc{Comm-L}]     {P \steps{\bar{x}y} P^\prime \quad Q \steps{x(y)} Q^\prime}
                                               {P \mid Q \steps{\tau} P^\prime \mid Q^\prime}

\infrule[\textsc{Comm-R}]    {P \steps{x(y)} P^\prime \quad Q \steps{\bar{x}y} Q^\prime}
                                              {P \mid Q \steps{\tau} P^\prime \mid Q^\prime}

\infrule[\textsc{Open}]        {P \steps{\bar{x} z} P^\prime}
                                              {\new{z} P \steps{\bar{x}(z)} P^\prime}

\infrule[\textsc{Close-L}]    {P\steps{\bar{x}(z)}P^\prime \quad Q\steps{x(z)} Q^\prime}
                                            {P \mid Q \steps{\tau} \new{z} (P^\prime \mid Q^\prime)}

\infrule[\textsc{Close-R}]   {P\steps{x(z)}P^\prime \quad Q\steps{\bar{x}(z)} Q^\prime}
                                            {P \mid Q \steps{\tau} \new{z} (P^\prime \mid Q^\prime)}

\infrule[\textsc{Rep-Act}]  {P\steps{\alpha} P^\prime}
                                            {!P \steps{\alpha} P^\prime \mid !P}

\infrule[ \textsc{Rep-Comm}]  {P\steps{\bar{x}y} P^\prime \quad P\steps{x(z)} P ^{\prime\prime} \quad z \notin fv(P)}
                                                 {!P \steps{\tau}
                                                   (P^\prime \mid
                                                   P^{\prime\prime})
                                                   \mid !P}
\infrule[\textsc{Rep-Close}] {P\steps{\bar{x}(z)}P^\prime \quad  P\steps{x(z)} P^{\prime\prime} \quad z \notin fv(P)}
                                              {!P \steps{\tau} (\nu (P^\prime \mid P^{\prime\prime})) \mid !P}

\paragraph{Fact} For any P and $\alpha$ the set $\{P^\prime \mid P\steps{\alpha} P^\prime \}$ is finite.
%
\begin{lemma}[Harmony] $P \steps{} P^\prime \iff P \steps{\tau}\equiv P^\prime$\end{lemma}
%
\paragraph{Fact} $\steps{}$ is not image finite.  

\noindent
The primary issue is the $!$ operator -- $!P$ may be expanded infinitely . Noting that $!P \equiv P \mid !P$, we can extend our notion of image finiteness to include 'up-to structural congruence'.

\subsection{Reduction Bisimilarity}

\begin{definition}[Reduction bi-similarity] Reduction bi-similarity is the largest symmetric relation $S$ such that whenever $P~S~Q$ and $P\steps{}P^\prime$ we have $Q (\steps{}S) ~P^\prime$
\end{definition}

This definition is somewhat unsatisfying, however.  For instance, under this definition, $\bar{x}y.0$ and $0$ are regarded as equivalent.  

\begin{definition}[Reduction congruence] Two processes $P$ and $Q$ are reduction congruent if $C[P]$ and $C[Q]$ are reduction bi-similar for any context $C$.
\end{definition}
\begin{center}
\begin{tabular}{cccc}
P & Q & Congruent? & Context\\
\hline\\
$\bar{x}a.0$ & $\bar{y}a.0$ & No & $C = [\cdot] \mid x(z).0$ \\
$\bar{a}x.0$ & $\bar{a}y.0$ & No & $C = [\cdot] \mid a(z).(\bar{z} b \mid y (w))$ \\
&&& \quad $C[P] = \bar{a}x \mid a(z).(\bar{z} b \mid y(w)) $\\
&&& $\steps{} (\bar{x} b \mid y(w))$ \\
&&& \quad $C[P] = \bar{a}y \mid a(z).(\bar{z} b \mid y(w)) $\\
&&& $\steps{} (\bar{y} b \mid y(w))$ \\
$!\tau.0$ & $(R \mid !\tau .0)$ & Yes!
\end{tabular}
\end{center}
We can't distinguish transitions and $!\tau.0$ can always step.  This might feel familiar to ``termination equivalence'' in $\lambda$-calculus.

\subsection{Observations} 

We write $P\downarrow x$ if P can perform input on x in the LTS.  We write $P\downarrow \bar{x}$ if P can perform output on x in the LTS.
\begin{definition}[Strong barbed bi-similarity] Strong-barbed bi-similarity is the largest symmetric relation \sbbisim such that whenever $P\sbbisim Q$: 
\begin{itemize}
\item $P\downarrow \mu$ implies $Q\downarrow \mu$
\item $P \steps{\tau} P^\prime$ implies $Q \steps{\tau}\sbbisim P^\prime$
\end{itemize}

\paragraph{Facts} \sbbisim is:
\begin{itemize}
\item an equivalence
\item preserved under prefixes, sum, and restriction
\item $\equiv \subseteq \sbbisim $ (Structural congruence implies
  \sbbisim)
\end{itemize}
\end{definition}

\paragraph{Example}
\begin{eqnarray*}
P =& \bar{x}y.\bar{a}\langle\rangle\\
Q =& \bar{x}y.0\\
\\
C =& [\cdot] \mid x(z).0
\end{eqnarray*}

\begin{definition}[Strong-barbed congruence] P and Q are strong barbed congruent, written $\simeq_c$ iff $C[P] \sbbisim C[Q] $ for any $C$. 
\end{definition}

\paragraph{Fact} : $\simeq_c$ is the largest congruence included in $\sbbisim$, therefor $\equiv \subseteq \simeq_c$.

\begin{lemma}[Context Lemma] $P \simeq_c Q \iff P\sigma\mid R \sbbisim Q\sigma \mid R$~~ for any $\sigma,R$.
\end{lemma}
\begin{definition}[Strong-barbed equivalence] $P \simeq Q
  \overset{\vartriangle}\iff P \mid R \sbbisim Q | R$
\end{definition}

\paragraph{Example} The following example helps distinguish strong barbed congruence and strong barbed equivalence.

\begin{eqnarray*}
P =&  \bar{z} \mid a  \\
Q =& \bar{z} . a  +  a . \bar{z} 
\end{eqnarray*}

It should be clear that P and Q are strong barbed equivalent -- no
matter what R we compose them with, at most two tau transitions are
possible and the same observations (barbs) hold throughout.

However, P and Q are not strong barbed congruent. To see this, pick C
to $ x(z) . [\cdot]] ) | \bar{x}\langle a \rangle $. Putting the hole $[\cdot]$ under a receive of
$z$ on $x$ causes the substitution $\subst{}{a}{z}$ to be applied to in the process
plugged into the hole during evaluation. This enables the two proceses
composed in parallel on the P side to interact with each other while
the Q side, no such interaction is possible. This also explains the
critical role of the substitution in the Context Lemma -- the context
C constructed above essentially plays the role of the substitution
$\subst{}{a}{z}$.
\end{document}

