0% found this document useful (0 votes)
21 views14 pages

The Chemical Abstract Machine

The document introduces a new abstract machine model based on chemical metaphors to represent asynchronous concurrent computations. It discusses how this model can encapsulate and manage interactions between molecules (representing processes) through reaction rules and membranes, contrasting it with traditional concurrency models. The paper aims to illustrate the operational semantics of process calculi like TCCS and CCS using this chemical abstract machine framework.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views14 pages

The Chemical Abstract Machine

The document introduces a new abstract machine model based on chemical metaphors to represent asynchronous concurrent computations. It discusses how this model can encapsulate and manage interactions between molecules (representing processes) through reaction rules and membranes, contrasting it with traditional concurrency models. The paper aims to illustrate the operational semantics of process calculi like TCCS and CCS using this chemical abstract machine framework.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

The Chemical Abstract Machine

GCrard Berry* G6rard Boudol

Ecole des Mines INRIA


Sophia-Antipolis Sophia-Antipolis
06560 Valbonne, France 06560 Valbonne, France

Abstract The situation is much less clear in the field of con-


current programming. Models such as Petri Nets,
We introduce a new kind of abstract machine based Communicating Automata, or Data Flow Networks
on the chemical metaphor used in the l? language of can be considered as abstract machines, but certainly
Ban%tre & al. States of a machine are chemical solu- they lack expressive power. More expressive models
tions where floating molecules can interact according such as Algebraic Process Calculi (18,6] are intended
to reaction rules. Solutions can be stratified by encap- to be specification formalisms for distributed systems
sulating subsolutions within membranes that force re- rather than abstract machines. Implementation mod-
actions to occur locally. We illustrate the use of this els of Concurrent Programming Languages such as
model by describing the operational semantics of the CSP [IS] are conceptually based on standard sequen-
TCCS and CCS process calculi. We also show how tial machine models augmented with scheduling facil-
to extract a higher-order concurrent &calculus out of ities, not on specific abstract machines.
the basic concepts of the chemical abstract machine.
Most available concurrency models are based on
architectural concepts, e.g. networks of processes
1 Introduction communicating by means of ports or channels. Such
concepts convey a rigid geometrical vision of concur-
We present the notion of a Chemical Abstract Ma- rency. Our chemical abstract machine model is based
chine, suited to model asynchronous concurrent com- on a radically different paradigm, which originated
putations. We show that chemical abstract machines in the I’ language of Banstre and Le Metayer [2,3].
can 5nplement” known models of concurrent com- These authors pointed out that parallel programming
putation such as algebraic process calculi [18,6] and with control threads is more difficult to manage than
a concurrent X-calculus similar to the one presented sequential programming, a fact that contrasts with
in [7). the common expectation that parallelism should ease
Abstract machines are widely used in the classical program design. They argued that a high-level par-
theory of sequential computations. Turing Machines allel programming methodology should be liberated
or Random Access Machines are primary tools within from control management. A similar idea motivates
the theories of recursive functions and computational the UNITY model of Chandy and Misra [9]. Then
complexity. The SECD machine 117) and the Cate- they proposed a model where the concurrent Comp+
gorical Abstract Machine [lo] are used to study and nents are freely “moving” in the system and commu-
implement the X-calculus, while the SMC machine nicate when they come in contact.
[19] may be used to describe the semantics of usual Intuitively, the state of a system is like a chemi-
imperative constructs. cal solution in which floating molecules can interact
*presently at LIX, Ecole Polytechnique, 91 128 Palaiseau, with each other according to reaction rules; a mag-
France ical mechanism stirs the solution, allowing for pos-
Work supported by the french Programme de Rechercher
Coordonn&es C3.
sible contacts between molecules. In chemistry, this
is the result of Brownian motion, but we don’t insist
on any particular mechanism, this being an imple-
mentation matter not studied here, see (2,91. The so-
Permission to copy without fee all or part of this material is granted lution transformation process is obviously truly par-
provided that the copies are not made or distributed for direct
allel: any number of reactions can be performed in
commercial advantage, the ACM copyright notice and the title of the
publication and its date appear, and notice is given that copying is by
permission of the Association for Computing Machinery. To copy other-
wise or to republish, requires a fee and/or specific permission.

@ 1990 ACM 089791-3434/90/0001/0081 $1.50 81


parallel, provided that they involve disjoint sets of 2 Handling a Subset of CCS
molecules. Notice that the tuple space model of Linda
!8] is based on very similar concepts and bears the Our first illustrative example is a fragment CCS-
same degree of potential parallelism, as well as the of Milner’s process caIculus CCS (181, containing the
sets of assignments used in UNITY 191. most basic operators 0 (inaction), ‘.’ (prefixing), and
Let us give a simple but striking example from [2,3]. ‘ ( ’ (parallel), as well as the restriction operator ‘\’ to
Assume the solution is originally made of all integers make the example non-trivial.
from 2 to n, along with the rule that any integer
Let U= {a,b,...} b e a set of namea and
destroys its multiples. Then the solution will end
up containing the prime numbers between 2 and n. L = (a,?i ] a f U} be the set of labels built on U.
See [2,3] for more examples and for implementation We use the symbols cy, /3, etc., to range over labels,
techniques. with ?%z CY. The CCS- agents p, q, etc., are given
by the syntax:
TechnicaUy, a I program is defined by the struc-
ture of the molecules it handles and by a set of re-
action rules. Solutions are represented by multisets P ::= 0 I a.~ I (P I P) I p\a
of molecules: this accounts for the associativity and
commutativity of parallel composition, that is the im-
plicit stirring mechanism. The reaction rules are mul-
tiset rewritings. 2.1 The Semantics of TCCS
We keep the same basic notions for chemical ab-
stract machines, We elaborate on the original I’ lan- Process calculi semantics are usually defined by in-
guage by presenting molecules in a systematic way ference rules in Plotkin’s structural operational se-
as terms of algebras and refining the classification of mantics style, called SOS for short. Milner’s origi-
rules. Some molecules do not exhibit interaction ca- nal rules involve an additional T label representing
pabilities; those which are ready to interact are called internal communication. This happens to be quite
ions. A solution can be heated to break complex unnatural with respect to abstract machine execu-
molecules into smaller ones up to ions. Conversely, a tions, where internal transitions should not be visible
solution can be coaled to rebuild heavy molecules from to the user. We prefer to use the De Nicola - Hen-
components. Furthermore, to deal with abstraction nessy TCCS rules [13] that define two kinds of transi-
and hierarchical programming, we allow a molecule to tions between agents: the internal transitions p ----)p’
contain a subsolution enclosed in a membrane, which and the labelled transitions p 4 p’. Intuitively, p -+ p’
can be somewhat porous to allow communication be- means that p can become p’ by executing an internal
tween the encapsulated solution and its environment. action, and p 3 p’ means that p can offer its environ-
The chemical abstract machines all obey a simple ment to accept the action a and then become pt.
set of structural laws. Each particular machine is
Both transitions systems are defined in a structural
given by adding a set of simple rules that specify how
way: the behavior of an agent is deduced from the
to produce new molecules from old ones. Unlike the
behaviors of its components. Since internal commu-
inference rules classically used in structural opera-
nications generate internal transitions, the inference
tional semantics, the specific rules have no premisses
systems for -+ invokes the one for 5:
and are purely local.
In this paper, we concentrate on the descriptive
power of chemical abstract machines. The strength a.p 4 p
of the model lies in the membrane notion. Membranes I
P-+P
make it possible to build chemical abstract machines PIti--+ p’lq and ~lp--vld
that have the power of classical process calculi or that p-s, t
behave as concurrent generalisations of the lambda-
plq~:‘(q and qlp~:lp’
calculus.
a t ?i t
To familiarise the reader with our concepts, the
next section presents a simple machine for a subset ii!? + P’i+cf
of CCS. Section 3 gives some formal definitions. In
Section 4, we treat the full TCCS 1131 calculus and fi
indicate how to handle other process calculi. Section
Ps P’ a fZ {a,5
5 is devoted to a concurrent lambda-calculus similar
p\a 4 $\a
to that of [7]. We conclude in section 6.

a2
2.2 Basic Chemistry: Concurrency The final solution (1 O,O,O b only contains the in-
and Communication ert molecule 0. It is natural to clean it up by using
the following rule, which says that 0 evaporates when
We now take the chemical abstract machine point of heated:
view, limiting us to internal transitions of restriction-
inaction cleanup:
free agents in this section. Restriction and external
communication will be treated in the next section. o-
Instead of composing their behaviors, we make the
A last cleaning step yields the empty solution {ID.
agents or molecules directly react with each other
Generally speaking, chemical executions are non-
within a solution, that is a multiset S = {Ip, Q, . . . 5.
deterministic. For example, in the solution
There are only two basic rules:
{Ia.O, ‘ii.b.0, E.c.OD, the a.0 ion can react with any
parallel: of the two others ions, yielding either {I b.0, Ti.c.0) or
(IE.b.0, c.0 D after cleanup.
PIQ “P, 4 The reader will appreciate the simplicity of the
reaction: chemical executions compared to the sequence of
proofs and simplifications involved in the SOS seman-
a.p, if*q --+ p, q tics. The use of the structural rules for ‘ I ’ is factored
throughout an execution by the heating process, since
The rules apply to molecules present in the solution; we directly chain reactions by keeping the solution
they do not apply inside molecules. hot. The SOS evaluation involves structural rules at
The first rule is reversible. It says that any each computation step.
molecule of the form p 1q that floats in the solution In fact, the simplification comes from the abandon
can be heated up (symbol -) to decompose it into of the rigid algebraic syntax. Chemical concurrency
its components p and q, and conversely that any pair is nukrally associative and commutative, since mul-
p, q of molecules can be cooled down (symbol -) to tisets are intrinsically unordered. The notion of syn-
rebuild a compound molecule p 1q. The comma ‘,’ tactic position disappears even for the standard syn-
appearing in the right-hand side expresses that the tactic parallel construct ‘ I’: it is impossible to know
heating and cooling rule respectively yield and take whether Op, q D was obtained by heating ()p I q D or
a pair of molecules. MpD. On the contrary, the SOS semantics need
The reaction rule deals with iona, i.e. molecules to first introduce behaviors to recover concurrency
of the form a.p. Since a is the ion’s communication out of the fixed syntax, then to define what it means
capability, we calI it its valence. Whenever two com- for processes to be equivalent, and finally to prove
plementary ions float in the solution, they can react equivalences such as p 1q - q 1p. SOS also involves
with each other and release their bodies in the solu- inference rules with non-trivial premisses, which are
tion. The valences simply vanish. Unlike the parallel certainly more complex than the naive cham rewrite
rule, the reaction rule is irreversible, rulea.
To execute an agent p, we start from the solution Furthermore, we treat structural simplifications in
So = {I p D. Heating the solution exhibits the poten- the same way as reactions: to suppress a 0, we simply
tial communications, which can then be performed evaporate it. In SOS semantics, one needs to prove
using the reaction rule. Notice that a hot solution that pi0 is equivalent to p, and one performs tran-
obtained by heating an agent as much as possible con- sitions and simpltications in separate steps and by
tains only ions. Conversely, any solution obtained by separate techniques.
transitions from So can be frozen by cooling rules into However, the notion of behavior that underlies the
a solution {IqD consisting of a single CCS- term, or SOS semantics has advantages. In particular, p 5 p’
into the empty solution, analogous to the term 0. also tells that p can perform an a when requested by
To see the chemical abstract machine at work, let some ezternal observer, thus defining at once how an
us consider an execution of the agent a.b.0 1~0 I b.0. agent communicates with its environment. We must
define the same notion in our setting.
(la.b.0 (2X.016.0 D A solution should be able to perform a visible a ac-
2 (I a.b.0, Z.0, b.0 D (parallel) tion whenever it contains an ion cr.p. This ion should
then export the a valence and become p. One could
-+ ub.0, 0, b.OD (reaction)
imagine to let it disintegrate into p and emit an cy-
+ ao, 0, OD (reaction) particle to the environment. However, such a tech-
nique would violate MiIner’s most useful principle,

83
which states that there should be no difference in na- the remaining solution; it is a single molecule. The
ture between internal and external communications. reversible (meta) rule is:
The right solution is to make the observer react with
airlock:
the valence of any molecule of the solution. This re-
quires a richer machinery developped in the next sec-
tion.
The solution Qml, ma,. . . m, I} contained in the new
molecule is allowed to freely continue internal reac-
2.3 More Advanced Chemistry: tions (see the formal definitions in the next section).
Membranes and Airlocks Second, we build an heavy ion from any ion in the
airlock, using the rule:
Consider a restriction agent p\a floating in a solution.
lf p is already of the form a.q, a +! (a,?i}, we can build heavy ion:
a new ion by the following simple rule:
bp) as + a.(paS)
restriction ion:
In this way, we guarantee reversibility by preserv-
(a.p)\a * a .(p\a) if a $ (a,+ ing the attachment between a! and p. A restriction
molecule can propose several valences in succession to
But this does not work if p is compound. In this its environment until a communication takes place.
case, p should be able to freely perform internal re- Let us give a simple example of communication in-
actions and to also propose communications to other volving an heavy ion:
ions floating in the main solution, using its own ions
of unrestricted valences. To let p evolve on its own, U a.0 I @P I 4 \b 0
we put it in a new local solution contained within a
_r, Qa.0, @.P, qD\bU (par., restr. membr.)
membrane (I, D:
- Ua.0,(I(~.d4lqDD\bD (airlock)
restriction membrane:
- Ua.0,WMIqD) D\bD (heavy ion)
P\” = {IP D\a - b-0, WwMHNI~ (restr. membrane)
The new subsolution obeys the same rules as the - ho, W4qD)\b)D (restriction ion)
global solution. To realize global communications, - (IO9 (P4m\o (reaction)
we need to make the membrane porous to valences. (restr. membrane)
U~lP4l~DD\4
A first simple idea would be to use an heavy ion for-
IHIPS qD\cD (airlock)
mation rule such as:

WP, Plr P2,**.Pnlb+4P, p1, pa ,... pnI)


Notice how we guarantee reversibility by putting or
removing membranes. Once the heavy ion ?i.(pa(l q D)
has been constructed, it is not possible to put back p
We reject such a rule for two reasons. First, it
into q’s solution, since the airlock molecule is not con-
does not involve only simple molecules as did pre-
vious rules; on the contrary, it involves finding an ion tained within a membrane. It is not possible to build
such a membrane, since the membrane rule cannot be
within a solution, which is neither simple nor gen-
eral. Second, it is irreversible, since the informa- applied inside an ion.
The airlock technique makes it now easy to define
tion of where Q comes from is lost. If a wrong va-
what it means for an external observer to observe a
lence is chosen, the heavy ion can stay forever in the
solution. If the solution is reduced to a single ion,
main solution, like a precipitate. Consider for exam-
ple (Ia.0, (IZi.0, b.OD\c D when choosing b: we are then the observer can pick up the ion’s valence and
release its body. More precisely, let S, S’ denote solu-
stuck with the inert solution (la.0, b.t(lZ.0, 0 D\c) b
tions. We set S % S’ if there exist a molecule m such
The technique we propose is in two steps. First,
that S $ 4 a.m D and {I m 0 A S’. For example, one
we introduce a new mechanism at the general chemi-
cal machine level: the airlock mechanism. It extracts has
(Ja.0, b.OD s flb.Of’j
any molecule from a solution (not necessarily an ion),
puts the rest of the solution within a membrane, and taking m = Oq(l b.0 b.
isolates the extracted molecule within an airlock at- The relation between this new kind of behavior and
tached to the membrane. The airlock construct is the standard TCCS one will be precisely stated in
written tnaS where m is the isolated molecule and S section 4.

84
3 Formal Definitions The chemical and membrane laws are the only ones to
involve premisses. They factor what is usually called
3.1 Chemical Abstract Machines “structural rules” in particular calculi. All other laws
and rules are purely local.
A chemical abstract machine or chum C is specified
Some chams, but not all of them, use the addi-
by defining moIecufea m, m’, etc., solutions S, S’,
tional airlock construct. An airlock is a molecule of
etc., and transformation rules. Molecules are terms
the form md S where m is a molecule and S is a
of algebras, with specific operations for each cham.
solution. Airlocks are built and suppressed by the
Solutions are finite multisets of molecules, written
following reversible law:
{I ml,m2,..., mk D. Furthermore, in each cham,
any solution S can itself be be considered as a single l The Airlock Law
molecule and can therefore appear as a aubaolution of
another molecule. The corresponding 4. D operator {ImDl?Js ++{b-w
is called the membrane operator. For instance, if 0 A cham is an intrinsically parallel machine: one can
and + are the molecule building operations, then 0, simultaneously apply several rules to a solution pro-
o+fJ, o+ufJI), and {IO, {IO + 0, OD D are molecules, vided that no molecuIe is involved in more than one
the latter also being a solution. rule; one can also transform subsolutions in parallel.
The transformation rules have the form In this paper, we only study the expressive power of
ml,m2 ,..., mb-rn\,& ,... ml chams; it does not depend on using parallel evalu-
ation, since a non-confticting parallel application of
where the mi and ml. are molecules. As usual, the rules is equivalent to any sequence of the individual
rules will be presented by means of rule schemata, rules. See [2] for a practical use of parallel reductions.
the actual rules being the instances of these schemata.
To avoid ‘multiset matching”, we require the eubsolu-
3.2 A Classification of Rules
tions appearing in rule schemata to be either a single
solution variable S that generates all solutions, or of We usually distinguish between three kinds of rules:
the form {]mD where m is a single molecule. heating rules -, cooling rules y, and reaction rules
To state how reaction rules apply to solutions, we -+. The distinction is merely a matter of taste. As a
need some notation. The multiset union of S and S’ rule of thumb, we present all structural rules as heat-
is written S &J5”. As in the &calculus [4], we use the ing rules, possibly paired with inverse cooling rules.
context notation C[ ] to denote a molecule with a hole Heating rules decompose a single molecule into sin+
[] in which to place other molecule. pler ones, and cooling rules recompose a compound
The transformation rules determine a transforma- molecule from its components. We generally write the
tion relation S + S’ between solutions, according to heating and cooling rules together, using the symbol
the following three laws: *. We say that a solution is hot (resp. frozen) if
no heating (resp. cooling) rule applies to it. In the
l The Reaction Law. An instance of the right-
sequel, we shall always consider that the transitions
hand-side of a rule can replace the corresponding
given by the airlock law are heating and cooling ones.
instance of its left-hand-side. if
The reflexive, symmetric, and transitive closure of
ml,m2 ,..., rnk +m:,rn$ ,... ml
( - U -) is written ;. According to our conventions,
is a rule and MI, Ms, . . ., Mk, M;, M;, . . ., MI, it usually represents structural equivalence.
are instances of the T’S and the mj’s, then The reaction rules usually involve several mole-
cules. These molecules are often in a particular form
OW&f2,.-, Mkb 4 W:,M:,-%‘D in which they cannot be heated further; we call them
iona. A solution is inert if no reaction rule applies to
l The Chemical Law. Reactions can be per-
it, nor to any sobrtion obtained by heating it.
formed freely within any solution:
s ---) S’
s t.3s” -+ S’ L-YS”
4 Process Calculi Chams
l The Membrane Law. A subsolution can In this section, we finish the treatment of the TCCS
evolve freely in any context: process calculus, we establish the semantical equiv-
alence between the cham semantics and the original
s -4 s’ structural semantics, and we briefly indicate how to
u WI D 3 (I VI D handle other process calculi.

85
4.1 The Full TCCS Calculus 4.2 Handling the New Operators
We finish the description of the TCCS calculus [13] We first explain how to handle the new operators.
and of its SOS semantics. We have already seen the Then we give the exact syntax of molecules and the
inaction ‘O’, parallel ‘ ] ‘, prefixing ‘.‘, and restriction complete set of rules of the TCCS cham.
‘\’ operators, We now add the remaining operators: The relabelling operator can be handled just as the
the relabelling operator ‘[.I’, the two sum operators restriction operator, by building a membrane and ex-
‘a’ (internal sum) and ‘0’ (external sum), and the porting relabelled names as heavy ion valences. In-
fixpoint definition f iq(j2 = g), which is a shorthand ternal sum is handled by the same rules as in the SOS
for: semantics; since the rules are not structural, we call
them reaction rules and not heating rules. The fix-
letrec ZI = p1 and . . . and x,, = p,, in 2; point expansion rule is also as in the SOS semantics,
and it is clearly a heating rule. See the exact rules in
The final syntax is as follows:
the rule summary below.
External sum needs more care. Since the sum-
P ::= 0 I a-P I (PI q) I P\” I PI4
mands p and q should each be able to freely perform
I p@q I Pllq I fixi(P= 9) internal transitions, we open one membrane for each
of them. We therefore introduce a new molecule pair-
We give the semantics of the new operators. A rela
ing operator < ., . > and the expansion rule:
belling is a mapping # : N H L, extended to labels
by setting 4(Z) = m. The relabelling operator
takes an agent p and a relabelling 4 and produces a
new agent p[4) that b eh aves like p except that all its
visible actions are relabelled by 4:
Assume that the left subsolution S produces an ion
a.m and that we want to export CL Then we can
give S the form Q a.n D, either by taking n = m
if S only contains the given ion, or by building an
airlock (a.m)dSl and then an heavy ion cu.(maSl).
To export the valence, we can use the rule:

Sums represent non-deterministic choices. There are <(la.nD,S’>- a. <n,S’>


several possible sums, see (131 for an extensive discus-
However, as discussed in section 2, we must be care-
sion. The simplest sum is the internal sum @, which
ful to avoid precipitates and to make the above rule
non-deterministically chooses a component:
reversible. The reverse cooling rule must recognize
that the valence belongs to n and not to S’ when
it is given a pair < n, S’ >. Furthermore, once the
a valence is consumed by some reaction, we are left
with a pair < n, S’ > that we must transform into n
to realize the summand selection; we need a cooling
In an external sum plq, the agents p and g can freely
rule of the form:
perform internal actions and can also propose com-
munications to the environment. The choice is made Cn,S’>- n
only when such a communication is performed:
I Here again, we must recognize which is n and which
P+P is S’.
dlq + p’llq and qb + dip’
We can use several techniques to solve this prob-
p4p I
lem. The one we choose is to tag the internal pair
Ah 5 P’ and qOp 4 P’ when the heavy ion is built to directly remember the
valence attachment, The rules for the left-hand-side
Finally, the fixpoint operation is a simple unfolding. choice are:
Let p[if/~?] denote the result of the simultaneous sub-
<{]a.mD,S>* a.(Z :cm,S>)
stitution of the q; to the zi in p:
I:< m,m’>--. m
fixi(z’= 3) * Pi[fxX(z'= 3)/S?]

86
The rules for the right-hand-side choice are symmet- Rules
ric with a label r.
parallel:
An alternative technique would be to always force
n to be an airlock, noticing that a solution {I a.m b PIF=P, Q
containing a single ion can always be heated into {I
reaction:
a.(ma{lD), and to use the following rules:
a.m, Zn -3 m, n
< {I a.(maS) D, S’ >* 01. < maS, S’ >
restriction membrane:
emaS,S’,- maS
m\a + UmD\a
restriction ion:
This technique would decrease the number of
molecule constructors, but ia rather ad-hoc and we (a.m)\a * a. (m\a) if 0 $ (a, El
don’t uge it here. This discussion might look a bit relabel&q membrane:
tedious, but it shows two things: first, deeigning a
cham has much to do with standard programming; mldl= @4I~1
second, the external aum operator is not very natural rellabelling ion:
in concurrent abstract machines.
Let us give a simple external sum evaluation exam- (-4141* 9W4441)
ple: @-leftz

{I a.?;.0 1((X0 1b.O)[q) D P@(I--,P


2% (Icd.0, <{Ia, b.oD,{IqD>D e-tight:
2. ad.0, <{I’i.~Oa(lb-OD)D,{1qD>D P@8q--*(?
2 (ja.8.0, 7i.t :<Oa{lb.UD,{Igfi>D I-ezpawion:
--b 05.0, 1 :<Oa{(b.OD,(IqI}>/)
PuQ’=?4IPoAIQD>
u&O, Oa{l b.0 /) D
left O-ion:
(j&o, 0, b.cq)
<{Ia.ml),S>- a.1 :<m,S>
right 0-ion:
Notice the last step: when an airlock maS floats in a
solution, one can cool it down and release m and all cS,ua.m()>- a.r :<S,m>
the molecules of S in the containing solution. This
left projection:
requires to use both the airlock law and the chemical
law. 1 :<m,m’>- m
rig?bt projection:
4.3 The Complete TCCS Cham
r :<m,m’>- m’
We summarise the syntax and rules of the final TCCS
cham. &point:

Syntax fiG(z’= p’) "pi\fiX(Z= p')/z']

Agents: Additional Cleanup Rules


P ::= 0 I &*P I (P Id I P\a I PI41 inaction cleanup:
I P @ q I Pllq I fix42 = 3 O-rL
Molecules: rest& tion cleanup:

m::=p 1 a.m 1 m\a ( m[d] 1 S 1 maS m\a -


1 <m,m> Il:<m,m> 1 r:<m,m> relabelling cleanup:
Notice that parallel and sums are agent operators, ulH~l-
not molecules operators.

a7
4.4 Comparing the Cham and SOS which shows the required property of p.
Assume now p = q \ a 5 q’ \ a = p’, with
We define labeled transitions as explained in section a $ {a,Z}. By induction, there exists n’ such that
2.
{Iq D + (Icy.n’ D and {In’ k & {Iq’ D. Let m’ = nja.We
Detiition: Given a solution S, we write S -% S’ if build the execution sequence:
there exists a molecule m’ such that S A 0 o.m’ D
and (1m’ /) : S’.
{IPD
Remember that the structural equivalence 5 be- G?\aD
tween solutions is the reflexive, symmetric, and tran-
sitive closure of the heating and cooling relations. In
1 UG7D\4 (restriction membrane)

the sequel, we shall neglect the cleanup rules and con- 5 4 (1a.n’ D\a D (dam laws)
sider only the reversible heating/cooling rules. Then - Q (a.n’)\aD (restriction membrane)
S & S’ if and only if there exists a sequence of heat- - Ua.(n’\a) D (restriction ion)
ing or cooling steps from S to S’. Y.2 {Ia-m’D
The following result shows that the cham differs
from the original TCCS calculus only in the number
of internal steps involved in computations. As far as Furthermore, one has:
labelled transitions are concerned, the solution 4 p D
can do whatever the term p can do, and it cannot do {Im’II
more. = WbD
- 4 (In’ D\a D (restriction membrane)
Theorem: Let p be a TCCS agent.
1) If p -+ p’ in TCCS, then (1p I} A (I p’ D in the I {I (Iq’I)\a) I) (&am laws)
TCCS cham. If p 3 p’ in TCCS, then {Ip 0 4 up’ I}; - (I q’\a D (restriction membrane)
more precisely, there exists a molecule m’ such that = {IP’D
(IPD --) {I-Q and {Im’D s {IP’D.
W{/PD-+S’, then there exists a TCCS agent p’
such that S’ s (Ip’ I}. lf {jp D 4 S’, then there exists which shows the required property of p.
Proving 2) is harder and we just sketch of the proof
a TCCS agent p’ such that p 2 p’ and S’ s (Ip’ I}.
architecture. The properties of --) and s are proved
Sketch of proof: To prove l), one shows how to together by induction on the number of irreversible
perform given TCCS derivations by chaining cham rules applied in the given derivations.
transitions. The proof is by induction on the size If this number is 0, then the property of --t is obvi-
of p and by cases on the form of the given TCCS ous with p’ = p. To prove the property of 4, we use
transition. We show two typical cases. a lemma about ion formation.
First if p = p1 I p2 -+ pi 1pk = p’ with p1 -5 pi The lemma shows how ions a.m can be formed in
and p2 3 pa for some a, by induction, there exist ml arbitrary subsolutions using only heating and cool-
ing rules. The valences of such ions always come
and ma such that {Ipl D -2 (la.m: D, {Irni 0 A {Ipi I},
from label positions in TCCS terms that yield ob-
(1~2 /) A (I a.4 D, and fl m!z 0 G {Ipi D. We build the servable transitions. Furthermore, the ion bodies are
following transformation sequence: kept untouched in the heating-cooling process. More
formally, assume {I pi} s C[a.m] where the ion cr.m
{IPD floats in some subsolution. Then one can cool down
= {IPl IP-20 C(a.m] into C’[a.q] by using only ion cooling rules, in
UP11 Pzo (patallel) such a way that a.q is exactly a subexpression of the
5 (la-m:, 5.m; D (cham laws) original agent p = C~[O.Q], with the additional prop

-+ u mi, rnh I) (reaction) erties p 4 C,[q] in TCCS and {IC,[q] D G {IC’(q] b.


* Now if {IpD s {I cr.m’D, one can use the lemma to
e {IPL PhD (&am laws)
show that p has the form C[a.q] with C[q] & m’. This
UPi IPkD (parallel)
show the required property of 5, taking p’ = C[q].
= {IP’ II Assume now that the number of irreversible tran-
sitions in a given derivation is strictly positive. The

88
derivation can be put in the form S s Sr + 5’2 5 S’ rule reversible, that is by allowing the machine to
with S s S, and where Si -+ Sa is irreversible. undo all its internal operations. The details are be-
The only difficult case is the one where the transi- yond the scope of this paper.
tion form Sr to Sa is a reaction. By a slight exten- Handling other process calculi raises no particular
sion of the lemma to two-hole contexts, one can show problem. For example, the reader can easily write a
that p = C(a.q][Zr], p - p’ = C[q][r] in TCCS, natural cham for MEIJE 161,which is universal among
the labelled process calculi. This tells that the cham
and (1 P’ I) f C’lq]Ir] with Sr A C[a.q][Z.r] and
formalism have basically the same power as the SOS
sz ** C[q][r]. The global induction hypothesis ap one w.r.t. process calculi.
plies to p’ and gives the final result.

4.5 Handling Other Process Calculi 5 A Concurrent &calculus


In Milner’s original calculus CCS, there is no notion 5.1 Generalizing the A-calculus
of an internal unlabelled transition. The special label
r is used to report transitions provoked by internal Algebraic process calculi model concurrency but
communications. The sum p + q is defined by the have a limited expressive power compared to the X-
following rule: i: calculus, where one is able to express all possible
combinators and to code many types of data. On
Pz P’
the other hand, the X-calculus is intrinsically sequen-
p+qzp’ and q+pJp’ tial [4,5] and cannot handle even the weakest form of
n which one can take QL= r. Therefore, a summa& concurrency. Building new calculi that combine both
can be chosen either by an external communication abilities is a goal of primary importance 17,211. In [7],
or by an internal one. we introduced such a tentative concurrent lambda-
To simulate CCS by a cham, we abandon the simple calculus called the 7-calculus. We could describe the
reaction rule of TCCS and replace it by the following (lazy) evaluation in this calculus by means of a cham.
rule: However, our formalism itself suggests a simpler, and
7 - teat tion: perhaps better calculus of the same kind. To intro-
duce this new calculus, let us first say a few words
am, 7i.n - r.(tn 1n)
about the A- and 7-calculi. Some familiarity with the
Since a r-ion can neither be heated nor interact X-calculus will be assumed. We just recall the syntax:
with another molecule, the only thing it can do is to
traverse all membranes up to the external observer. M ::= 2 1 (Az.M) 1 (MM)
An observation by this observer consumes the r va-
lence, and frees the ion body that can be heated to where z stands for any variable. We are interested
release the parallel components. With this new defi- here in the kazy evaluation of X-terms (following [l]),
nition of reaction, the rules of + are simply the above that is the reflexive and transitive closure of the re-
rules of 0. lation M D i&f’ inductively given by
Notice that performing an internal communication
is more than just building a r: the communication is (kz.M)N P M[N/Z]
really performed only when the final observer accepts
MPM’ =+ MNPM’N
it by consuming this r. Therefore, the machine’s be-
havior can no longer be defined independently of the Intuitively, a X-calculus redex (Xz.M)N is like a val-
observation process. Furthermore, the r-reaction rule ued CCS communication of the form Az.M 1X(N),
reduces the potential parallelism of the execution ma- since both yield M[N/z] as a result. Hence one could
chine to a bare minimum. The simulation of CCS is imagine treating the lambda-calculus as a CCS-like
rather unsatisfactory. We don’t believe that CCS can process calculus where agents are communicable val-
be “implemented” in a more natural way, which is an ues, A becoming a particular label. In such a calculus,
indication that r and + might not be good program- functional application should appear as a particular
ming primitives. This is quite well-known to CCS parallel combination of two agents, the function and
simulator implementors. its argument, and &reduction should be just a par-
Given a CCS agent p, we can show that the solu- ticular case of communication. However, the above
tion {I p D is in weak bisimulation with the agent p simple redex translation would not take care of the
w.r.t. our definition of observation. Strong bisimu- non-associative character of application and would
lation can also be obtained by making the r-reaction not treat double applications correctly. Consider, for

89
instance, the X-term ((Az.Ay.M)N)P. The trans- membrane: encapsulating a subsolution within
lation would be Xs.Ay.M /X(N) IX(P). The asso- a membrane forces reactions to occur locally.
ciative/commutative character of concurrency would Here we will introduce a corresponding locaha-
make the arguments N and P interchangeable, which tion construct (M).
is clearly wrong. Thomsen solved this problem in 1211
using the CCS operators of restriction and renam- reactions: basically, these occur when opposite
ing. However in his higher order calculus, p-reduction ions float inside the same solution. We shall dis-
is performed in two steps, involving an intermediary tinguish two kinds of reactive molecules, the neg-
state which does not, represent a X-term. Then the ative ones, or receptors, and the positive ones, or
X-calculus is not exactly a sub-calculus of Thomaen’s emitters.
CHOCS calculus.
Typically, a receptor in the X-calculus is an abstrac-
Another solution was presented in (71 using two
tion Xx.M. To emphasize the ion character, we shall
concurrency operators: an interleaving operator ‘I’
denote such an atomic receptor z-M, and an atomic
and a binary communication operator ‘0’. Commu-
emitter sending the value M will be denoted M+.
nications arise as follows: in a term (M 0 N), all ‘I’
Therefore the syntax of our calculus is:
concurrent components of M can communicate with
all concurrent components of N, up to termination of
M or N, termination being written as a special sym- M ::= XIX--MI(M)+ l(MIM))(M)
bol 1. Then the 0 operator disappears by application
of the simplification rule (M o 1) = (1 @ M) = M, where x stands for any variable. As usual we shall
and X-application can be represented by (M @X(N)). omit (or add) some parentheses in writing the terms,
For instance, the above double application works in which will be called processes or sometimes agents.
the following way (assuming z, y not free in N): In what follows we shall call this concurrent calculus
((Xz.Ay.M o I(N)) o x(P)) the r-calculus, superseding the one proposed in 171.
To formalise the execution mechanism, we need a
-) ((Ay.M[N/z] Q 1) 0 x(P)) (communication) syntactic notion of stable state. Basically, a stable
ZZ ((~YWV~) @UP’)) (simplification) term is made out of ions of the same valence (either
- wvv4l~IYl~ 1) (communication) positive or negative), and will therefore represent an
z inert solution. Formally, the syntax for pure emitters
wv4IPIYl (simplification)
or receptors and for stable terms is given by:
A cham describing this calculus would treat the terms
X2-M and X(N) as ions, but the interpretation of the E ::= M+ 1 (El E) 1(E)
concurrency operators of this calculus would be some-
what unnatural. In a cham, the paralhlism is always
R ::= s-M 1 (RI R) 1 (R)
commutative and associative and allows for commu- W ::= E 1R
nication, while (M 1N) disallows communication and
Now we give the 7-cham describing the (lazy) evalu-
@ is non-associative. As a matter of fact, the cham
ation of terms. The molecules are given by the fol-
framework indicates another possibility for represent-
lowing grammar:
ing properly the X-application, by means of an encap
sulated parallel combination of the function and its
U ::= MlSl(U)U)l(U)
argument.
where M stands for any term and 5’ for any solution
5.2 The ycalculus (i.e. finite multiset of molecules). The transformation
rules are:
The key idea of our new higher-order concurrent cal-
culus is to intern&e the concepts of the chemical solution:
abstract machine within the syntax. Let us review
these concepts:
WV = u, v
membrane:
l solutions: these are built by heating a parallel
combination of moIecules. Therefore the corre- WF’WD
sponding syntactic construct is parallel compo- hatching:
sition (M 1N). Since solutions are multisets of
(W)*W
possibly interacting processes, this operator al-
lows communication. /3-reaction:

90
X-calculus. The most important non X-definable ob-
ject that can now be constructed is the internal choice
z--M, N+ ---, M[N/x] (or more accurately join) operator. To see this, let
us denote by K and F the two cancellators, i.e., re-
where U, V stand for molecules, M, iV for terms and spectively AzJy.z and Ax.Xy.y (in our syntax x-y-x
W for any stable term. Note that the reaction rule, and z-y-y). Then the choice operator is defined by
which is the only irreversible rule, embodies commu-
nication. The power of the calculus is essentially due
@ =def (K 1 K+ 1 F+>
to the rules concerning the membrane construct. This
should not be confused with CCS restriction: if a This operator may be evaluated either into K, like
membrane encloses a stable state (i.e. emitter or re- (KK)F, or into F, like (KF)K, therefore one easily
ceptor), then it may vanish. The hatching rule con- sees that @MN : A4 and @MN -i* N. Clearly
veniently replaces the termination equations concern- such a combinator is not X-definable since it does not
ing the cooperation operator of [7) (in our calculus, a preserve the Church-Rosser property.
‘cooperation” operator would be (M ] N)). In what As in 171, we extend our syntax by defining con-
follows we shall use the notation M A N as an ab- current ubstractions, that is sets of negative va-
breviation for (1MD 2+ (1N I). lences. More precisely, we define receptors of the form
This ~-calculus contains the &calculus, since we [zr I . . I z,]-M where 21,. . . , x, are distinct vari-
may now define the application (MN) as the combi- ables. Such a term is able to receive n unordered val-
nation (A4 ] N+). Let us see this point in some detail; ues, to be substituted for these variables in M. Obvi-
we define a translation B from the set of X-terms to ously these terms can be incorporated in our calculus
the set of terms given by the grammar: with an additional rule:
choice:
M ::= x(x-MI(MIM+)
The translation is as follows:
Concurrent abstractions do not add power to the orig-
e(Z) = 2
inal calculus, since we can also define an atomic re-
B(X2.M) = iv(M) ceptor [zr ] . . . ] 2,1-M as a choice among all pos-
sible permutations zi, . . . z,LM. For instance, using
WW = (W) MN)‘) an infix notation for the choice:
Then we may show that there is a close correspon-
dence between lazy evaluation of J-terms and evalu- b)yl-M =def z-y-M @ y-z-M
ation in the r-cham of their translation. More pre-
The concurrent abstraction feature allows us to define
cisely, it is easy to prove that
combinators in a very compact way. For instance, the
choice operator can be redefined by $ = [z 1yl- 2,
that is a parallel variant of the usual cancellator K.
and, moreover, that each intermediate state in the We can also define a “parallel oP, which is a par-
evaluation of e(M) cools down to a X-term. For in- allel variant of the usual “left-sequential or” (cf. 171).
stance, the above double application works as follow: Let us see this point in some detail. It is known
(see 14)) that K = x-y-z and F = z-y-y can be
WY-M I N+) I P+> regarded as the truth values, respectively true and
2 (1{Iz-y-M, N’ D, P+ ]} (membrane, solution) false. Then one may define a combinator for disjunc-
tion, namely V = z-y-(zK)y. This combinator is
-+ Q {I y-M]N/z] D, P* /‘) (reaction)
such that VKX reduces to K and VFX reduces to
A {I Y- M[+], P+ D (hatching) X. However, VXK (that is uX or true”) cannot be
--b 4 MIv4l~/Yl II (reaction) in general reduced to K without evaluating X. For
instance if, as usual, !l denotes the non-terminating
Since the ~-calculus is embedded in our q-calculus, term AA (where A = Z-(~2) is the duplicator) then
one can define arbitrary combinators such as a “repli- the evaluation of VCK does not terminate. This is
cator”, D, that satisfies (DM) -% MI (DM) for all why V is ‘left-sequential”. Moreover from Berry’s se-
M, or a ‘killer”, U, that satisfies (UM) A U. This is quential&y theorem (see ]4]), one can show that there
easy using standard fixpoint combinators. Moreover, is no X-definable combinator representing parallel dia-
our concurrent 7-calculus is more powerful than the junction, that is a combinator 0 such that both OKX

91
and OXK reduce to K, without evaluating X (and S such that
obviously OFF reduces to F). This combinator exists
in the -y-calculus and is represented by:
Then the definition of the testing preorder (on closed
terms) is exactly the one of Morris’ preorder (cf. 141,
0= CzJyl-(sK)y
exercise 16.5.5, and [l]), that is:
that is a parallel variant of the left-sequential dis-
M C N a&f vc. C[M]l) =c- C[N]Jj
junction (or equivalently a choice between left-
sequential disjunction V and right-sequential disjunc- As usual the associated equivalence c~ is given by
tion y-z-(zK)y, see [lo]).

5.3 Semantics Let us see an example, showing that testing allows


It seems fair to say that we have not yet established to diztinguish divergent terms in the q-calculus (un-
that ‘parallel disjunction is r-definable”. This is a like the lazy X-calculus). We still use MN to ab-
semantic statement, so we would have first to define breviate application, that is (M 1N+). As we saw,
an equivalence relation II on r-terms such that (using the typically divergent X-term is fl = AA where A
an infix notation for the “parallel disjunction” com- is the duplicator z-(zz). It might be observed that
binator 0): P = (A ] A+) is also a divergent term, since it can
KOnlrK=nOK only be evaluated into 0. Similarly, we can define
a ‘triplicator” T = z-((zz)z), and it is easy to see
and that Q = (TIT+) is again a divergent term. Now
non4 there is a test separating P and Q, namely

In [7] it was proposed to adapt the notion of observa- c= Wb-PI+) In+>


tional bisimulation w of CCS [18] (see also (21]), to
serve as the semantic equivalence. We could define (recall that F = z-y-y, hence FM : I = y-y).
this notion here (with the idea that z- is an input It is not difficult to see that C[P] diverges, whereas
guard and M* an output action), but this does not C[Q] A I, therefore P qi Q.
seem to be a good choice. For instance we would have We shall not investigate here the properties of the
(K 0 0) + K since (K 0 n) may be reduced to RKK, testing preorder. A first step would be to prove a
a term without any communication capability, which generalization of the well-known %ontext lemma” (cf.
is certainly different from K. [lo]), showing that observers of the form
As a matter of fact, observational bisimulation has
often been criticized for being too discriminating, (. . . ( [-I I RI) * - - I Rk)
and weaker Uextensional” equivalences have been pro-
posed (for a survey, see (121 and [15]). For instance are enough to test the agents, that is
Darondeau in [ll] argued that Ua semantics which
stems from more sophisticated observers [than pro-
grams] is not really extensional”. In other words, the
semantics of processes should be derived from their
Such a result would allow us to give a simple proof of
observation by means of program contezts Cl]. These
the desired properties of the parallel-or combinator.
program contexts may be regarded as test3 over pro-
cesses, and there is a natural way to define an ass*
ciated testing equivalence (cf. 1141): two process are 6 Conclusion
equivalent if they pass the same tests. This is the kind
of semantical equality we propose for our 7-calculus. Unlike other models, the I’ [2] and cham models han-
However, we shall not follow [ll] and 1141 for what dle (true) concurrency as the primitive built-in no-
concerns the result of experiments. To report the tion. What the cham model adds to I’ is the structure
success of a test we shall use, as in [I], the simplest of molecules as terms and the notion of a subsolution.
operational information, namely convergence, that iz The CCS and TCCS implementations give a simple
existence of a normal form: the agent M pass the test operational vision of these calculi. Inference rules are
C[] if CIM] converges. replaced by standard rewrite rules. The difference
Formally, an agent M is said to converge, in nota- between internal and external transitions is made ob-
tion MU, if and only if there exists an inert solution vious and so are the well-known difficulties with sums

92
considered as programming primitives. More power- References
ful “universal” process calculi such as MEIJE [S] can
be handled as well. The concurrent X-calculus fully 111Samson Abramsky. The lazy X-calculus. In D.
exploits the ability of going back and forth between Turner, editor, Declarative Programming, Addi-
terms and solutions. It can be viewed as a direct son Wesley, 1988.
extension of the lasy &calculus of [l]. ’
Of course, this is still a preliminary work. Other I21Jean-Pierre Ban&e, Anne Coutant, and Daniel
Le Metayer. A parallel machine for multi-
concurrent computation paradigms should also be
set transformation and its programming style.
modelled; we think in particular of modelling pro-
In Future Generation Computer Systems 4,
cess handling in operating systems, and of providing
pages 133-144, North-Holland, 1988.
a cham for the new calculus of mobile processes pro-
posed by Milner E al. in [20]. The theory of machine
executions should also be fully developed.
PI Jean-Pierre Banbtre and Daniel Le Metayer. A
New Computational Model and Ita Discipline of
Programming. Technical Report INRIA Report
Acknowledgments 566, 1986.

We are indebted to Ilaria Castellani, Philippe Daron- [*I Henk Barendregt. The Type-Free Lambda-
deau, Matthew Hennessy, Robin Milner and Calculus. Studies in Logic Volume 103, North-
Serge Yoccos for helpful discussions about this work Holland, 198 1.
and previous versions of the paper.
151GBrard Berry. SbquentialitC de l’evaluation
formelle des &expressions. In B. Robinet,
editor, Program Transformations 3rd Znterna-
tional Colloquium on Programming, pages 67-80,
DUNOD, Paris, 1978.

PI GBrard Boudol. Notes on algebraic calculi of


processes. In K. Apt, editor, Logic and Models
of Concurrent Syatems, NATO ASI Series F13,
1985.

[‘I GCrard Boudol, Towards a lambda-calculus


for concurrent and communicating systems. In
TAPSOFT 1989, Lecture Ntites in Computer
Science 351, pages 149-161, Springer-Verlag,
1989.

PI Nicholas Carrier0 and David Gelerntner. Linda


in context. Communications of the ACM,
32(4):444-458, 1989.

PI Mani Chandy and Jayadev Misra. Parallel Pro-


gram Design, a Foundation. Addison-Wesley,
1988.

IlO1Pierre-Louis Curien. Categorical Combinators,


Sequential Algorithms, and Functional Program-
ming. Research Notes in Theoretical Computer
Science, Pitman, London, John Wiley & Sons,
New York, Toronto, 1986.

P11Philippe Darondeau. About fair asynchrony.


Theoretical Computer Science, 37:305-336, 1985.

I121Rocco De Nicola. Extensional equivalences for


transition systems. Acta Znformatica, 24:211-
237, 1987.

93

REFERENCES
1131 Rocco De Nicola and Matthew Hennessy. CCS
without 7’s. In TAPSOFT 87, Lecture Notes in
Computer Science 249, pages 138-152, Springer-
Verlag, 1987.

[ 141 Rocco De Nicola and Matthew Hennessy. Test-


ing equivalences for processes. Theoretical Com-
puter Science, 34~83-133, 1984.

[ 151 Matthew Hennessy. Observing processes. In


Linear Time, Branching Time and Partial Or-
ders in Logics and Models for Concurrency, Lec-
ture Notes in Computer Science $54, pages 173-
200, Springer-Verlag, 1989.

{16] C.A.R. Hoare. Communicating Sequential Pro-


cesses. Prentice Hall, 1985.

[ 171 Peter Landin. The mechanical evaluation of ex-


pressions. Computer Journal, 6:308-320, 1964.

[18] Robin Milner. Communication and Concur-


rent y. International Series in Computer Sci-
ence, Prentice Hall, 1989.

[ 191 Robin Milner. Program Semantics and Mecha-


nized Proofa, pages 3-44. Mathematical Center
Tracts 82, Amsterdam, 1976.

[ZO] Robin Milner, Joachim Parrow, and David


Walker. A Calculus of Mobile Processes. Techni-
cal Report ECS-LFCS-89-85, LFCS, Edinburgh
University, 1989.

[2l] Bengt Thomsen. A calculus of higher-order com-


municating systems. In Proc. 16th ACM Annual
Symposium on Principles of Programming Lan-
guages, pages 143-154, 1989.

94

REFERENCES

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy