Skip to content

Commit 4885779

Browse files
author
admin
committedApr 19, 2008
chap 2 cleanup: changed tuple notation and system and process syntax
1 parent 3e0a3a7 commit 4885779

File tree

5 files changed

+52
-50
lines changed

5 files changed

+52
-50
lines changed
 

‎Chapters/chap2.tex

+29-30
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,38 @@
11
%!TEX root = /Users/admin/Desktop/Documents/Academic/MA 470 -THESIS/THESIS/thesis.tex
22

33
\chapter{The \Picalc}\label{the picalc}
4-
In this chapter, we will give the syntax of the \emph{asynchronous} \picalc\ and a discussion of its features.\footnote{Several versions of the \picalc\ have been proposed. We will loosely follow the recent presentation given in \cite{henn07}.} Following this, we will introduce a notion of equivalence of terms in the language. Finally, we will give some semantic reduction rules that provide computational behavior via steps of reduction.
4+
In this chapter, we will give the syntax of the \emph{asynchronous} \picalc\ and a discussion of its features. We will loosely follow the style of a recent presentation given in \cite{henn07}. Following this, we will introduce a notion of equivalence of terms in the language. Finally, we will give some semantic reduction rules that provide computational behavior via steps of reduction.
55
\section{Syntax}\label{spisyntax}
6-
The terms of the \picalc\ operate on a space of \defmargin{identifiers} $v,w,...$ which for the time being will consist of names $n,m,...$ for communication channels, and variables $x,y,...$ which, as we will see below, can refer to channels or to recursive process bodies.
6+
The terms of the \picalc\ operate on a space of \defmargin{identifiers} which consists of names $a,b,c,...,n,m,o$ for communication channels, and variables $v,w,x$ which can refer to channels, and recursive variables $p,q,r$, explained in more detail below. In general, we will use capital letter to denote a process.
77

88
\begin{insettable}
99
\begin{center}
1010
\begin{tabular}{r l l}
1111
\multicolumn{3}{c}{\emph{Process terms}}\\
12-
$R,S,B :=$ &$R_1 \comp R_2$ & Composition\\
13-
&\send{n}{V} & Send\\
14-
&$\receive{n}{X} R$ & Receive\\
12+
$R :=$ &$R_1 \comp R_2$ & Composition\\
13+
&\send{n}{\tuple{V}} & Send\\
14+
&$\receive{n}{\tuple{X}} R$ & Receive\\
1515
&$\new{n}R$ & Restriction\\
1616
&$\pif{v_1 = v_2}\pthen R_1 \pelse R_2$ & Matching\\
17-
&$\rec{x} B$ & Recursion\\
17+
&$\rec{p} R$ & Recursion\\
1818
&stop & Termination\\
1919
&\\
2020

21-
\multicolumn{3}{c}{\emph{Systems}} \\
22-
$\sys{M,N} :=$ &$\new{c_1,...,c_n} R_1 \comp...\comp R_m$ & $n, m > 0$\\
21+
\multicolumn{3}{c}{\emph{System}} \\
22+
& $\new{c_1,...,c_n} R_1 \comp...\comp R_m$ & $n, m >= 0$\\
2323
\end{tabular}
2424
\emph{\caption{Terms in the asynchronous \picalc}\label{apicalcterms}}
2525
\end{center}
2626
\end{insettable}
27-
% \subsection{Names}
2827
Given two or more processes, we can compose them using the $\comp$ operator, which means that the composed processes will be executed concurrently.
2928

30-
We denote the sending of a tuple $V$ over a channel $n$ by \send{n}{V}. Here $V$ is a tuple of identifiers in the form $V=(v_1,...,v_k):k\geq 0$. We say that $V$ has \defmargin{arity} $k$. In the case $n=0$ nothing is being transmitted; the communication acts as a \defmargin{handshake} or signal. We will denote this case by \send{n}{}. It is a feature of the language that sending is not a blocking operation -- that is, the process will not wait or depend on the value actually being received or operated on by another process, but will simply terminate after sending the value. Non-blocking sends make our \picalc\ an \emph{asynchronous} language - processes that send values do not wait to sync operation with the processes that consume the values. However, we will show in \refex{exsynchronous} that synchronous behavior can still be modeled in our language.
29+
We denote the sending of a tuple $\tuple{V}$ over a channel $n$ by \send{n}{\tuple{V}}. Here $\tuple{V}$ is a tuple of identifiers in the form $\tuple{V}=(v_1,...,v_k):k\geq 0$. We say that $\tuple{V}$ has \defmargin{arity} $k$. In the case $k=0$ nothing is being transmitted; the communication acts as a \defmargin{handshake} or signal. We will denote this case by \send{n}{}. When $k=0$, only a single value $v_1$ is being transmitted, in which case we write $\send{n}{v_1}$. It is a feature of the language that sending is not a blocking operation -- that is, the process will not wait or depend on the value actually being received or operated on by another process, but will simply terminate after sending the value. Non-blocking sends make our \picalc\ an \emph{asynchronous} language - processes that send values do not wait to sync operation with the processes that consume the values. However, we will show in \refex{exsynchronous} that synchronous behavior can still be modeled in our language.
3130

32-
The term \receive{n}{X}$R$ describes a process waiting to receive a tuple along $k$ before continuing with $R$. Here $X$ is a \defmargin[pattern]{patterns}, or a tuple of variables of arity $k$. Patterns allow us to decompose the transmitted tuple into its component values by naming them with $x_1,...,x_k$, which can be referred to in $R$. Thus, in the term
31+
The term \receive{n}{\tuple{X}}$R$ describes a process waiting to receive a tuple along $k$ before continuing with $R$. Here $\tuple{X}$ is a \defmargin[pattern]{patterns}, or a tuple of variables of arity $k$. Patterns allow us to decompose the transmitted tuple into its component values by naming them with $x_1,...,x_k$, which can be referred to in $R$. Thus, in the term
3332
\begin{align}
3433
\send{c}{n_1,n_2,n_3} \comp \receive{c}{x_1,x_2,x_3} R,
3534
\end{align}
36-
the names $n_1,n_2,n_3$ are received via $c$ and bound via matching to $x_1,x_2,x_3$ (the use of $x_1,x_2,x_3$ is limited to being within the process $R$). Similarly to sending, the case of arity 0 is denoted \receive{n}{}$R$ -- here $R$ will not happen until a handshake is received on $n$. Notice that in contrast to the case of sending, receiving is a \defmargin{guarded} operation -- that is, the process $R$ will not execute until $X$ has been received via $n$. For example, the term
35+
the names $n_1,n_2,n_3$ are received via $c$ and bound via matching to $x_1,x_2,x_3$ (the use of $x_1,x_2,x_3$ is limited to being within the process $R$). Similarly to sending, the case of arity 0 is denoted \receive{n}{}$R$ -- here $R$ will not happen until a handshake is received on $n$. Notice that in contrast to the case of sending, receiving is a \defmargin{guarded} operation -- that is, the process $R$ will not execute until $\tuple{X}$ has been received via $n$. For example, the term
3736
\begin{align}
3837
\receive{c}{}stop
3938
\end{align}
@@ -50,7 +49,7 @@ \chapter{The \Picalc}\label{the picalc}
5049
\receive{c}{x}(\pif{x=a} \pthen \send{x}{} \pelse stop)
5150
\end{align}
5251

53-
Recursion is built into the language using the syntax $\rec{x}B$. The process $\rec{x}B$ itself is referred to by the variable $x$, which is used somewhere in $B$ to express a recursive call. For example, consider the recursive responder term below, which receives a channel $x_1$ via $c$. It then sends a handshake response on $x_1$, while another responder process is run in parallel.
52+
Recursion is built into the language using the syntax $\rec{x}R$. The process $\rec{x}R$ itself is referred to by the variable $x$, which is used somewhere in $R$ to express a recursive call. For example, consider the recursive responder term below, which receives a channel $x_1$ via $c$. It then sends a handshake response on $x_1$, while another responder process is run in parallel.
5453
\begin{align}
5554
\rec{x}\receive{c}{x_1}(\send{x_1}{} \comp x)
5655
\label{reclistenerterm}
@@ -93,7 +92,7 @@ \subsection{Identifier Substitution and $\alpha$-equivalence}
9392
\begin{align}
9493
\receive{a}{x_1,x_2}\send{x_1}{} \comp \rec{x}(\send{a}{n,m} \comp x)
9594
\end{align}
96-
We denote the substitution of values in $V$ for free identifiers $X$ in $R$ by $R$\subst{V}{X}. Of course, during the course of a substitution, we might inadvertently `capture' a bound term -- suppose for example we wanted to perform the substitution $P_1(c)$\subst{n}{c} where
95+
We denote the substitution of values in $\tuple{V}$ for free identifiers $V$ in $R$ by $R$\subst{\tuple{V}}{\tuple{X}}. Of course, during the course of a substitution, we might inadvertently `capture' a bound term -- suppose for example we wanted to perform the substitution $P_1(c)$\subst{n}{c} where
9796
\begin{align}
9897
P_1(c) \pdef \new{n}(\send{n}{x} \comp \send{c}{y})
9998
\end{align}
@@ -149,8 +148,8 @@ \section{Reduction Semantics}\label{secreducationsemantics}
149148
\begin{definition}{Reduction}
150149
The \emph{reduction relation} \pred\ is the smallest contextual relation that satisfies the following rules:
151150
\begin{center}\begin{tabular}{rll}
152-
$\send{c}{V} \comp \receive{c}{X}R$\ &\ $\pred\ R\subst{V}{X}$ & \tiny{(R-COMM)}\\
153-
$\rec{x}B$\ &\ $\pred\ B\subst{\rec{x}B}{x}$ & \tiny{(R-REP)}\\
151+
$\send{c}{\tuple{V}} \comp \receive{c}{\tuple{X}}R$\ &\ $\pred\ R\subst{\tuple{V}}{\tuple{X}}$ & \tiny{(R-COMM)}\\
152+
$\rec{x}R$\ &\ $\pred\ R\subst{\rec{x}R}{x}$ & \tiny{(R-REP)}\\
154153
$\pif{v = v}\pthen P \pelse Q$\ &\ $\pred\ P$ & \tiny{(R-EQ)}\\
155154
$\pif{v_1 = v_2}\pthen P \pelse Q$\ &\ $\pred\ Q$ \ \ (where $v_1\neq v_2$)& \tiny{(R-NEQ)}\\
156155
\multicolumn{2}{c}{\hspace{4.5em}$\underline{P\sequiv P', P \pred Q, Q\sequiv Q'}$} & \multirow{2}{*}{\tiny{(R-STRUC)}}\\
@@ -162,11 +161,11 @@ \section{Reduction Semantics}\label{secreducationsemantics}
162161
\begin{example}{exscopeextr}
163162
We will give a demonstration of how scope extrusion is defined using the rules and axioms of reduction and structural equivalence. Consider the expression
164163
\begin{align}
165-
\receive{d}{X}\send{X}{}\comp \new{c}(\send{d}{c} \comp \receive{c}{}stop)
164+
\receive{d}{x}\send{x}{}\comp \new{c}(\send{d}{c} \comp \receive{c}{}stop)
166165
\end{align}
167166
We can use (S-REST-COMP) to bring the restriction to the outside, giving:
168167
\begin{align}
169-
\new{c}(\receive{d}{X}\send{X}{}\comp \send{d}{c} \comp \receive{c}{}stop)
168+
\new{c}(\receive{d}{x}\send{x}{}\comp \send{d}{c} \comp \receive{c}{}stop)
170169
\end{align}
171170
Thanks to the reduction relation's contextuality, we can use (R-COMM) inside of the restriction operator and apply a substitution. Using this in conjunction with the above structural equality and (R-STRUCT), we get:
172171
\begin{align}
@@ -179,7 +178,7 @@ \section{Reduction Semantics}\label{secreducationsemantics}
179178
P(d) \pdef \new{c}(\send{d}{c} \comp \receive{c}{}stop)
180179
\end{align}
181180
\begin{align}
182-
\mathbb{C} = \receive{d}{X}\send{X}{} \comp [\ ]
181+
\mathbb{C} = \receive{d}{x}\send{x}{} \comp [\ ]
183182
\end{align}
184183
Then we have shown that if we drop $P(d)$ into the context $\mathbb{C}$ (forming $\mathbb{C}[P(d)]$), it will establish a new channel $c$ and extend its scope using $d$. Hence it is (S-REST-COMP) which allows our system's communication topology to change dynamically via scope extrusion.
185184
\end{example}
@@ -261,9 +260,9 @@ \section{Action Semantics}
261260
\end{definition}
262261
Hence, the transition $P \evolves{a} Q$ indicates that there is an action under which the process P becomes Q. We will refer to $Q$ is the \defmargin{residual} of $P$ after $a$.
263262

264-
There are three types of actions that may cause a process to evolve. Note that we will use $\alpha$ to refer to an action of arbitrary type. First, the process might receive a value. That is, a process $P$ can be said to be capable of the transition $P \evolves{\receives{c}{X}} Q$, which is to say $P$ can receive $X$ along $c$ resulting in the residual $Q$.
263+
There are three types of actions that may cause a process to evolve. Note that we will use $\alpha$ to refer to an action of arbitrary type. First, the process might receive a value. That is, a process $P$ can be said to be capable of the transition $P \evolves{\receives{c}{\tuple{X}}} Q$, which is to say $P$ can receive $\tuple{X}$ along $c$ resulting in the residual $Q$.
265264

266-
The second type of action available is sending. Here we need to be a bit more careful. In the case of receiving, the received name is always bound to a new name $X$ - so we needn't worry about issues of scoping. In sending, however, we might be transmitting either a free or a bound name (or a mix of them in a tuple). In the latter case, we need to take account of the fact that the\refmargin{scope extrusion}scope of the name is being extruded to whatever process receives the name. We denote the set of bound names in the send action by $\exports{B}$, and we say that this set of names is \defmargin{exported} by the process. Hence, the transition $P \evolves{\exports{B}\sends{c}{V}} Q$ represents that P can send $V$ over $c$, exporting $\exports{B}$ and resulting in $Q$. For example,
265+
The second type of action available is sending. Here we need to be a bit more careful. In the case of receiving, the received names are always bound to new names in $\tuple{X}$ - so we needn't worry about issues of scoping. In sending, however, we might be transmitting either free or a bound names, or a mix of them. In the latter case, we need to take account of the fact that the\refmargin{scope extrusion}scope of the name is being extruded to whatever process receives the name. We denote the set of bound names in the send action by $\exports{\tuple{B}}$, and we say that this set of names is \defmargin{exported} by the process. Hence, the transition $P \evolves{\exports{\tuple{B}}\sends{c}{\tuple{V}}} Q$ represents that P can send $\tuple{V}$ over $c$, exporting $\exports{\tuple{B}}$ and resulting in $Q$. For example,
267266
\[
268267
\new{a}\send{c}{a} \comp Q \evolves{\exports{b}\sends{c}{a}} Q
269268
\]
@@ -280,8 +279,8 @@ \section{Action Semantics}
280279
\begin{definition}{Action}\label{apiactionrules}
281280
The \emph{action relation} \evolves{} is the smallest relation between processes that satisfy the following rules:\todo{make the arrow for evolution size according to the text above it}
282281
\begin{center}\begin{tabular}{rllll}
283-
$\receive{c}{X}R$ & \evolves{\receives{c}{X}} & R\subst{V}{X} & & \tiny{(A-IN)}\\
284-
$\send{c}{V}$ & \evolves{\sends{c}{V}} & $stop$ & & \tiny{(A-OUT)}\\
282+
$\receive{c}{\tuple{X}}R$ & \evolves{\receives{c}{X}} & R\subst{V}{X} & & \tiny{(A-IN)}\\
283+
$\send{c}{\tuple{V}}$ & \evolves{\sends{c}{V}} & $stop$ & & \tiny{(A-OUT)}\\
285284
$\rec{x}R$ & \evolves{\tau} & $R\subst{\rec{x}R}{x}$ & & \tiny{(A-REP)}\\
286285
$\pif{v=v} \pthen P \pelse Q$ & \evolves{\tau} & $P$ & & \tiny{(A-EQ)}\\[10pt]
287286
$\pif{v_1=v_2} \pthen P \pelse Q$ & \evolves{\tau} & $Q$ & $v_1 \neq v_2$ & \tiny{(A-NEQ)}\\[10pt]
@@ -292,14 +291,14 @@ \section{Action Semantics}
292291
\multicolumn{3}{c}{$\underline{P \evolves{\alpha} P'}$} & \multirow{2}{*}{\footnotesize{$\textstyle b \not \in n(\alpha)$ }} & \multirow{2}{*}{\tiny{(A-REST)}}\\
293292
\multicolumn{3}{c}{$\new{b} P \evolves{\alpha} \new{b} P'$}\\[10pt]
294293

295-
\multicolumn{3}{c}{$\underline{P\evolves{\exports{B}\sends{c}{V}} P'}$} & \multirow{2}{*}{\footnotesize{$n \neq c, n\in V$ }}& \multirow{2}{*}{\tiny{(A-OPEN)}}\\
296-
\multicolumn{3}{c}{$\new{n}P \evolves{\exports{n,B}\sends{c}{V}} P'$}\\[10pt]
294+
\multicolumn{3}{c}{$\underline{P\evolves{\exports{\tuple{B}}\sends{c}{\tuple{V}}} P'}$} & \multirow{2}{*}{\footnotesize{$n \neq c, n\in \tuple{V}$ }}& \multirow{2}{*}{\tiny{(A-OPEN)}}\\
295+
\multicolumn{3}{c}{$\new{n}P \evolves{\exports{n,\tuple{B}}\sends{c}{\tuple{V}}} P'$}\\[10pt]
297296

298-
\multicolumn{3}{c}{$\underline{P\evolves{\receives{c}{X}} P',\ Q \evolves{\exports{B}\sends{c}{V}} Q'}$} & \multirow{2}{*}{\footnotesize{$\textstyle \exports{B}\cap fn(P) = \emptyset$ }} & \multirow{2}{*}{\tiny{(A-COMM)}}\\
299-
\multicolumn{3}{c}{$P\comp Q \evolves{\tau} \new{B}(P'\comp Q')$}\\[10pt]
297+
\multicolumn{3}{c}{$\underline{P\evolves{\receives{c}{\tuple{X}}} P',\ Q \evolves{\exports{\tuple{B}}\sends{c}{\tuple{V}}} Q'}$} & \multirow{2}{*}{\footnotesize{$\textstyle \exports{\tuple{B}}\cap fn(P) = \emptyset$ }} & \multirow{2}{*}{\tiny{(A-COMM)}}\\
298+
\multicolumn{3}{c}{$P\comp Q \evolves{\tau} \new{\tuple{B}}(P'\comp Q')$}\\[10pt]
300299
\end{tabular}\end{center}
301300
\end{definition}
302-
The first of two of these rules simply describe the ability of processes to evolve under input or output. For example, a process $\send{c}{V} \comp P$ will evolve to $stop \comp P \sequiv P$ when it exercises its capability for output on $c$. For a receiving process, evolution under (A-IN) is only possible when the substitution $\subst{V}{X}$ makes sense. That is, $V$ and $X$ must have the same arity\refmargin{arity}and in a typed system we'd want to ensure that their types were compatible\footnote{See \cite{henn07} for a discussion off type systems in the \picalc}.
301+
The first of two of these rules simply describe the ability of processes to evolve under input or output. For example, a process $\send{c}{\tuple{V}} \comp P$ will evolve to $stop \comp P \sequiv P$ when it exercises its capability for output on $c$. For a receiving process, evolution under (A-IN) is only possible when the substitution $\subst{\tuple{V}}{\tuple{X}}$ makes sense. That is, $\tuple{V}$ and $\tuple{X}$ must have the same arity\refmargin{arity}and in a typed system we'd want to ensure that their types were compatible\footnote{See \cite{henn07} for a discussion off type systems in the \picalc}.
303302

304303
Meanwhile, (A-REP), (A-EQ) and (A-NEQ) serve the provide the same interval evolution capabilities as (R-REP), (R-EQ) and (R-NEQ) do in the reduction semantics.
305304

@@ -317,9 +316,9 @@ \section{Action Semantics}
317316
\end{tabular}\end{center}
318317
Above, we have a process sending on $b$ but the scope of $b$ has not actually been extruded (ie by being received on $c$). Hence, we need to be careful not to `capture' a channel like $b$ by allowing exported channels to have the same name as free variables outside the original scope of the process.
319318

320-
(A-OPEN) expresses scope extrusion of a name $n$. If we have that a process $P$ can evolves to $P'$ under the action $\exports{B}\sends{c}{V}$, then we can infer that some name $n$, whose scope is now bound to $P$, can be exported in the the action $\exports{n,B}\sends{c}{V}$. Note that $n$ must actually occur in $V$ if it is to be exported; note also that $n$ cannot be $c$ since restricting $n$ (ie $c$) to $P$ would cause a scoping issue that interfered with an outside processes ability to receive on $c$.
319+
(A-OPEN) expresses scope extrusion of a name $n$. If we have that a process $P$ can evolves to $P'$ under the action $\exports{\tuple{B}}\sends{c}{\tuple{V}}$, then we can infer that some name $n$, whose scope is now bound to $P$, can be exported in the the action $\exports{n,\tuple{B}}\sends{c}{\tuple{V}}$. Note that $n$ must actually occur in $\tuple{V}$ if it is to be exported; note also that $n$ cannot be $c$ since restricting $n$ (ie $c$) to $P$ would cause a scoping issue that interfered with an outside processes ability to receive on $c$.
321320

322-
Finally we have (A-COMM), which expresses scope extrusion as well but this time in the context of the internal action $\tau$. According to (A-COMM), $\tau$ is defined as the simultaneous (compositionally) occurrence of an input action and a matching output action on the same channel. In the inferred process $P\comp Q$, no external contributions are needed for evolution, which results in the process $P'\comp Q'$, with the exported names $\exports{B}$ now being scopes to both.
321+
Finally we have (A-COMM), which expresses scope extrusion as well but this time in the context of the internal action $\tau$. According to (A-COMM), $\tau$ is defined as the simultaneous (compositionally) occurrence of an input action and a matching output action on the same channel. In the inferred process $P\comp Q$, no external contributions are needed for evolution, which results in the process $P'\comp Q'$, with the exported names $\exports{\tuple{B}}$ now being scopes to both.
323322

324323
\begin{example}{exsynchronous_actions}
325324
In \refex{exsynchronous}, we defined a simple process for modeling synchronous sends:

0 commit comments

Comments
 (0)
Please sign in to comment.