| 1 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 2 |
|
| 3 |
% csp2e.tex -> hack guide to zed-csp.sty |
| 4 |
|
| 5 |
% (c) Jim Davies September 1994 >> Version 0 << |
| 6 |
|
| 7 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 8 |
|
| 9 |
\documentclass[12pt]{article} |
| 10 |
|
| 11 |
% \usepackage[yy]{lucbr} |
| 12 |
|
| 13 |
% Uncomment the above line if you have the Lucida fonts and want to |
| 14 |
% use them to set csp. Note that you may have to change the [yy] |
| 15 |
% option if you are not using the Y&Y font naming convention. |
| 16 |
|
| 17 |
\usepackage{zed-csp} |
| 18 |
|
| 19 |
\advance\textwidth 30mm |
| 20 |
\advance\oddsidemargin -15mm |
| 21 |
\advance\evensidemargin -15mm |
| 22 |
\advance\textheight 35mm |
| 23 |
\advance\topmargin -20mm |
| 24 |
|
| 25 |
\begin{document} \thispagestyle{empty} |
| 26 |
|
| 27 |
\def\AMS{% |
| 28 |
$\cal{A}$ |
| 29 |
\kern-.5em\lower.5ex\hbox{$\cal{M}$}\kern-.125em$\cal{S}$} |
| 30 |
|
| 31 |
\parindent 0pt |
| 32 |
\parskip 10pt |
| 33 |
|
| 34 |
{\huge\bf Setting real-time CSP} |
| 35 |
|
| 36 |
\vskip 2mm |
| 37 |
|
| 38 |
{\Large Jim Davies} |
| 39 |
|
| 40 |
\vskip 8mm |
| 41 |
|
| 42 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 43 |
|
| 44 |
\section{Introduction} |
| 45 |
|
| 46 |
The language and models of CSP have undergone a gradual evolution |
| 47 |
since the publication of the first CSP textbook---Hoare's {\sl |
| 48 |
Communicating Sequential Processes\/} (Prentice-Hall, 1985). The |
| 49 |
forthcoming text on real-time CSP will provide for some |
| 50 |
degree of standardisation. |
| 51 |
|
| 52 |
In parallel, we hope to provide a standard set of macros for setting |
| 53 |
documents which use CSP notation. This will allow users to exchange |
| 54 |
documents in electronic form, and will form part of the user interface |
| 55 |
to the language tools. |
| 56 |
|
| 57 |
The macros are defined by a style file called \verb|zed-csp.sty|. |
| 58 |
This should work with \LaTeXe. Inquiries, suggestions, or complaints |
| 59 |
should be addressed to |
| 60 |
|
| 61 |
\begin{center} |
| 62 |
{\tt [email protected]}. |
| 63 |
\end{center} |
| 64 |
|
| 65 |
Note that this is a fairly quick fix of the style to enable myself and |
| 66 |
others to use the improved facilities offered by the new version of |
| 67 |
\LaTeX. It has not been rigorously tested, although it seems to work |
| 68 |
for me. |
| 69 |
|
| 70 |
\section{Symbols} |
| 71 |
|
| 72 |
We can divide the symbols used into three separate classes: symbols |
| 73 |
for the language itself, symbols used in the definition of the |
| 74 |
semantics, and symbols used in the specification language. |
| 75 |
|
| 76 |
\subsection{The language of real-time CSP} |
| 77 |
|
| 78 |
The operators of real-time CSP are set using macros of the same name. |
| 79 |
The macros for atomic operators begin with an uppercase letter; the |
| 80 |
same is true for those representing indexed versions of parallel and |
| 81 |
choice operators. All other macros are lowercase throughout. Some |
| 82 |
operators accept optional arguments, but no argument is compulsory. |
| 83 |
|
| 84 |
When an operator with an optional argument appears within an optional |
| 85 |
argument, \LaTeX may require assistance if it is to parse the |
| 86 |
expression correctly. In these circumstances, we use an extra pair of |
| 87 |
braces to delimit the process expression: e.g., |
| 88 |
\begin{center} |
| 89 |
\verb|\Ftf[{P \parallel[A] Q}]|. |
| 90 |
\end{center} |
| 91 |
|
| 92 |
\begin{tabular}{p{2in}p{1.5in}c} \\ \\ |
| 93 |
bottom & \verb|\Bottom| & $ \Bottom $ \\[1ex] |
| 94 |
stop & \verb|\Stop| & $ \Stop $ \\[1ex] |
| 95 |
skip & \verb|\Skip| & $ \Skip $ \\[1ex] |
| 96 |
wait & \verb|\Wait| & $ \Wait $ \\[1ex] |
| 97 |
prefix & \verb|\then| & $ \then $ \\[1ex] |
| 98 |
external choice & \verb|\extchoice| & $ \extchoice $ \\[1ex] |
| 99 |
internal choice & \verb|\intchoice| & $ \intchoice $ \\[1ex] |
| 100 |
hiding & \verb|\hide| & $ \hide $ \\[1ex] |
| 101 |
parallel & \verb|\parallel[A][B]|& $ \parallel[A][B] $\\[1ex] |
| 102 |
interleaving & \verb|\interleave| & $ \interleave $ \\[1ex] |
| 103 |
sharing & \verb|\parallel[C]| & $ \parallel[C] $ \\[1ex] |
| 104 |
recursion & \verb|\mu X \spot P| & $ \mu X \spot P $ \\[1ex] |
| 105 |
timeout & \verb|\timeout[t]| & $\timeout[t]$\\[1ex] |
| 106 |
transfer & \verb|\transfer[t]| & $\transfer[t]$\\[1ex] |
| 107 |
interrupt & \verb|\interrupt| & $\interrupt$ \\[1ex] |
| 108 |
timer & \verb|\at| & $\at$ \\[1ex] |
| 109 |
indexed external choice & \verb|\Extchoice| & $ \Extchoice $ \\[1ex] |
| 110 |
indexed internal choice & \verb|\Intchoice| & $ \Intchoice $ \\[1ex] |
| 111 |
indexed alphabet parallel & \verb|\Parallel| & $ \Parallel $ \\[1ex] |
| 112 |
indexed interleaving & \verb|\Interleave| & $ \Interleave $ |
| 113 |
\end{tabular} |
| 114 |
|
| 115 |
\subsection{Parallel combinations} |
| 116 |
|
| 117 |
There are several ways to denote the parallel combination of |
| 118 |
two processes in CSP. Firstly, we can describe the set of events upon |
| 119 |
which they must cooperate: e.g., in the process |
| 120 |
\[ |
| 121 |
P \parallel[C] Q |
| 122 |
\] |
| 123 |
components $P$ and $Q$ must cooperate upon every event from the shared |
| 124 |
set $C$. Alternatively, we can declare two alphabets |
| 125 |
\begin{eqnarray*} |
| 126 |
\alpha P & = & A \\ |
| 127 |
\alpha Q & = & B |
| 128 |
\end{eqnarray*} |
| 129 |
and write |
| 130 |
\[ |
| 131 |
P \parallel Q |
| 132 |
\] |
| 133 |
to denote the parallel combination in which $P$ and $Q$ must cooperate |
| 134 |
upon every event in the intersection of their alphabets. Finally, we |
| 135 |
can add explicit alphabet information to the parallel operator: e.g., |
| 136 |
\[ |
| 137 |
P \parallel[A][B] Q |
| 138 |
\] |
| 139 |
is equivalent to the above parallel combination, given the values |
| 140 |
chosen for $\alpha P$ and $\alpha Q$. |
| 141 |
|
| 142 |
\subsection{Delays and timers} |
| 143 |
|
| 144 |
We write $\Wait t ; P$ to denote the process which will delay for time |
| 145 |
$t$ before behaving as $P$. The wait process is a delayed form of |
| 146 |
termination $\Skip$: i.e., |
| 147 |
\begin{eqnarray*} |
| 148 |
\Wait 0 & = & \Skip |
| 149 |
\end{eqnarray*} |
| 150 |
To model a nondeterministic delay, we can use an internal choice |
| 151 |
operator indexed by a range of time values: |
| 152 |
\[ |
| 153 |
\Intchoice_{t \in [t_1,t_2)} \Wait t |
| 154 |
\] |
| 155 |
A convenient abbreviation for this involves overloading the $\Wait$ |
| 156 |
operator: e.g., |
| 157 |
\[ |
| 158 |
\Wait [t_1,t_2) |
| 159 |
\] |
| 160 |
abbreviates the above choice. |
| 161 |
|
| 162 |
External events in a process description are performed in cooperation |
| 163 |
with the environment of that process. It is therefore quite likely |
| 164 |
that an external event will not occur as soon as the process is ready. |
| 165 |
The time elapsed between the offer of an event and its occurrence can |
| 166 |
influence future behaviour; the rest of the process description should |
| 167 |
be allowed to refer to this time. |
| 168 |
|
| 169 |
Accordingly, real-time CSP includes a timer construct, or |
| 170 |
`passage-of-time' operator. We write |
| 171 |
\[ |
| 172 |
a \at t \then P \qquad \qquad \hbox{\verb|a \at t \then P|} |
| 173 |
\] |
| 174 |
to denote a process which is initially ready to engage in event $a$. |
| 175 |
The time variable $t$ is assigned the relative time at which $a$ |
| 176 |
occurs. This is the same as the elapsed time between control being |
| 177 |
passed to this process---at which point the offer of $a$ is made---and |
| 178 |
the event $a$ actually occuring. |
| 179 |
|
| 180 |
A useful extension to this, which adds nothing to the expressivity of |
| 181 |
the language but can make for more intelligible process descriptions, |
| 182 |
is the offer timeout. We write |
| 183 |
\[ |
| 184 |
a \at t \{ d \} \then P \qquad \qquad |
| 185 |
\hbox{\verb|a \at t \{ d \} \then P|} |
| 186 |
\] |
| 187 |
to denote a process which offers to perform $a$, and will store the |
| 188 |
time of occurrence in $t$, but will withdraw the offer if it has not |
| 189 |
been accepted by time $d$. (This form of timeout was suggested |
| 190 |
by Guy Leduc for his version of timed LOTOS.) |
| 191 |
|
| 192 |
\section{Mathematical language} |
| 193 |
|
| 194 |
The semantic models of CSP come with a great deal of notational |
| 195 |
baggage. We need to define operators to project information out of |
| 196 |
traces, refusals, and timed failures. There is also a specification |
| 197 |
language based upon the timed semantics, and the names used for the |
| 198 |
models themselves. |
| 199 |
|
| 200 |
\subsection{Logic, sets, and sequences} |
| 201 |
|
| 202 |
\begin{tabular}{c@{\hspace{0.55in}}c@{\hspace{0.55in}}c} \\ |
| 203 |
\begin{tabular}[t]{@{}lc} |
| 204 |
\verb|\defs| & $ \defs $ \\[0.6ex] |
| 205 |
\verb|\mu| & $ \mu $ \\[0.6ex] |
| 206 |
\verb|\lambda| & $ \lambda $ \\[0.6ex] |
| 207 |
\verb|\exists| & $ \exists $ \\[0.6ex] |
| 208 |
\verb|\forall| & $ \forall $ \\[0.6ex] |
| 209 |
\verb|\spot| & $ \spot $ \\[0.6ex] |
| 210 |
\verb|\nat| & $ \nat $ \\[0.6ex] |
| 211 |
\verb|\num| & $ \num $ \\[0.6ex] |
| 212 |
\verb|\rat| & $ \rat $ \\[0.6ex] |
| 213 |
\verb|\real| & $ \real $ \\[0.6ex] |
| 214 |
\verb|\seq| & $ \seq $ |
| 215 |
\end{tabular} & |
| 216 |
\begin{tabular}[t]{lc} |
| 217 |
\verb|\land| & $ \land $ \\[0.6ex] |
| 218 |
\verb|\lor| & $ \lor $ \\[0.6ex] |
| 219 |
\verb|\Land| & $ \Land $ \\[0.6ex] |
| 220 |
\verb|\Lor| & $ \Lor $ \\[0.6ex] |
| 221 |
\verb|\lnot| & $\lnot $ \\[0.6ex] |
| 222 |
\verb|\implies| & $ \implies $ \\[0.6ex] |
| 223 |
\verb|\iff| & $ \iff $ \\[0.6ex] |
| 224 |
\verb|\upto| & $\upto$ \\[0.6ex] |
| 225 |
\verb|\le| & $ \le $ \\[0.6ex] |
| 226 |
\verb|\ge| & $ \ge $ \\[0.6ex] |
| 227 |
\verb|\project| & $ \project $ |
| 228 |
\end{tabular} & |
| 229 |
\begin{tabular}[t]{lc} |
| 230 |
\verb|\power| & $ \power $ \\[0.6ex] |
| 231 |
\verb|\finset| & $ \finset $ \\[0.6ex] |
| 232 |
\verb|\cross| & $ \cross $ \\[0.6ex] |
| 233 |
\verb|\union| & $ \union $ \\[0.6ex] |
| 234 |
\verb|\inter| & $ \inter $ \\[0.6ex] |
| 235 |
\verb|\Union| & $ \Union $ \\[0.6ex] |
| 236 |
\verb|\Inter| & $ \Inter $ \\[0.6ex] |
| 237 |
\verb|\dom| & $ \dom$ \\[0.6ex] |
| 238 |
\verb|\ran| & $ \ran$ \\[0.6ex] |
| 239 |
\verb|\emptyset| & $\emptyset$ \\[0.6ex] |
| 240 |
\verb|\set{x}| & $ \set{x} $ |
| 241 |
\end{tabular} |
| 242 |
\end{tabular} |
| 243 |
|
| 244 |
\subsection{Operators on traces} |
| 245 |
|
| 246 |
\begin{tabular}{p{1.95in}p{1.75in}c} \\ |
| 247 |
empty trace & \verb|\nil| & $\nil $ \\[0.6ex] |
| 248 |
trace & \verb|\trace{e_1,e_2}| & $\trace{e_1,e_2}$\\[0.6ex] |
| 249 |
catenation of traces & \verb|\cat| & $\cat $ \\[0.6ex] |
| 250 |
count & \verb|\cnt| & $\cnt $ \\[0.6ex] |
| 251 |
during & \verb|\during| & $\during $ \\[0.6ex] |
| 252 |
tick event & \verb|\tick| & $\tick$ \\[0.6ex] |
| 253 |
subsequence & \verb|\subseq| & $\subseq$ \\[0.6ex] |
| 254 |
data values & \verb|\data| & $\data$ |
| 255 |
\end{tabular} |
| 256 |
|
| 257 |
\subsection{Projection functions} |
| 258 |
|
| 259 |
\begin{tabular}{p{1.95in}p{1.75in}l} \\ |
| 260 |
begin & \verb|\Begin | & $\Begin$ \\[0.4ex] |
| 261 |
end & \verb|\End | & $\End $ \\[0.4ex] |
| 262 |
head & \verb|\Head | & $\Head $ \\[0.4ex] |
| 263 |
first & \verb|\First | & $\First$ \\[0.4ex] |
| 264 |
tail & \verb|\Tail | & $\Tail $ \\[0.4ex] |
| 265 |
front & \verb|\Front | & $\Front$ \\[0.4ex] |
| 266 |
last & \verb|\Last | & $\Last $ \\[0.4ex] |
| 267 |
times & \verb|\Times | & $\Times$ \\[0.4ex] |
| 268 |
events & \verb|\Events | & $\Events$ \\[0.4ex] |
| 269 |
\end{tabular} |
| 270 |
|
| 271 |
$\Times$ and $\Events$ are projection functions from timed traces to |
| 272 |
sequences of times and sequences of events respectively. $\Head$ and |
| 273 |
$\Tail$ may be applied to any sequence. $\Begin$ and $\End$ may be |
| 274 |
applied to timed traces and timed refusals. $\First$ is a synonym for |
| 275 |
$\Head$. $\Front$ is the dual of $\Tail$. $\Last$ is the dual of |
| 276 |
$\Head$. |
| 277 |
|
| 278 |
To denote the set of events mentioned in a timed or untimed trace or |
| 279 |
refusal, we prefix the name of the object with $\alpha$. For example, |
| 280 |
the set of events mentioned in the timed trace $s$ would be written |
| 281 |
$\alpha s$. Earlier version of real-time CSP did this using the |
| 282 |
$\sigma$ operator to avoid confusion with process alphabets. Where |
| 283 |
there is scope for confusion, we suggest that this practice is |
| 284 |
continued. |
| 285 |
|
| 286 |
\subsection{Semantic functions, models, and spaces} |
| 287 |
|
| 288 |
In {\sl Advanced CSP}, we use long names for the semantic functions: |
| 289 |
|
| 290 |
\begin{tabular}{p{1.95in}p{1.75in}l} \\ |
| 291 |
semantics & \verb|\Semantics| & $\Semantics$ \\ |
| 292 |
traces & \verb|\Traces| & $\Traces$ \\ |
| 293 |
failures & \verb|\Failures| & $\Failures$ \\ |
| 294 |
timed failures & \verb|\TimedFailures| & $\TimedFailures$ \\ |
| 295 |
divergences & \verb|\Divergences| & $\Divergences$ \\ |
| 296 |
infinites & \verb|\Infinites| & $\Infinites$ |
| 297 |
\end{tabular} |
| 298 |
|
| 299 |
Any semantic function macro can be given an optional argument. This |
| 300 |
will be set within semantic brackets: e.g., \verb|\Traces[P]| yields |
| 301 |
$\Traces[P]$. To obtain the semantic brackets alone, use the |
| 302 |
\verb|\semb| macro; this takes a single compulsory argument. |
| 303 |
Alternatively, the macros \verb|\leftsemb| and \verb|\rightsemb| |
| 304 |
produce left and right semantic brackets respectively. |
| 305 |
|
| 306 |
In theoretical papers, we often need to refer to several models, |
| 307 |
functions, and associated spaces. To make things easier on ourselves, |
| 308 |
we adopt short names for these mathematical objects, using subscripts |
| 309 |
to identify the model concerned. For example, the objects associated |
| 310 |
with the timed failures model are all subscripted with $TF$. |
| 311 |
|
| 312 |
The models themselves have macros beginning \verb|\M|: |
| 313 |
|
| 314 |
\begin{tabular}{p{2.4in}p{1.1in}l} \\ |
| 315 |
traces & \verb|\Mut| & $ \Mut $ \\ |
| 316 |
failures & \verb|\Muf| & $ \Muf $ \\ |
| 317 |
failures-divergences & \verb|\Mufd| & $ \Mufd $ \\ |
| 318 |
timed failures & \verb|\Mtf| & $ \Mtf $ \\ |
| 319 |
timed failures-stability & \verb|\Mtfs| & $ \Mtfs $ \\ |
| 320 |
timed infinite & \verb|\Mti| & $ \Mti $ |
| 321 |
\end{tabular} |
| 322 |
|
| 323 |
The matching semantic functions use \verb|\F| instead---e.g., |
| 324 |
\verb|\Fut| for untimed traces---and the observation spaces use |
| 325 |
\verb|\S|. |
| 326 |
|
| 327 |
\subsection{Refinement and satisfaction} |
| 328 |
|
| 329 |
The satisfaction notation employed in Hoare's {\sl Communicating |
| 330 |
Sequential Processes} has been retained. We also have a refinement |
| 331 |
relation between processes, possibly indexed by the name of the model |
| 332 |
concerned. |
| 333 |
|
| 334 |
The satisfaction relation is set as follows: \verb|P \sat S| produces |
| 335 |
$P \sat S$. The refinement relation is produced by \verb|\lessdet| (or |
| 336 |
\verb|refinedby|, a synonymbol). |
| 337 |
|
| 338 |
\subsection{Specifications} |
| 339 |
|
| 340 |
To capture timing constraints at the level of the semantic models, we |
| 341 |
use a number of specification `macros'. These are set using \LaTeX\ |
| 342 |
macros which begin with an `m' (for macro) and are then capitalised. |
| 343 |
\par |
| 344 |
\begin{tabular}{p{1.95in}p{1.75in}l} \\ |
| 345 |
internal & \verb|\mInternal | & $ \mInternal $ \\[0.4ex] |
| 346 |
refuses & \verb|\mRef | & $ \mRef $ \\[0.4ex] |
| 347 |
at & \verb|\mAt | & $ \mAt $ \\[0.4ex] |
| 348 |
live & \verb|\mLive | & $ \mLive $ \\[0.4ex] |
| 349 |
open & \verb|\mOpen | & $ \mOpen $ \\[0.4ex] |
| 350 |
from & \verb|\mFrom | & $ \mFrom $ \\[0.4ex] |
| 351 |
until & \verb|\mUntil | & $ \mUntil $ \\[0.4ex] |
| 352 |
live from & \verb|\mLiveFrom | & $ \mLiveFrom $ \\[0.4ex] |
| 353 |
open from & \verb|\mOpenFrom | & $ \mOpenFrom $ \\[0.4ex] |
| 354 |
name of last & \verb|\mNameOfLast| & $ \mNameOfLast $ \\[0.4ex] |
| 355 |
before & \verb|\mBefore | & $ \mBefore $ \\[0.4ex] |
| 356 |
after & \verb|\mAfter | & $ \mAfter $ \\[0.4ex] |
| 357 |
time of last & \verb|\mTimeOfLast| & $ \mTimeOfLast $ \\[0.4ex] |
| 358 |
\end{tabular} |
| 359 |
|
| 360 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 361 |
|
| 362 |
\section{Discussion} |
| 363 |
|
| 364 |
\subsection{Dependencies} |
| 365 |
|
| 366 |
You must have the AMS fonts available, and the {\tt amsfonts} |
| 367 |
installation must have been performed for \LaTeXe. This requires the |
| 368 |
{\tt mfnfss} package; it takes about twenty seconds. |
| 369 |
|
| 370 |
\subsection{CSP and Z} |
| 371 |
|
| 372 |
You may have problems if you try to use the {\tt zed-csp} package with |
| 373 |
{\tt fuzz} or any style package that uses the AMS fonts. The good |
| 374 |
news is that you shouldn't need them. All of the AMS symbols are |
| 375 |
defined in the {\tt zed-csp} package, using the standard names. |
| 376 |
|
| 377 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 378 |
|
| 379 |
\end{document} |
| 380 |
|
| 381 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |