ArticlePDF Available

Continuation Semantics for Asynchronous Concurrency

Authors:

Abstract

The paper presents a method of reasoning about the behaviour of asynchronous programs in denotational models designed with metric spaces and continuation semantics for concurrency.
Formal Methods Laboratory Romanian Academy
FML Technical Report
TR no. FML-10-02 Printed:
August 2013
Continuation Semantics for
Asynchronous Concurrency
G.Ciobanu and E.N.Todoran
Approved for public release; further dissemination unlimited.
Prepared by
Formal Methods Laboratory.
Series of
Technical Reports (Institute of Computer Science Ia¸si)
ISSN 1842 - 1490
FML is the Formal Methods Laboratory from the Institute of Computer Science of the
Romanian Academy and is located in Ia¸si. It is a research institution aimed at developing
new formalisms for challenging open problems in computer science, systems biology and
other emerging research fields. FML is headed by Dr. Gabriel Ciobanu.
IIT is the Institute of Computer Science of the Romanian Academy and is concerned with
basic research in computer science.
Romanian Academy of Science is the supreme forum of science from Romania.
Calea Victoriei 125, Sector 1, 010071, Bucharest, ROMANIA.
Telephone: +40 21 2128640
Telefax: +40 21 2116608
Web: http://www.academiaromana.ro/
Printed in Romania and reproduced directly from the authors original copy.
Copyright: c
2005 Formal Methods Laboratory Ia¸si (FML)
Blvd. Carol I, nr.8, 700505, Ia¸si, ROMANIA (RO)
Institute of Computer Science, Romanian Academy, branch Ia¸si.
Telephone/Telefax: +40 232 241708
Web: http://iit.iit.tuiasi.ro/fml
Contact: gabriel@iit.tuiasi.ro
Notice: Permission is hereby granted for the redistribution of this material so long as this
item is redistributed in full and with appropriate credit given to the author(s). All other
rights reserved.
Series of Technical Reports (Institute of Computer Science Ia¸si)
ISSN 1842 - 1490
Continuation Semantics for
Asynchronous Concurrency
by
Gabriel Ciobanu 1,2
Institute of Computer Science,
Romanian Academy, Ia¸si
gabriel@iit.tuiasi.ro
Eneia Nicolae Todoran
Technical University of Cluj-Napoca
Department of Computer Science
400027 Cluj-Napoca, Romania
Eneia.Todoran@cs.utcluj.ro
ABSTRACT
The paper presents a method of reasoning about the behavior of asynchronous programs in
denotational models designed with metric spaces and continuation semantics for concurrency.
1Head of Formal Methods Laboratory (FML)
2Contact person
Contents
1 Introduction 2
2 Preliminaries 4
2.0.1 Examples. ................................. 4
3 Syntax and continuation structure for L6
4 Continuation semantics for L8
5 Concurrency laws in continuation semantics 11
5.1 Continuations and configurations . . . . . . . . . . . . . . . . . . . . . . . . 13
5.2 Continuations and syntactic contexts . . . . . . . . . . . . . . . . . . . . . . 18
5.3 Concurrencylaws................................. 23
6 Concluding remarks and future work 35
Continuation Semantics for Asynchronous Concurrency 2
1 Introduction
Metric spaces provide a convenient framework for designing denotational models of con-
currency [4]. The main mathematical tool used in this approach to semantics is Banach’s
theorem, which states that a contracting function on a complete metric space has a unique
fixed point. Contractions play a central role in designing and relating concurrency semantics
[21] and there is a general method of solving reflexive domain equations in a category of
complete metric spaces [1]. By using the methodology of metric semantics in [31] we intro-
duced a ”continuation semantics for concurrency” (CSC). The CSC technique can be used
to model both sequential and parallel composition in interleaving semantics while providing
the general advantages of the classic technique of continuations [12].
In continuation semantics a program is conceptually divided into a current statement
and the rest of the program. A continuation is a representation of the behavior of the rest
of the program, an evaluation context for the denotation of the current statement [16].
The distinctive characteristic of the CSC technique is the modeling of continuations as
application-specific structures of computations (partially evaluated denotations) rather than
the functions to some answer type that are used in the classic technique of continuations
[30]. Intuitively it is a semantic formalization of a (process) scheduler, a denotational sched-
uler. Computations are grouped in a continuation. There is one active computation (the
denotation of the current statement). Each computation remains active only until it per-
forms and atomic action. Next, another computation taken from the continuation is planned
for execution. In this way it can be obtained the desired interleaving behavior for parallel
composition.
We do not know whether the domain of CSC is fully abstract.1However, as continuations
are semantic evaluation contexts [16], it is easy to prove that a denotational semantics
designed with CSC is correct with respect to a corresponding operational model (see section
5 of [31]). Also, the domain of CSC is very general. Only the structure of continuations needs
to be adapted to the (concurrent) language under study [34]. In this sense the CSC technique
provides flexibility in the denotational design of concurrent languages. For example, in the
case of a sequential language a continuation can be a stack of computations. It is also
natural to use the concept of a multiset to represent parallel computations. For a general
combination of sequential and parallel composition a continuation is a tree of computations.
In this paper we use CSC to investigate the semantics of a simple concurrent language L
embodying a mechanism of asynchronous communication. We work within the mathemat-
ical framework of 1-bounded complete metric spaces, by following the approach advocated
in [3]. In theory syncronization is used because it is simple to express. Based on the re-
sults expressed in process algebra, asynchronous interaction is primitive, and syncronous
interaction could be expressed in terms of asyncronous interaction; see, e.g. [19]. Moreover,
asynchronous interaction is easier to implement. The relation between synchronous and
1In fact, we are not aware of any full abstractness result for a concurrent language designed with continuations,
although various papers employ continuations in the denotational description of concurrent languages [3, 13,
2, 28].
Continuation Semantics for Asynchronous Concurrency 3
asynchronous communication is a topic of recent and current research [25, 35]. Although
synchronous interaction cannot always be expressed in terms of asynchronous primitives,
asynchronous interaction is a basic mechanism in many distributed computing systems, in-
cluding Internet and Web aplications.
The language Lthat we study in this paper embodies the paradigm of asynchronous
communication introduced in [10]. The paradigm consists of a language based on a set of
atomic actions and operators for sequential composition, nondeterministic choice and paral-
lel composition. The semantics of atomic actions is defined with respect to an abstract set
of states; the model includes special states indicating suspension and deadlock. The atomic
actions are interpreted as state transformations. As explained in [10], various asynchronous
computing models can be obtained as instances of this paradigm, including concurrent con-
straint programming [29], and also in other languages like dataflow and asynchronous CSP.
Lextends the paradigmatic language studied in [10] with recursion.
For the language under consideration, we show that the semantic operators designed with
CSC satisfy some concurrency laws, such as the associativity and commutativity of parallel
composition. Continuation-based models rely heavily on manipulations of higher-order func-
tions. It may be difficult to reason directly in terms of higher-order functions. Therefore we
introduce a left merge operator and we obtain a finite axiomatization of the parallel com-
position (or merge) operator. Any nonrecursive asynchronous concurrent program is thus
provably equivalent to a corresponding nondeterministic sequential program. Obviously, the
approach is inspired by classic process algebra theories [23, 8] this approach being adapted
by us to a continuation-based framework.
The main contribution is given by the proofs that continuation semantics satisfies some
basic laws such as the associativity of the parallel and sequential composition operators. Each
semantic property, also called a law here, can be proved by identifying a corresponding invari-
ant of the computation. Such an invariant is expressed as a relation between continuation
structures. The identification of semantic properties from the invariants of the computa-
tion is common in classic bisimulation semantics [22]. The idea is adapted to a denotational
framework based on continuations, by using arguments of the kind 1
2·εεε= 0’, which
are standard in metric semantics [3]. In our case εis the distance between two behavioraly
equivalent continuations, before and after a computation step, respectively. The effect of
each computation step is given by the 1
2contracting factor. Therefore ε= 0 and the desired
property follows.
The rest of the paper is organized as follows. Section 2 presents some theoretical pre-
liminaries. Section 3 defines formally the language Land presents a mathematical structure
that we use to define the domain of continuations. In section 4 we present a denotational
semantics for Ldesigned with CSC. In section 5 we prove the various laws that are satis-
fied by this semantics; we obtain a finite axiomatization of parallel composition. Section 6
provides some concluding remarks and objectives of future research.
Continuation Semantics for Asynchronous Concurrency 4
2 Preliminaries
The notation (x)Xintroduces the set Xwith typical element xranging over X. Let
fXYbe a function. The function [ f|x7→ y] : XY, is defined (for x, xX, yY)
by: [ f|x7→ y](x) = if x=xthen yelse f(x). We use the notation [ f|x17→y1|x27→ y2]
as an abbreviation for [ [ f|x17→ y1]|x27→ y2]. If f:XXand f(x) = xwe call xafixed
point of f. When this fixed point is unique (see Theorem 2.1) we write x=f ix(f).
The denotational semantics given in this paper is built within the mathematical frame-
work of 1-bounded complete metric spaces, following the approach advocated in [3]. We work
with the following notions which we assume known: metric and ultrametric space, isometry
(distance preserving bijection between metric spaces, denoted by ’
=’), complete metric space,
and compact set.
2.0.1 Examples.
1. Let Xbe an arbitrary set. The discrete metric on X(d:X×X[0,1]) is defined
(for x, y X) as follows:
d(x, y) = 0 if x=y
= 1 if x6=y
(X, d) is a complete ultrametric space.
2. Let (a)Abe a nonempty set, and let (x, y )A=AAω, where A(Aω) is the set
of all finite (infinite) sequences over A. One can define a metric over Aas follows:
d(x, y) = 2sup{n|x(n)=y(n)}
where x(n) denotes the prefix of xof length n, in case length(x)n, and xotherwise
(by convention, 2−∞ = 0). dis a Baire-like metric. (A, d) is a complete ultrametric
space.
We recall that if (X, dX), (Y, dY) are metric spaces, a function f:XYis a contraction
if cR, 0 c < 1, x1, x2X:dY(f(x1), f (x2))c·dX(x1, x2). In metric semantics it
is customary to attach a 1
2-contracting factor to each computation step. When c= 1 the
function fis called nonexpansive. In what follows we denote the set of all nonexpansive
functions from Xto Yby X1
Y. Banach’s fixed point theorem [7] is at the core of metric
semantics.
Theorem 2.1 (Banach) Let (X, dX)be a complete metric space. Each contraction f:
XXhas a unique fixed point.
Continuation Semantics for Asynchronous Concurrency 5
Definition 2.2 Let (X, dX),(Y, dY)be (ultra) metric spaces. On (x)X,(f)XY(the
function space), (x, y)X×Y(the Cartesian product), u, vX+Y(the disjoint union of X
and Y, which can be defined by: X+Y= ({1} × X)({2} × Y)), and U, V ∈P(X)(the
power set of X) one can define the following metrics:
(a) d1
2·X:X×X[0,1] d1
2·X(x1, x2) = 1
2·dX(x1, x2)
(b) dXY: (XY)×(XY)[0,1]
dXY(f1, f2) = supxXdY(f1(x), f2(x))
(c) dX×Y: (X×Y)×(X×Y)[0,1]
dX×Y((x1, y1),(x2, y2)) =
max{dX(x1, x2), dY(y1, y2)}
(d) dX+Y: (X+Y)×(X+Y)[0,1]
dX+Y(u, v) = if (u, v X)then dX(u, v)
else if (u, vY)then dY(u, v)else 1
(e) dH:P(X)× P(X)[0,1]:
dH(U, V ) = max{supuUd(u, V ),supvVd(v, U)}
where d(u,W )= infwWd(u, w)and by convention sup =0,inf =1 (dHis the Haus-
dorff metric).
We use the abbreviation Pnco(·) to denote the power set of non-empty and compact subsets
of ’·’. Also, we often suppress the metrics part in domain definitions, and write, e.g., 1
2·X
instead of (X, d 1
2·X).
Remark 2.3 Let (X, dX),(Y, dY), d 1
2·X,dXY, dX×Y,dX+Yand dHbe as in Definition
2.2. In case dX, dYare ultrametrics, so are d1
2·X, dXY, dX×Y, dX+Yand dH. Moreover,
if (X, dX),(Y, dY)are complete then 1
2·X,XY,X1
Y,X×Y,X+Y, and Pnco(X)
(with the metrics defined above) are also complete metric spaces [3].
We also use the abbreviation Pfinite (·) to denote the power sets of finite subsets of ’·’. In
general, the construct Pf inite(·) does not give rise to a complete space. In our study, we use
it to create a structure that we endow with the discrete metric. Any set endowed with the
discrete metric is a complete ultrametric space.
Continuation Semantics for Asynchronous Concurrency 6
3 Syntax and continuation structure for L
The syntax of Lis given in BNF in Definition 3.1. The basic components are a set (a)Act of
atomic actions and a set (x)RV ar of recursion variables. There is a special symbol δAct,
whose behavior is explained below. ;, + and kare operators for sequential, nondeterministic
and parallel composition, respectively. kis also called a merge operator, and is the left
merge operator.
Definition 3.1 (Syntax of L)
(a) (Statements) s(Stat) ::= a|x|s;s|s+s|ss|sks
(b) (Guarded statements) g(GStat) ::= a|g;s|g+g|gs|gkg
(d) (Declarations) (D)Decl =RV ar GStat
(e) (Programs) (ρ)L=Decl ×Stat
The meaning of atomic actions is defined by an interpretation function I:Act Σ
({↑} ∪ Σ), where (σ)Σ is a set of states. If I(a)(σ) =the action acannot proceed in state
σ; its execution is suspended. When all processes are suspended deadlock occurs. Notice that
I(δ)(σ) =,σΣ, i.e. the action δsuspends in all states. Lincorporates the mechanism of
asynchronous communication studied in [10]. As explained in [10], this form of asynchronous
communication can be encountered in concurrent constraint programming, and also in other
languages like dataflow or asynchronous CSP.
We employ an approach to recursion based on declarations and guarded statements [3]. In
a guarded statement each recursive call is preceded by at least one elementary action, which
guarantees the fact that the semantic operators are contracting functions in the present
metric setting. For the sake of brevity (and without loss of generality) in what follows we
assume a fixed declaration DDecl, and all considerations in any given argument refer to
this fixed D.
For inductive proofs we introduce a complexity measure ςthat decreases upon recursive
calls. ςis well-defined due to our restriction to guarded recursion.
Definition 3.2 (Complexity measure) The function ς:S tat Nis given by
ς(a) = 1
ς(x) = 1 + ς(D(x))
ς(s1op s2) = 1 + ς(s1)op ∈ {;,⌊ }
ς(s1op s2) = 1+max{ς(s1), ς(s2)}op ∈ {+,k}
In the CSC approach a continuation is a structured configuration of computations. For
example, in the case of a sequential language a continuation is a stack of computations. It is
also natural to use the concept of a multiset to represent parallel computations. For a general
Continuation Semantics for Asynchronous Concurrency 7
combination of parallel and sequential composition a continuation is a tree of computations
with active computations at the leaves. For example, when the denotation of a program
fragment (s1ks2); s3is computed, the denotations of s1and s2become leaves in such a tree
and the denotation of s3becomes an inner node. This behavior is inspired by the concept
of a cactus stack [9], a stack with multiple tops that can be active concurrently. In order to
define such domains of trees of computations we employ a (partially ordered) set of identifiers
Id. (α)Id is the set of all finite, possibly empty,sequences over {1,2}, and ααiff αis
a prefix of α.
In this paper we use the symbol ’·’ as a concatenation operator over sequences, hence we
can represent any nonempty identifier αId by a finite sequence α=i1·...·in, where
i1,...,in∈ {1,2}. We use the symbol λto represent the empty sequence over {1,2}(λId).
Definition 3.3
(a) Let (α)Id ={1,2}be a set of identifiers, equipped with the following partial ordering:
αα’ iff α=α·i1·...·infor i1,··· , in∈ {1,2}, n 0. We define α < αiff αα
and α6=α. If A∈ P(I d), we denote by Athe restriction of to A.
(b) We define a function max :P(Id)→P(Id)by:
max(A) = {α|αis a maximal element of (A, A)}
Remark 3.4 λα, for any αId, which means that λis the least element of Id. Also,
when A∈ P(Id),αis a maximal element of (A, A)if αAand αA:¬(α < α).
The concept of a tree that we use in this paper is taken from set theory, where a tree is a
partially ordered set in which the predecessors of each element are well-ordered. A set is
well-ordered if it is linearly ordered and every nonempty subset has a least element. A set is
linearly ordered if any two elements are comparable. There are several books on set theory
that provide formal definitions of these concepts; see, e.g., [20]. Here we only explain the
concept of a tree by means of an example.
(Id, )is a partially ordered set, i.e. is a binary relation over Id which is reflexive,
transitive and antisymmetric. In this paper we only work with finite trees. If AI d is a
finite subset of Id then (A, A)is a finite tree. For example, let A={α·1, α ·2, α·1·1, α ·1·2,
α·2·1, α ·2·2, α·1·1·1}, for some αId.(A, A)is a finite tree. The maximal elements of
(A, A)are exactly the leaves of the tree: max(A) = {α·1·1·1, α ·1·2,α·2·1, α ·2·2}.
The predecessors of each element in Aare well-ordered. For example, α·1·1·1> α ·1·1
and α·1·1> α ·1. The set of predecessors of α·1·1·1is {α·1·1, α ·1}, which is linearly
ordered, i.e. any two elements in {α·1·1, α ·1}are comparable. In general, α1and α2are
comparable iff α1α2or α2α1. Obviously, every nonempty subset of {α·1·1, α ·1}
has a least element. In fact, every finite linearly ordered set is well-ordered.
Let (x)Xbe a metric domain, i.e. a complete metric space. We use the following
notation:
Continuation Semantics for Asynchronous Concurrency 8
{|X|} not.
=Pfinite(Id)×(Id X)
Let αId, (π, θ)∈ {|X|} with π∈ Pf inite (Id), θId X. We define id :{|X|} → Pfinite(Id),
id(π, θ) = π. We also use the following abbreviations:
(π, θ)(α)not.
=θ(α) (X)
(π, θ)\αnot.
= (π\ {α}, θ) (∈ {|X|})
[ (π, θ)|α7→ x]not.
= (π∪ {α},[θ|α7→ x]) (∈ {|X|})
The basic idea is that we treat (π, θ) as a ’function’ with finite graph {(α, θ(α)) |απ},
thus ignoring the behaviour of θfor any α /π(πis the ’domain’ of (π, θ)). We use this
mathematical structure to represent finite partially ordered bags (or multisets)2of compu-
tations. The set Id is used to distinguish between multiple occurrences of a computation
in such a bag. We endow both sets Id and Pfinite (Id) with discrete metrics; every set with
a discrete metric is a complete ultrametric space. By using the composite metrics given in
Definition 2.2 {|X|} becomes also a metric domain. The operators behave as follows. id(π, θ)
returns the collection of identifiers for the valid computations contained in the bag (π, θ),
(π, θ)(α) returns the computation with identifier α, (π, θ)\αremoves the computation with
identifier α, and [ (π, θ)|α7→ x] replaces the computation with identifier α.
By a slight abuse, we use the same notations (including the operator id and the abbre-
viations (·)(α),(·)\α, [· | α7→ x]) when (x)Xis an ordinary set: {|X|} =Pf inite(Id)×
(Id X); in this case we do not endow {|X|} with a metric.
4 Continuation semantics for L
We design a continuation-based denotational semantics for L. As a semantic universe for
the final yield of our denotational model we employ a standard linear-time domain (p)P=
PncoΣ· {δ} ∪ Σω). Here Σω) denotes the collection of all finite (infinite) sequences
over Σ. An element of Σ· {δ}is a finite sequence terminated with the symbol δ, which
denotes deadlock. Also, we use the symbol λto represent the empty sequence. This is a slight
abuse of notation since we also use the symbol λto represent the empty sequence over {1,2};
however it is always clear from the context which is the type of λ(either λId (= {1,2}),
or λΣ). We view (qΣ· {δ} ∪ Σωas a complete ultrametric space by endowing
it with the Baire metric (see section 2). We use the notation σ·p={σ·q|qp}, for any
σΣ and pP. The type of the denotational semantics [[·]] for Lis Stat D, where:
D
=Cont 1
ΣP
(γ)Cont =Id ×Kont
(κ)Kont ={| 1
2·D|}
2We avoid using the notion of a partially ordered multiset which is a more refined structure – see [6], or chapter
16 of [3].
Continuation Semantics for Asynchronous Concurrency 9
In the equations given above the sets Σ, Id (and Pfinite (Id)) are endowed with the discrete
(ultra)metric. The composed metric spaces are built up using the metrics of Definition 2.2.
To conclude that such a system of equations has a solution, which is unique up to isometry,
we rely on the general method developed in [1]. The solution for Dis obtained as a complete
ultrametric space. In [1], the family of complete (ultra)metric spaces is made into a category
C. It is proved that a generalized form of Banach’s fixed point theorem holds, stating that a
functor F:C → C that is contracting (in a sense) has a unique fixed point (up to isometry).
Intuitively, in the equation above the relevant functor is contracting as a consequence of the
fact that the recursive occurence of Dis preceded by a 1
2factor.
The construction {| 1
2·D|} =Pfinite(Id)×(Id 1
2·D) was introduced in section 3. In the
sequel ϑranges over Id 1
2·D. We call an element of Kont aclosed continuation and an
element of Cont an open continuation. A (closed or open) continuation is a representation
of what remains to be computed from the program [30]. A closed continuation κKont
is a self-contained structure of computations. An open continuation (α, κ)Cont behaves
like an evaluation context [16] for the denotational mapping [[·]]. In an expression [[s]](α, κ),
[[s]] is the active computation which is evaluated with respect to (α, κ). Intuitively, an open
continuation (α, κ) is a structured configuration of computations which contains a hole,
indicating the conceptual position of the active computation. The position of the ’hole’
is given in this representation by the identifier α, which is not an element of id(κ) ([[·]] is
designed to preserve this invariant property: α /id(κ) and αmax({α} ∪ id(κ))).
The denotational function [[·]] is defined in 4.1 with the aid of a mapping kc, which
is called a scheduler. The denotational function maps an open continuation to a program
behavior. After producing an elementary step the denotational function transmits the control
to the scheduler. The scheduler receives as parameter a closed continuation κwhich it
maps to a corresponding program behavior. If the continuation κis empty (id(κ) = ) the
scheduler terminates the computation. Otherwise the scheduler activates a computatation
(denotation) selected in a nondeterministic manner from the continuation; it decomposes a
closed continuation into a computation and a corresponding open continuation and then it
executes the former with the latter as continuation.
The semantics of nondeterministic choice in Lis given by the operator + : (P×P)P.
This definition reflects that p1+p2blocks only if both p1and p2block. It is easy to check that
+ is well-defined, nonexpansive, associative, commutative and idempotent. Also, p+{δ}=p,
for any pP.
p1+p2={q|qp1p2, q 6=δ} ∪ {δ|δp1p2}
Definition 4.1 (Denotational semantics for L)
(a) Let kc :Kont ΣPbe given by:
kc(κ)(σ) = if (id(κ) = )then {λ}else +αmax(id(κ)) κ(α)(α, κ \α)(σ)
Continuation Semantics for Asynchronous Concurrency 10
(b) We define Φ : (Stat D)(Stat D)(for φ(Stat D)) by:
Φ(φ)(a)(α, κ)(σ) = if (I(a)(σ) =)then {δ}
else I(a)(σ)·kc(κ)(I(a)(σ))
Φ(φ)(x)(α, κ)(σ) = Φ(φ)(D(x))(α, κ)(σ)
Φ(φ)(s1;s2)(α, κ)(σ) = Φ(φ)(s1)(α·1,[κ|α7→ φ(s2) ])(σ)
Φ(φ)(s1+s2)(α, κ)(σ) = Φ(φ)(s1)(α, κ)(σ) + Φ(φ)(s2)(α, κ)(σ)
Φ(φ)(s1s2)(α, κ)(σ) = Φ(φ)(s1)(α·1,[κ|α·27→ φ(s2) ])(σ)
Φ(φ)(s1ks2)(α, κ)(σ) = Φ(φ)(s1)(α·1,[κ|α·27→ φ(s2) ])(σ) +
Φ(φ)(s2)(α·1,[κ|α·27→ φ(s1) ])(σ)
(c) We put [[·]] = fix(Φ). Let α0=λ, and κ0= (, ϑ0), where ϑ0(α) = [[δ]],αI d.
(α0, κ0)Cont is the empty continuation. Notice that kc(κ0)(σ) = {λ}, for any
σΣ. We also define D[[·]] : Stat ΣPby:
D[[s]] = [[s]](α0, κ0)
The semantics of atomic actions is defined with the aid of the interpretation function I
introduced in the paragraph that follows after Definition 3.1.
A continuation is a tree of computations with active elements at the leaves (the maximal
elements with respect to ’’). In the case of a sequential composition (s1;s2) the computa-
tions [[s1]] and [[s2]] are given the identifiers α·1 and α, respectively (α·1> α). The scheduler
function kc gives priority to the computations at the leaves of the tree that represents the
continuation. Therefore [[s2]] will only be evaluated after the completion of the evaluation
of [[s1]]. In the case of a parallel composition (s1ks2) the computations [[s1]] and [[s2]] are
given identifiers (α·1 and α·2) that are incomparable (with respect to ) therefore the
computations [[s1]] and [[s2]] are evaluated in an interleaved manner.
The denotational semantics [[·]] is defined as the (unique) fixed point of the higher-order
mapping Φ. It may not be obvious why on the right-hand sides of the equations given in
Definition 4.1(b), in some places we use Φ(φ) while in others we use φ. The definition of Φ(φ)
is organized by induction on ς(s) (see Definition 3.2). The computations φ(s) only occur in
the continuation and are always executed after an elementary step performed by the active
computation. This step ensures the contractiveness of Φ and is reflected by the 1
2·factor in
the definition of the domain of computations. Definition 4.1 is justified by Lemmas 4.2 and
4.3, whose proofs are omitted. Similar Lemmas are given in [31, 32]. See, e.g., the proofs of
Lemmas 3.13 and 3.14 in [31].3
3In Lemma 4.3(b), Φ(φ)(s) is (only) nonexpansive (rather than contractive) in the continuation. Still, this
implies that Φ is 1
2·-contractive in φ. Intuitively, the distance between denotations halves while they are
stored into a continuation. This is a consequence of the 1
2·-contracting factor in our domain equation. This
also explains the occurence of the multiplication factor ’ 2·’ (rather than 1
2·’) in Lemma 4.2(b).
Continuation Semantics for Asynchronous Concurrency 11
Lemma 4.2
(a) The mapping kc (see Definition 4.1) is well-defined.
(b) κ1, κ2Kont :d(kc(κ1), kc(κ2)) 2·d(κ1, κ2)
Lemma 4.3 For all φ(Stat D), s S tat, α I d, κ Kont, σ Σ:
(a) Φ(φ)(s)(α, κ)(σ)P(it is well defined),
(b) Φ(φ)(s)is nonexpansive (in (α, κ)), and
(c) Φis 1
2- contractive (in φ).
5 Concurrency laws in continuation semantics
We present a method of describing the behavior of concurrent systems in a denotational
model designed with CSC, using a representation of continuations as structured configura-
tions of computations. For the language Lwe show that the semantic operators satisfy laws
that are usually included in concurrency theories, such as the associativity and commuta-
tivity of parallel composition.
Various properties can be proved for all continuations by simple manipulations of the
equations that define the denotational mapping [[·]].
Lemma 5.1 For all s, s1, s2, s3Stat :
(a) [[s1+s2]] = [[s2+s1]] (commutativity of +)
(b) [[(s1+s2) + s3]] = [[s1+ (s2+s3)]] (associativity of +)
(c) [[s+s]] = [[s]] (idempotency of +)
(d) [[(s1+s2); s3]] = [[s1;s3+s2;s3]] (right distributivity of ; over +)
(e) [[s+δ]] = [[s]]
(f) [[δ;s]] = [[δ]]
(g) [[s1ks2]] = [[s1s2+s2s1]]
(h) [[(s1+s2)s3]] = [[s1s3+s2s3]] (right distributivity of over +)
(i) [[s1ks2]] = [[s2ks1]] (commutativity of k)
Proof: In order to prove that [[s]] = [[s]], for s, s Stat, it is enough to show that
[[s]](α, κ)(σ) = [[s]](α, κ)(σ), for arbitrary (α, κ)Cont,σΣ.
(a) [[s1+s2]](α, κ)(σ)
= [[s1]](α, κ)(σ) + [[s2]](α, κ)(σ) [+ is commutative]
= [[s2]](α, κ)(σ) + [[s1]](α, κ)(σ)
Continuation Semantics for Asynchronous Concurrency 12
= [[s2+s1]](α, κ)(σ)
(b) [[(s1+s2) + s3]](α, κ)(σ)
= [[s1+s2]](α, κ)(σ) + [[s3]](α, κ)(σ)
= ([[s1]](α, κ)(σ) + [[s2]](α, κ)(σ)) + [[s3]](α, κ)(σ) [+ is associative]
= [[s1]](α, κ)(σ) + ([[s2]](α, κ)(σ) + [[s3]](α, κ)(σ))
= [[s1]](α, κ)(σ) + [[s2+s3]](α, κ)(σ)
= [[s1+ (s2+s3)]](α, κ)(σ)
(a) [[s+s]](α, κ)(σ)
= [[s]](α, κ)(σ) + [[s]](α, κ)(σ) [+ is idempotent]
= [[s]](α, κ)(σ)
(d) [[(s1+s2); s3]](α, κ)(σ)
= [[s1+s2]](α·1,[κ|α7→ [[s3]] ])(σ)
= [[s1]](α·1,[κ|α7→ [[s3]] ])(σ) + [[s2]](α·1,[κ|α7→ [[s3]] ])(σ)
= [[s1;s3]](α, κ)(σ) + [[s2;s3]](α, κ)(σ)
= [[(s1;s3) + (s2;s3)]](α, κ)(σ)
(e) [[s+δ]](α, κ)(σ)
= [[s]](α, κ)(σ) + [[δ]](α, κ)(σ)
= [[s]](α, κ)(σ) + {δ}
= [[s]](α, κ)(σ)
(f) [[δ;s]](α, κ)(σ)
= [[δ]](α·1,[κ|α7→ [[s]] ])(σ)
={δ}
= [[δ]](α, κ)(σ)
(g) [[s1ks2]](α, κ)(σ)
= [[s1]](α·1,[κ|α·27→ [[s2]] ])(σ) + [[s2]](α·1,[κ|α·27→ [[s1]] ])(σ)
Continuation Semantics for Asynchronous Concurrency 13
= [[s1s2]](α, κ)(σ) + [[s2s1]](α, κ)(σ)
= [[s1s2+s2s1]](α, κ)(σ)
(h) [[(s1+s2)s3]](α, κ)(σ)
= [[s1+s2]](α·1,[κ|α·27→ [[s3]] ])(σ)
= [[s1]](α·1,[κ|α·27→ [[s3]] ])(σ) + [[s2]](α·1,[κ|α·27→ [[s3]] ])(σ)
= [[s1s3]](α, κ)(σ) + [[s2s3]](α, κ)(σ)
= [[(s1s3) + (s2s3)]](α, κ)(σ)
(i) [[s1ks2]](α, κ)(σ)
= [[s1]](α·1,[κ|α·27→ [[s2]] ])(σ) + [[s2]](α·1,[κ|α·27→ [[s1]] ])(σ)
[+ is commutative]
= [[s2]](α·1,[κ|α·27→ [[s1]] ])(σ) + [[s1]](α·1,[κ|α·27→ [[s2]] ])(σ)
= [[s2ks1]](α, κ)(σ)
5.1 Continuations and configurations
All the above proofs are straightforward. However, the flexibility provided by continuations
comes at a price. Some properties may require more complex arguments and can be obtained
for continuations that contain only denotations of program statements. We introduce the
auxiliary notion of a configuration and a notion of isomorphism over configurations. A
configuration is a structure of Lstatements. A continuation may contain arbitrary values
of the type D. We prove the desired properties for continuations that can be obtained as
semantified versions of configurations, i.e. for continuations that contain only denotations
of statements. This represents an invariant of the denotational semantics, and ensures its
consistency just because the initial continuation is empty and the denotational semantics
adds to the continuation only denotations of statements. The function Kdefined in 5.2(b)
maps a configuration to a corresponding continuation.
Definition 5.2
(a) We define the set of closed configurations (k)Konf ={|Stat|}.4A closed config-
uration is a finite (partially ordered) bag (multiset) of statements (Stat). Also, we
define the set Conf of open configurations by:
4In this case the construct {| · |} is used to define an ordinary set; see the explanation given in the final part
of section 3.
Continuation Semantics for Asynchronous Concurrency 14
Conf ={(α, k)|(α, k)(Id ×K onf ), α /id(k), α max({α} ∪ id(k))}
(b) We define K:Konf Kont as follows: K(k) = (id(k), ϑ), where ϑ(α) = [[k(α)]],α
Id.
Definition 5.3
(a) We say that two closed configurations k1, k2Konf are isomorphic, and we write
k1
=k2, iff there exists a bijection µ:id(k1)id(k2)such that:
(i) µ(α)µ(α′′)αα′′,α, α′′ id(k1)
(ii) k2(µ(α)) = k1(α),αid(k1)
(b) We say that two open configurations (α1,k1),(α2,k2)Conf are isomorphic, and write
(α1, k1)
=(α2, k2)iff there exists a bijection µ: ({α1} ∪ id(k1)) ({α2} ∪ id(k2)) such
that:
(i) µ(α1) = α2
(ii) µ(α)µ(α′′)αα′′ ,α
, α′′ ∈ {α1} ∪ id(k1)
(iii) k2(µ(α)) = k1(α),αid(k1)
Obviously, (α, k)Conf :(α, k)
=(α, k) and if (α1, k1),(α2, k2)C onf then (α1
, k1)
=(α2
, k2)
k1
=k2. Also, the following Lemma is given without proof (which is simple enough and
can be used by the reader as proof exercise).
Lemma 5.4 For all k, k1, k2Konf
(a) For any αI d, s Stat :K[k|α7→ s] = [ K(k)|α7→ [[s]] ]
(b) id(k) = id(K(k))
(c) If k1
=k2then id(k1) = ∅ ⇔ id(k2) =
(d) K(k)\α=K(k\α), for any αId.
(e) If α /id(k)then ([ k|α7→ s]\α)
=k.
(f) For any sStat and α, αI d, α6=α:[k|α7→ s]\α= [ k\α|α7→ s].
In Corollary 5.6 we show that any two continuations that correspond to isomorphic
configurations behave the same. This result is obtained by combining Lemma 5.5 with
an argument ’ε1
2·εε= 0’. Lemma 5.5 identifies the property - in this case the
isomorphism between configurations - that is preserved by each computation step. The
effect of each computation step is given in the present metric setting by the 1
2-contracting
factor.
Continuation Semantics for Asynchronous Concurrency 15
Lemma 5.5
(a) For all k1, k2Konf with k1
=k2and σΣ, there exists sStat,(α1, k1),(α2, k2)
Conf with (α1, k1)
=(α2, k2)such that:
d(kc(K(k1))(σ), kc(K(k2))(σ))
d([[s]](α1, K(k1))(σ),[[s]](α2, K (k2))(σ))
(b) For all sStat, (α1, k1),(α2, k2)Conf with (α1, k1)
=(α2, k2)and σΣ, there
exists sStat, (α1, k1),(α2, k2)Conf with (α1, k1)
=(α2, k2)and σΣsuch that:
d([[s]](α1, K(k1))(σ),[[s]](α2, K (k2))(σ))
1
2·d([[s]](α1, K(k1))(σ),[[s]](α2, K (k2))(σ))
Proof: For 5.5(a) we distinguish two subcases. If (by Lemma 5.4(b) and (c)) id(K(k1)) =
=id(K(k1)) then
d(kc(K(k1))(σ), kc(K(k2))(σ)) = d({λ},{λ}) = 0.
Otherwise,
d(kc(K(k1))(σ), kc(K(k2))(σ))
=d(+αmax(id(K(k1)))K(k1)(α)(α, K (k1)\α)(σ),
+αmax(id(K(k2)))K(k2)(α)(α, K (k2)\α)(σ)) [Lemma 5.4(b)]
=d(+αmax(id(k1))K(k1)(α)(α, K (k1)\α)(σ),
+αmax(id(k2))K(k2)(µ(α))(µ(α), K(k2)\µ(α))(σ))
[+ is nonexpansive]
=max{d(K(k1)(α)(α, K(k1)\α)(σ), K(k2)(µ(α))(µ(α), K(k2)\µ(α))(σ))
|αmax(id(k1))}[Lemma 5.4(d)]
=max{d([[s]](α, K(k1\α))(σ),[[s]](µ(α), K(k2\µ(α)))(σ))
|αmax(id(k1)), s =k1(α) = k2(µ(α))}
where µ:id(k1)id(k2) is a bijection that satisfies the properties given in Definition 5.3(a).
As k1
=k2, (α, k1\α)
=(µ(α), k2\µ(α)) Conf, for any αmax(id(k1)). Therefore
sStat, α Id,5such that s=k1(α) = k2(µ(α)), (α, k1\α)
=(µ(α), k2\µ(α)) and
d(kc(K(k1))(σ), kc(K(k2))(σ))
5αmax(id(k1)).
Continuation Semantics for Asynchronous Concurrency 16
d([[s]](α, K(k1\α))(σ),[[s]](µ(α), K(k2\µ(α)))(σ))
which concludes the proof of 5.5(a).
Next, we treat 5.5(b) by induction on ς(s). Four subcases.
Case [s=a] when I(a)(σ) =.
d([[a]](α1, K(k1))(σ),[[a]](α2, K (k2))(σ))
=d({δ},{δ}) = 0
Case [s=a] when I(a)(σ) = σΣ.
d([[a]](α1, K(k1))(σ),[[a]](α2, K (k2))(σ))
=d(σ·kc(K(k1))(σ), σ ·kc(K(k2))(σ))
=1
2·d(kc(K(k1))(σ), kc(K(k2))(σ)) (5.5.b.1)
By Lemma 5.5(a), sStat, (α1, k1)
=(α2, k2)Conf such that:
(5.5.b.1) 1
2·d([[s]](α1, K(k1))(σ),[[s]](α2, K (k2))(σ))
Case [s=x]
d([[x]](α1, K(k1))(σ),[[x]](α2, K (k2))(σ))
=d([[D(x)]](α1, K (k1))(σ),[[D(x)]](α2, K(k2))(σ)) (5.5.b.2)
One can use the induction hypothesis (ς(D(x)) < ς(x)) and infer that sStat,
(α1, k1)
=(α2, k2)Conf, such that:
(5.5.b.2) 1
2·d([[s]](α1, K(k1))(σ),[[s]](α2, K (k2))(σ))
Case [s=s1s2]
d([[s1s2]](α1, K(k1))(σ),[[s1s2]](α2, K(k2))(σ))
=d([[s1]](α1·1,[K(k1)|α1·27→ [[s2]] ])(σ),
[[s1]](α2·1,[K(k2)|α2·27→ [[s2]] ])(σ)) [Lemma 5.4(a)]
=d([[s1]](α1·1, K[k1|α1·27→ s2])(σ),
[[s1]](α2·1, K[k2|α2·27→ s2])(σ)) (5.5.b.3)
It is easy to check that (α1, k1)
=(α2, k2) implies
(α1·1,[k1|α1·27→ s2])
=(α2·1,[k2|α2·27→ s2])
For example, if µ: ({α1} id(k1)) ({α2} ∪ id(k2)) is a bijection that satisfies
the properties given in Definition 5.3(b), we can prove the above isomorhism by
defining a bijection µas follows:6
6Notice that:
id([ k1|α1·27→ s2]) = {α1·2} ∪ id(k1)
id([ k2|α2·27→ s2]) = {α2·2} ∪ id(k2)
Continuation Semantics for Asynchronous Concurrency 17
µ: ({α1·1, α1·2} ∪ id(k1)) ({α2·1, α2·2} ∪ id(k2))
µ(α1·1) = α2·1
µ(α1·2) = α2·2
µ(α) = µ(α), for any αid(k1)
Therefore, as ς(s1)< ς(s1s2), we can use the induction hypothesis and we infer
that sStat, σ Σ,(α1, k1)
=(α2, k2)Conf, such that
(5.5.b.3) 1
2·d([[s]](α1, K(k1))(σ),[[s]](α2, K (k2))(σ))
Case [s=s1ks2]
d([[s1ks2]](α1, K(k1))(σ),[[s1ks2]](α2, K (k2))(σ))
=d([[s1]](α1·1,[K(k1)|α1·27→ [[s2]] ])(σ) +
[[s2]](α1·1,[K(k1)|α1·27→ [[s1]] ])(σ),
[[s1]](α2·1,[K(k2)|α2·27→ [[s2]] ])(σ) +
[[s2]](α2·1,[K(k2)|α2·27→ [[s1]] ])(σ))
[Lemma 5.4(a), + is nonexpansive]
max{d([[s1]](α1·1, K[k1|α1·27→ s2])(σ),
[[s1]](α2·1, K[k2|α2·27→ s2])(σ)) (5.5.b.4) ,
d([[s2]](α1·1, K[k1|α1·27→ s1])(σ),
[[s2]](α2·1, K[k2|α2·27→ s1])(σ)) (5.5.b.5) }
It is easy to check that (α1, k1)
=(α2, k2) implies
(α1·1,[k1|α1·27→ s2])
=(α2·1,[k2|α2·27→ s2])
(α1·1,[k1|α1·27→ s1])
=(α2·1,[k2|α2·27→ s1])
For the first isomorphism we can define a bijection exactly in the same way as we
did for the subcase [s=s1s2]. As ς(s1)< ς(s1ks2), we can use the induction
hypothesis for (5.5.b.4) and we infer that sStat, (α1, k1)
=(α2, k2)Conf
and σΣ such that:
(5.5.b.4) 1
2·d([[s]](α1, K(k1))(σ),[[s]](α2, K (k2))(σ))
(5.5.b.5) can be handled in a similar manner and the desired result follows imme-
diately.
Corollary 5.6
(a) For all sStat, (α1, k1)
=(α2, k2) (Conf):[[s]](α1, K(k1))=[[s]](α2, K(k2)).
(b) For all k1
=k2(Konf):kc(K(k1)) = kc(K(k2)).
Continuation Semantics for Asynchronous Concurrency 18
Proof: Let
(w)W={(s, (α1, k1),(α2, k2), σ)
|sStat, (α1, k1),(α2, k2)Conf : (α1, k1)
=(α2, k2), σ Σ}
For (s, (α1, k1),(α2, k2), σ)Wwe use the notation:
εI(s, (α1, k1),(α2, k2), σ)not.
=d([[s]](α1, K(k1))(σ),[[s]](α2, K (k2))(σ))
Let (s, (α1, k1),(α2, k2), σ)W. By 5.5(b) there exists (s, (α1, k1),(α2, k2), σ)Wsuch
that:
εI(s, (α1, k1),(α2, k2), σ)1
2·εI(s, (α1, k1),(α2, k2), σ)
and thus supwWεI(w)1
2·supwWεI(w), where w= (s, (α1, k1),(α2, k2), σ) and w=
(s, (α1, k1),(α2, k2), σ). This means that we have supwWεI(w) = 0, i.e.
d([[s]](α1, K(k1))(σ),[[s]](α2, K(k2))(σ)) = 0 and thus [[s]](α1, K(k1))(σ) = [[s]](α2, K(k2))(σ)
for any σΣ, which implies Corollary 5.6(a). Corollary 5.6(b) follows immediately from
Lemma 5.5(a) and Corollary 5.6(a).
5.2 Continuations and syntactic contexts
We show that in the CSC approach continuations can be used to reason in a compositional
manner upon the behavior of concurrent programs. For this purpose we introduce a notion
of syntactic context for the class of Lstatements.
Definition 5.7 (Contexts for L)
C::= (·)|a|x|C;C|C+C|CC|CkC
We denote by C(s)the result of substituting sfor all occurences of (·)in C. Formally, this
substitution can be defined inductively: (·)(s) = s, a(s) = a, x(s) = xand (C1op C2)(s) =
C1(s)op C2(s), where op ∈ {;,+,,k}.
Lemma 5.8 shows that program properties are preserved in any syntactic context by
all CSC continuations containing only denotations of statements. The proof relies on an
auxiliarry Lemma 5.9 which involves again the identification of an appropriate computing
invariant and the use of contraction ε1
2·εε= 0.
Lemma 5.8 If s1, s2Stat are such that for all (α, k)C onf :
[[s1]](α, K(k)) = [[s2]](α, K(k))
then for all (α, k)Conf and for all contexts C:
[[C(s1)]](α, K (k)) = [[C(s2)]](α, K(k))
Continuation Semantics for Asynchronous Concurrency 19
Proof: By structural induction on C. Cases [C=a] and [C=x] are trivial. The
case [C= (·)] follows by the assumption. A non-trivial case is the context for parallel
composition [C=C1kC2]. Let (α, k)Conf and σΣ. We have to prove that
[[(C1kC2)(s1)]](α, K (k))(σ) = [[(C1kC2)(s2)]](α, K(k))(σ). We compute as follows:
[[(C1kC2)(s1)]](α, K (k))(σ) = [[C1(s1)kC2(s1)]](α, K(k))(σ)
= [[C1(s1)]](α·1,[K(k)|α·27→ [[C2(s1)]] ])(σ)(5.8.1) +
[[C2(s1)]](α·1,[K(k)|α·27→ [[C1(s1)]] ])(σ)(5.8.2)
We handle (5.8.1) first.
(5.8.1) = [[C1(s1)]](α·1,[K(k)|α·27→ [[C2(s1)]] ])(σ) [Lemma 5.4(a)]
= [[C1(s1)]](α·1, K [k|α·27→ (C2(s1)) ])(σ) [Ind. hyp.]
= [[C1(s2)]](α·1, K [k|α·27→ (C2(s1)) ])(σ) [Lemma 5.4(a)]
= [[C1(s2)]](α·1,[K(k)|α·27→ [[C2(s1)]] ])(σ)
(α, k)Conf implies (α·1, k)Conf . By the induction hypothesis:
[[C2(s1)]](α·1, K (k))(σ) = [[C2(s2)]](α·1, K(k))(σ)
Hence, by Lemma 5.9(b) we have:
[[C1(s2)]](α·1,[K(k)|α·27→ [[C2(s1)]] ])(σ)
= [[C1(s2)]](α·1,[K(k)|α·27→ [[C2(s2)]] ])(σ)
Similarly:
(5.8.2) = [[C2(s1)]](α·1,[K(k)|α·27→ [[C1(s1)]] ])(σ)
= [[C2(s2)]](α·1,[K(k)|α·27→ [[C1(s2)]] ])(σ)
Therefore:
[[(C1kC2)(s1)]](α, K (k))(σ) = (5.8.1) +(5.8.2)
= [[C1(s2)]](α·1,[K(k)|α·27→ [[C2(s2)]] ])(σ)+
[[C2(s2)]](α·1,[K(k)|α·27→ [[C1(s2)]] ])(σ)
= [[C1(s2)kC2(s2)]](α, K (k))(σ) = [[(C1kC2)(s2)]](α, K(k))(σ)
Lemma 5.9 If s1, s2Stat are such that [[s1]](α, K(k))(σ) = [[s2]](α, K(k))(σ)for all
(α, k)C onf, σ Σthen
Continuation Semantics for Asynchronous Concurrency 20
(a) for all kK onf, αId, σ Σ
kc[K(k)|α7→ [[s1]] ](σ) = kc[K(k)|α7→ [[s2]] ](σ)
(b) for all sS tat, (α, k)Conf , σ Σ,αI d, ¬(αα):
[[s]](α, [K(k)|α7→ [[s1]] ])(σ) = [[s]](α, [K(k)|α7→ [[s2]] ])(σ)
Proof: For (a) we show that kK onf, σ Σ,αId,sStat, (α, k)Conf such
that ¬(αα) and:
d(kc[K(k)|α7→ [[s1]] ](σ), kc[K(k)|α7→ [[s2]] ](σ))
d([[s]](α,[K(k)|α7→ [[s1]] ])(σ),[[s]](α,[K(k)|α7→ [[s2]] ])(σ))
not.
=εc(s,(α, k),α, s1, s2, σ)(5.9.1)
For (b) we show that sStat, (α, k)Conf , αId, σ Σ with ¬(αα),s
Stat, (α, k)Conf, σΣ such that ¬(αα) and:7
εc(s, (α, k),α, s1, s2, σ)
=d([[s]](α, [K(k)|α7→ [[s1]] ])(σ),[[s]](α, [K(k)|α7→ [[s2]] ])(σ))
1
2·d([[s]](α,[K(k)|α7→ [[s1]] ])(σ),[[s]](α,[K(k)|α7→ [[s2]] ])(σ))
=1
2·εc(s,(α, k),α, s1, s2, σ)(5.9.2)
The invariant property that is preserved by the computation steps is given here by the
condition that (α, k)C onf and ¬(αα).
Let
(w)W={(s, (α, k),α, s1, s2, σ)
|s, s1, s2Stat, (α, k)Conf, αId, ¬(αα), σ Σ}
We infer that
supwWεc(w)1
2·supwWεc(w)
where w= (s, (α, k),α, s1, s2, σ), w= (s,(α, k), α, s1, s2, σ). But
supwWεc(w) = supwWεc(w)
Therefore we infer supwWεc(w) = 0, which implies Lemma 5.9(b). Next, by using this
result and (5.9.1) we obtain immediately Lemma 5.9(a). In the sequel we prove (5.9.1) and
(5.9.2) .
First, we handle (5.9.1) . Let κ1, κ2Kont,k1, k2Kont
7¬(αα) is the invariant property that is preserved by the computation steps.
Continuation Semantics for Asynchronous Concurrency 21
κ1= [ K(k)|α7→ [[s1]] ]
κ2= [ K(k)|α7→ [[s2]] ]
k1= [ k|α7→ s1]
k2= [ k|α7→ s2]
By Lemma 5.4(a), κ1=K(k1), κ2=K(k2). Obviously, id(k1) = id(k2) = id(k)∪ {α}. Also,
by Lemma 5.4(b), id(κ1) = id(k1) = id(k2) = id(κ2) = id(k)∪ {α}. We distinguish two
subcases. If α /max(id(k)∪ {α}) we compute as follows:
d(kc(κ1)(σ), kc(κ2)(σ))
=d(+αmax(id(k))κ1(α)(α, κ1\α)(σ),+αmax(id(k)) κ2(α)(α, κ2\α)(σ))
[+ is nonexpansive]
=max{d(κ1(α)(α, κ1\α)(σ), κ2(α)(α, κ2\α)(σ))
|αmax(id(k))}(5.9.3)
By Lemma 5.4(a) and 5.4(d)
κ1\α=K(k1)\α=K(k1\α) = K[k\α|α7→ s1] = [ K(k\α)|α7→ [[s1]] ]
κ2\α=K(k2)\α=K(k2\α) = K[k\α|α7→ s2] = [ K(k\α)|α7→ [[s2]] ]
Also, notice that for any αmax(id(k)): κ1(α) = κ2(α) = [[k(α)]]. Therefore we have:
(5.9.3) =max{d([[k(α)]](α, [K(k\α)|α7→ [[s1]] ])(σ),
[[k(α)]](α, [K(k\α)|α7→ [[s2]] ])(σ))
|αmax(id(k))}
Clearly, this means that sStat, (α, k)Conf with ¬(αα) such that:8
d(kc(κ1)(σ), kc(κ2)(σ))
d([[s]](α,[K(k)|α7→ [[s1]] ])(σ),[[s]](α,[K(k)|α7→ [[s2]] ])(σ))
Next, we treat the subcase α(max(id(k)) ∪ {α}). In this subcase:
d(kc(κ1)(σ), kc(κ2)(σ))
=d((+αmax(id(k)),¬(αα)κ1(α)(α, κ1\α)(σ)) + [[s1]](α, κ1\α)(σ),
8More precisely, for some αmax(id(k)), s=k(α), α=α, k=k\α.
Continuation Semantics for Asynchronous Concurrency 22
(+αmax(id(k)),¬(αα)κ2(α)(α, κ2\α)(σ)) + [[s2]](α, κ2\α)(σ))
[+ is nonexpansive, κ1=K(k1), κ2=K(k2), k1\α
=k
=k2\α,
Corollary 5.6(a)]
max{d([[s1]](α, K(k))(σ),[[s2]](α, K(k))(σ)),
max{d(κ1(α)(α, κ1\α)(σ), κ2(α)(α, κ2\α)(σ))
|αmax(id(k)),¬(αα)}} (5.9.4)
By assumption [[s1]](α, K(k))(σ) = [[s2]](α, K(k))(σ). Also, for any αmax(id(k)), ¬(α
α) : κ1(α) = κ2(α) = k(α), and κ1\α= [ K(k\α)|α7→ [[s1]] ], κ2\α= [ K(k\α)|α7→ [[s2]] ].
Therefore:
(5.9.4) =max{d([[k(α)]](α, [K(k\α)|α7→ [[s1]] ])(σ),
[[k(α)]](α, [K(k\α)|α7→ [[s2]] ])(σ))
|αmax(id(k)),¬(αα)}
Clearly, this means that sStat, (α, k)Conf with ¬(αα) such that:
d(kc(κ1)(σ), kc(κ2)(σ))
d([[s]](α,[K(k)|α7→ [[s1]] ])(σ),[[s]](α,[K(k)|α7→ [[s2]] ])(σ))
This concludes the proof of 5.9(1).
In the sequel we prove (5.9.2) . More precisely, we show that sStat, (α, k)Conf, α
Id with ¬(αα) and σΣ, sStat, (α, k)Conf with ¬(αα) and σΣ such
that:
εc(s, (α, k),α, s1, s2, σ)1
2·εc(s,(α, k), α, s1, s2, σ)
We proceed by induction on ς(s). Two subcases.
Case [s=a] when I(a)(σ) = σΣ.
εc(a, (α, k),α, s1, s2, σ)
=d([[a]](α, [K(k)|α7→ [[s1]] ])(σ),[[a]](α, [K(k)|α7→ [[s2]] ])(σ))
=d(σ·kc([ K(k)|α7→ [[s1]] ])(σ), σ·kc([ K(k)|α7→ [[s2]] ])(σ)) (5.9.5)
By (5.9.1) sStat, (α, k)Conf with ¬(αα) such that:
(5.9.5) 1
2·d([[s]](α,[K(k)|α7→ [[s1]] ])(σ),
[[s]](α,[K(k)|α7→ [[s2]] ])(σ))
Continuation Semantics for Asynchronous Concurrency 23
=1
2·εc(s,(α, k),α, s1, s2, σ)
Case [s=s1ks2]
εc(s1ks2,(α, k),α, s1, s2, σ)
=d([[s1ks2]](α, [K(k)|α7→ [[s1]] ])(σ),
[[s1ks2]](α, [K(k)|α7→ [[s2]] ])(σ))
=d([[s1]](α·1,[K(k)|α7→ [[s1]] |α·27→ [[s2]] ])(σ) +
[[s2]](α·1,[K(k)|α7→ [[s1]] |α·27→ [[s1]] ])(σ),
[[s1]](α·1,[K(k)|α7→ [[s2]] |α·27→ [[s2]] ])(σ) +
[[s2]](α·1,[K(k)|α7→ [[s2]] |α·27→ [[s1]] ])(σ))
[’+’ is nonexpansive; ¬(αα)⇒ ¬(αα·1),¬(αα·2);
Lemma 5.4(a)]
max{d([[s1]](α·1,[K[k|α·27→ s2]|α7→ [[s1]] ])(σ),
[[s1]](α·1,[K[k|α·27→ s2]|α7→ [[s2]] ])(σ)) (5.9.6)
d([[s2]](α·1,[K[k|α·27→ s1]|α7→ [[s1]] ])(σ),
[[s2]](α·1,[K[k|α·27→ s1]|α7→ [[s2]] ])(σ)) (5.9.7) }
As ¬(αα·1) and ¬(αα·2), we can apply the induction hypothesis and
we infer that s
1Stat, (α
1, k
1)Conf with ¬(αα
1) and σ
1Σ, and
s
2Stat, (α
2, k
2)Conf with ¬(αα
2) and σ
2Σ , such that:
(5.9.6) 1
2·d([[s
1]](α
1,[K(k
1)|α7→ [[s1]] ])(σ
1),
[[s
1]](α
1,[K(k
1)|α7→ [[s2]] ])(σ
1)) (5.9.6)
(5.9.7) 1
2·d([[s
2]](α
2,[K(k
2)|α7→ [[s1]] ])(σ
2),
[[s
2]](α
2,[K(k
2)|α7→ [[s2]] ])(σ
2)) (5.9.7)
Finally, we obtain:
εc(s1ks2,(α, k),α, s1, s2, σ)
max{(5.9.6),(5.9.7)}
=max{1
2·εc(s
1,(α
1, k
1), α, s1, s2, σ
1),1
2·εc(s
2,(α
2, k
2), α, s1, s2, σ
2)}
This implies immediately the desired result.
5.3 Concurrency laws
This section concludes with Theorem 5.12, which presents the main results of the paper.
Theorem 5.12 allows us to reason in a compositional manner upon the behavior of Lasyn-
chronous programs. The denotational semantics [[·]] preserves the following invariant prop-
erty: continuations contain only computations denotable by program statements. The initial
Continuation Semantics for Asynchronous Concurrency 24
continuation (α0, κ0) (see Definition 4.1(c)) is empty (contains no computations) and each
equation in the definition of [[·]] adds only denotations of statements to the continuation.
The properties given in Theorem 5.12 hold for continuations containing only computations
denotable by program statements, which is sufficient in practice. The proof of Theorem 5.12
uses some auxiliary results given as Lemma 5.10 and Lemma 5.11. Essentially, Lemma 5.10
and Lemma 5.11 identify (non-isomorphic) continuation structures - specific of sequential
composition and parallel composition, respectively - that behave the same.
Lemma 5.10 For all ˜s, s1, s2Stat, σ Σ,˜α, α Id, k Konf such that ( ˜α, k)
Conf, (α, k)Conf,( ˜α6=α),¬(˜αα)and ¬(α˜α)we have:
(a) kc[K(k)|α7→ [[s1ks2]] ](σ) = kc[K(k)|α·17→ [[s1]] |α·27→ [[s2]] ](σ)
(b) [[˜s]]( ˜α, [K(k)|α7→ [[s1ks2]] ])(σ) =
[[˜s]]( ˜α, [K(k)|α·17→ [[s1]] |α·27→ [[s2]] ])(σ)
Proof: We use the notation Q(˜α, α), for ˜α, α I d, to express the fact that ˜αand αare
different9and incomparable with respect to ’’.
Q(˜α, α)not.
= (¬(˜αα)) (¬(α˜α))
Also, we use the notation
Pk(˜α, α, k)not.
=Q(˜α, α)((˜α, k)Conf)((α, k)Conf )
Pkis the invariant property which is preserved by the computation steps.
We proceed as follows. For 5.10(a) we show that s1, s2Stat, σ Σ, α I d, k Konf
with (α, k)Conf ,sStat, αId, kKonf with Pk(α, α, k) such that:
d(kc[K(k)|α7→ [[s1ks2]] ](σ), kc[K(k)|α·17→ [[s1]] |α·27→ [[s2]] ](σ))
d([[s]](α,[K(k)|α7→ [[s1ks2]] ])(σ),
[[s]](α,[K(k)|α·17→ [[s1]] |α·27→ [[s2]] ])(σ)) (5.10.1)
not.
=εk(s, α, k, α, s1, s2, σ)
Also, for 5.10(b) we show that ˜s, s1, s2Stat, σ Σ,˜α, α I d, k Konf such that Pk(˜α, α, k),
sStat, σΣ, αId, kKonf with Pk(α, α, k) such that:
εks, ˜α, k, α, s1, s2, σ)
=d([[˜s]]( ˜α, [K(k)|α7→ [[s1ks2]] ])(σ),
[[˜s]]( ˜α, [K(k)|α·17→ [[s1]] |α·27→ [[s2]] ])(σ))
9Notice that Q(˜α, α)˜α6=α.
Continuation Semantics for Asynchronous Concurrency 25
1
2·d([[s]](α,[K(k)|α7→ [[s1ks2]] ])(σ),
[[s]](α,[K(k)|α·17→ [[s1]] |α·27→ [[s2]] ])(σ)) (5.10.2)
not.
=εk(s, α, k, α, s1, s2, σ)
If we put (w)W=Stat ×Id ×Conf ×Id ×Stat ×Stat ×Σ we infer that:
sup wW:Pk( ˜α,α,k)εk(w)1
2·sup wW:Pk(α,α,k)εk(w)
where w= (˜s, ˜α, k, α, s1, s2, σ) and w= (s, α, k, α, s1, s2, σ).
But obviously, sup wW:Pk( ˜α,α,k)εk(w) = sup wW:Pk(α,α,k)εk(w), so
sup wW:Pk( ˜α,α,k)εk(w) = 0
which implies immediately 5.10(b). Next, by using this result and (5.10.1) we obtain imme-
diately 5.10(a). In the sequel we prove (5.10.1) and (5.10.2) .
First, we prove (5.10.1) . Let s1, s2Stat, σ Σ, α I d, k Konf with (α, k)Conf .
Let also κ1= [ K(k)|α7→ [[s1ks2]] ], κ2= [ K(k)|α·17→ [[s1]] |α·27→ [[s2]] ],
k1= [ k|α7→ (s1ks2) ] and k2= [ k|α·17→ s1|α·27→ s2]. By Lemma 5.4(a)
κ1=K(k1), κ2=K(k2). We compute as follows:
=d(kc(κ1)(σ), kc(κ2)(σ)) [Lemma 5.4(b)]
=d([[s1ks2]](α, [K(k)|α7→ [[s1ks2]] ] \α)(σ) +
(+αmax(id(k1))6=ακ1(α)(α, κ1\α)(σ)),
[[s1]](α·1,[K(k)|α·17→ [[s1]] |α·27→ [[s2]] ] \α·1)(σ) +
[[s2]](α·2,[K(k)|α·17→ [[s1]] |α·27→ [[s2]] ] \α·2)(σ) +
(+αmax(id(k1))6=α·16=α·2κ2(α)(α, κ2\α)(σ))) (5.10.3)
By Lemma 5.4(a) and 5.4(d)
[K(k)|α7→ [[s1ks2]] ] \α= (K[k|α7→ (s1ks2) ]) \α
=K([ k|α7→ (s1ks2) ] \α)
By Lemma 5.4(e), [ k|α7→ (s1ks2) ] \α
=k. Similarly,
[K(k)|α·17→ [[s1]] |α·27→ [[s2]] ] \α·1
=K([ k|α·17→ s1|α·27→ s2]\α·1)
and [ k|α·17→ s1|α·27→ s2]\α·1
=[k|α·27→ s2]. Also
[K(k)|α·17→ [[s1]] |α·27→ [[s2]] ] \α·2
Continuation Semantics for Asynchronous Concurrency 26
=K([ k|α·17→ s1|α·27→ s2]\α·2)
and [ k|α·17→ s1|α·27→ s2]\α·2
=[k|α·17→ s1]. In addition, it is easy to
check that (α·2,[k|α·17→ s1])
=(α·1,[k|α·27→ s1]). Therefore, by Corollary
5.6(a) and taking into account that the semantic operator + is nonexpansive we can
compute as follows:
(5.10.3) max{d([[s1ks2]](α, K(k))(σ),
[[s1]](α·1,[K(k)|α·27→ [[s2]] ])(σ) +
[[s2]](α·1,[K(k)|α·27→ [[s1]] ])(σ)) (5.10.4) ,
d(+αmax(id(k1))6=ακ1(α)(α, κ1\α)(σ),
+αmax(id(k1))6=α·16=α·2κ2(α)(α, κ2\α)(σ)) (5.10.5) }
Obviously, (5.10.4) = 0 from the definition of the denotational mapping [[·]]. Next, we
treat (5.10.5) . As (α, k)Conf and α·1α, α ·2α, it is easy to see that:
max(id(k1)) = {α} ∪ {α|αmax(id(k)), Q(α, α)}
max(id(k2)) = {α·1, α ·2} ∪ {α|αmax(id(k)), Q(α, α)}
Therefore
(5.10.5) =d(+αmax(id(k)),Q(α)κ1(α)(α, κ1\α)(σ)
+αmax(id(k)),Q(α)κ2(α)(α, κ2\α)(σ)
[+ is nonexpansive ]
max{d(κ1(α)(α, κ1\α)(σ), κ2(α)(α, κ2\α)(σ))
|αmax(id(k)), Q(α, α)}
This means that we have:
d(kc(κ1)(σ), kc(κ2)(σ))max{(5.10.4) ,(5.10.5) }=max{0,(5.10.5) }
max{d(κ1(α)(α, κ1\α)(σ), κ2(α)(α, κ2\α)(σ))
|αmax(id(k)), Q(α, α)}(5.10.6)
We only treat the case when the above set (the argument of max in (5.10.6) ) is
nonempty. Recall that κ1= [ K(k)|α7→ [[s1ks2]] ] and κ2= [ K(k)|α·17→
[[s1]] |α·27→ [[s2]] ], so
(5.10.6) =max{d(K(k)(α)(α,[K(k)|α7→ [[s1ks2]] ] \α)(σ)
Continuation Semantics for Asynchronous Concurrency 27
K(k)(α)(α,[K(k)|α·17→ [[s1]] |α·27→ [[s2]] ] \α)(σ))
|αmax(id(k)), Q(α, α)}
[αmax(id(k)),(α, k)C onf, Q(α, α)
α6=α, α6=α·1, α6=α·2, Lemma 5.4(a), 5.4(d) and 5.4(f)]
=max{d([[k(α)]](α,[K(k\α)|α7→ [[s1ks2]] ])(σ),
[[k(α)]](α,[K(k\α)|α·17→ [[s1]] |α·27→ [[s2]] ])(σ))
|αmax(id(k)), Q(α, α)}(5.10.7)
As (α, k)Conf , it is easy to check that αmax(id(k)) with Q(α, α) : Pk(α, α, k \
α). Therefore, by taking the maximal element of (5.10.7) we obtain immediately the
desired result (5.10.1) , i.e. we infer that sStat, σΣ, αId, kKonf(k=
k\α, s=k(α)) satisfying the invariant property Pk(α, α, k) and such that
d(kc[K(k)|α7→ [[s1ks2]] ](σ), kc[K(k)|α·17→ [[s1]] |α·27→ [[s2]] ](σ))
d([[s]](α,[K(k)|α7→ [[s1ks2]] ])(σ),
[[s]](α,[K(k)|α·17→ [[s1]] |α·27→ [[s2]] ])(σ))
which concludes the proof of (5.10.1) .
Next, we prove (5.10.2) . We proceed by induction on ςs) using (5.10.1) . In the compu-
tations given below, by assumption Pk(˜α, α, k). Three subcases.
Case [˜s=a] when I(a)(σ) = σΣ.
d([[a]](˜α, [K(k)|α7→ [[s1ks2]] ])(σ),
[[a]](˜α, [K(k)|α·17→ [[s1]] |α·27→ [[s2]] ])(σ))
=d(σ·kc[K(k)|α7→ [[s1ks2]] ](σ),
σ·kc[K(k)|α·17→ [[s1]] |α·27→ [[s2]] ](σ))
=1
2·d(kc[K(k)|α7→ [[s1ks2]] ](σ),
kc[K(k)|α·17→ [[s1]] |α·27→ [[s2]] ](σ)) (5.10.8)
As (α, k)Conf , by (5.10.1) ,sS tat, αId, kKonf such that Pk(α, α, k)
and:
(5.10.8) 1
2·d([[s]](α,[K(k)|α7→ [[s1ks2]] ])(σ),
[[s]](α,[K(k)|α·17→ [[s1]] |α·27→ [[s2]] ])(σ))
Case [˜s=x].
Continuation Semantics for Asynchronous Concurrency 28
d([[x]](˜α, [K(k)|α7→ [[s1ks2]] ])(σ),
[[x]](˜α, [K(k)|α·17→ [[s1]] |α·27→ [[s2]] ])(σ))
=d([[D(x)]]( ˜α, [K(k)|α7→ [[s1ks2]] ])(σ),
[[D(x)]]( ˜α, [K(k)|α·17→ [[s1]] |α·27→ [[s2]] ])(σ)) (5.10.9)
By the induction hypothesis (ς(D(x)) < ς(x)) sStat, σΣ, αId, k
Konf such that Pk(α, α, k) and:
(5.10.9) 1
2·d([[s]](α,[K(k)|α7→ [[s1ks2]] ])(σ),
[[s]](α,[K(k)|α·17→ [[s1]] |α·27→ [[s2]] ])(σ))
Case [˜s= ˜s1k˜s2].
d([[˜s1k˜s2]](˜α, [K(k)|α7→ [[s1ks2]] ])(σ),
[[˜s1k˜s2]](˜α, [K(k)|α·17→ [[s1]] |α·27→ [[s2]] ])(σ))
=d([[˜s1]]( ˜α·1,[K(k)|α7→ [[s1ks2]] |˜α·27→ [[˜s2]] ])(σ) +
[[˜s2]]( ˜α·1,[K(k)|α7→ [[s1ks2]] |˜α·27→ [[˜s1]] ])(σ),
[[˜s1]]( ˜α·1,
[K(k)|α·17→ [[s1]] |α·27→ [[s2]] |˜α·27→ [[˜s2]] ])(σ) +
[[˜s2]]( ˜α·1,
[K(k)|α·17→ [[s1]] |α·27→ [[s2]] |˜α·27→ [[˜s1]] ])(σ))
[ + is nonexpansive ]
max{d([[˜s1]]( ˜α·1,[K(k)|α7→ [[s1ks2]] |˜α·27→ [[˜s2]] ])(σ),
[[˜s1]]( ˜α·1,
[K(k)|α·17→ [[s1]] |α·27→ [[s2]] |˜α·27→ [[˜s2]] ])(σ)),
d([[˜s2]]( ˜α·1,[K(k)|α7→ [[s1ks2]] |˜α·27→ [[˜s1]] ])(σ),
[[˜s2]]( ˜α·1,
[K(k)|α·17→ [[s1]] |α·27→ [[s2]] |˜α·27→ [[˜s1]] ])(σ))}
[Pk(˜α, α, k)˜α·1,˜α·2/∈ {α, α ·1, α ·2}; Lemma 5.4(a)]
=max{d([[˜s1]]( ˜α·1,[K[k|˜α·27→ ˜s2]|α7→ [[s1ks2]] ])(σ),
[[˜s1]]( ˜α·1,
[K[k|˜α·27→ ˜s2]|α·17→ [[s1]] |α·27→ [[s2]] ])(σ)),(5.10.10)
d([[˜s2]]( ˜α·1,[K[k|˜α·27→ ˜s1]|α7→ [[s1ks2]] ])(σ),
[[˜s2]]( ˜α·1,
[K[k|˜α·27→ ˜s1]|α·17→ [[s1]] |α·27→ [[s2]] ])(σ)) (5.10.11) }
Continuation Semantics for Asynchronous Concurrency 29
Pk(˜α, α, k) implies Pk(˜α·1, α, [k|˜α·27→ ˜si]) for i= 1,2. Therefore, we can
use the induction hypothesis (because ςsi)< ςs1k˜s2) for i= 1,2) and we infer
that (1) s
1Stat, σ
1Σ, α
1Id, k
1Konf such that Pk(α
1, α, k
1) and (2)
s
2Stat, σ
2Σ, α
2Id, k
2Konf such that Pk(α
2, α, k
2) and:
(5.10.10) 1
2·d([[s
1]](α
1,[K(k
1)|α7→ [[s1ks2]] ])(σ
1),
[[s
1]](α
1,[K(k
1)|α·17→ [[s1]] |α·27→ [[s2]] ])(σ
1)) (5.10.10)
(5.10.11) 1
2·d([[s
2]](α
2,[K(k
2)|α7→ [[s1ks2]] ])(σ
2),
[[s
2]](α
2,[K(k
2)|α·17→ [[s1]] |α·27→ [[s2]] ])(σ
2)) (5.10.11)
Therefore, by taking max{(5.10.10),(5.10.11)}we obtain the desired result (5.10.2) .
Lemma 5.11 For all ˜s, s1, s2Stat, σ Σ,˜α, α Id, k Konf such that ( ˜α, k)
Conf, α /id(k), α ·1/id(k)and (¬( ˜αα·1)) we have:
(a) kc[K(k)|α7→ [[s1;s2]] ](σ) = kc[K(k)|α·17→ [[s1]] |α7→ [[s2]] ](σ)
(b) [[˜s]]( ˜α, [K(k)|α7→ [[s1;s2]] ])(σ) =
[[˜s]]( ˜α, [K(k)|α·17→ [[s1]] |α7→ [[s2]] ])(σ)
Proof: The proof of this Lemma is similar to the proof of Lemma 5.10. In this case the
invariant property which is preserved by the computation steps is P;:
P;(˜α, α, k)not.
= ((˜α, k)Conf)(α /id(k)) (α·1/id(k)) (¬(˜αα·1))
We proceed as follows. For 5.11(a) we show that s1, s2Stat, σ Σ, α I d, k Konf
such that α /id(k) and α·1/id(k), sStat, αI d, kKonf such that P;(α, α, k)
such that:
d(kc[K(k)|α7→ [[s1;s2]] ](σ), kc[K(k)|α·17→ [[s1]] |α7→ [[s2]] ](σ))
d([[s]](α,[K(k)|α7→ [[s1;s2]] ])(σ),
[[s]](α,[K(k)|α·17→ [[s1]] |α7→ [[s2]] ])(σ)) (5.11.1)
not.
=ε;(s, α, k, α, s1, s2, σ)
Also, for 5.11(b) we show that ˜s, s1, s2Stat, σ Σ,˜α, α I d, k Konf such that P;(˜α, α, k),
sStat, σΣ, αId, kKonf such that P;(α, α, k) and:
ε;s, ˜α, k, α, s1, s2, σ)
=d([[˜s]]( ˜α, [K(k)|α7→ [[s1;s2]] ])(σ),
[[˜s]]( ˜α, [K(k)|α·17→ [[s1]] |α7→ [[s2]] ])(σ))
Continuation Semantics for Asynchronous Concurrency 30
1
2·d([[s]](α,[K(k)|α7→ [[s1;s2]] ])(σ),
[[s]](α,[K(k)|α·17→ [[s1]] |α7→ [[s2]] ])(σ)) (5.11.2)
not.
=ε;(s, α, k, α, s1, s2, σ)
If we put (w)W=Stat ×Id ×Konf ×Id ×Stat ×Stat ×Σ we infer that:
sup wW:P;( ˜α,α,k)ε;(w)1
2·sup wW:P;(α,α,k)ε;(w)
where w= (˜s, ˜α, k, α, s1, s2, σ) and w= (s, α, k, α, s1, s2, σ).
But obviously, sup wW:P;( ˜α,α,k)ε;(w) = sup wW:P;(α,α,k)ε;(w). So we infer that:
sup wW:P;( ˜α,α,k)ε;(w) = 0
which implies immediately 5.11(b). Next, by using this result and (5.11.1) we obtain imme-
diately 5.11(a).
The proofs of Lemma 5.11 and Lemma 5.10 are very similar. The main difference is
given by the computing invariants P;and Pk, which are specific of sequential and parallel
composition, respectively. Here we skip the proof of (5.11.1) (which is similar to the proof of
(5.10.1) ). We only give the proof of (5.11.2) . We proceed by induction on ςs), using (5.11.1) .
In the computations given below it is assumed that P;( ˜α, α, k). We treat two subcases.
Case [˜s=a] when I(a)(σ) = σΣ.
d([[a]](˜α, [K(k)|α7→ [[s1;s2]] ])(σ),
[[a]](˜α, [K(k)|α·17→ [[s1]] |α7→ [[s2]] ])(σ))
=d(σ·kc[K(k)|α7→ [[s1;s2]] ](σ),
σ·kc[K(k)|α·17→ [[s1]] |α7→ [[s2]] ](σ))
=1
2·d(kc[K(k)|α7→ [[s1;s2]] ](σ),
kc[K(k)|α·17→ [[s1]] |α7→ [[s2]] ](σ)) (5.11.3)
By (5.11.1) sStat, αI d, kKonf such that P;(α, α, k) and:
(5.11.3) 1
2·d([[s]](α,[K(k)|α7→ [[s1;s2]] ])(σ),
[[s]](α,[K(k)|α·17→ [[s1]] |α7→ [[s2]] ])(σ))
Case [˜s= ˜s1; ˜s2].
d([[˜s1; ˜s2]](˜α, [K(k)|α7→ [[s1;s2]] ])(σ),
[[˜s1; ˜s2]](˜α, [K(k)|α·17→ [[s1]] |α7→ [[s2]] ])(σ))
=d([[˜s1]]( ˜α·1,[K(k)|α7→ [[s1;s2]] |˜α7→ [[˜s2]] ])(σ),
[[˜s1]]( ˜α·1,[K(k)|α·17→ [[s1]] |α7→ [[s2]] |˜α7→ [[˜s2]] ])(σ))
Continuation Semantics for Asynchronous Concurrency 31
[P;(˜α, α, k)˜α6=α, ˜α6=α·1; Lemma 5.4(a) ]
=d([[˜s1]]( ˜α·1,[K[k|˜α7→ ˜s2]|α7→ [[s1;s2]] ])(σ),
[[˜s1]]( ˜α·1,[K[k|˜α7→ ˜s2]|α·17→ [[s1]] |α7→ [[s2]] ])(σ)) (5.11.4)
P;(˜α, α, k) implies P;( ˜α·1, α, [k|˜α7→ ˜s2]). Therefore, we can use the induction
hypothesis (ςs1)< ς (˜s1; ˜s2)) and we infer that sStat, σΣ, αId, k
Konf such that P;(α, α, k) and
(5.11.4) 1
2·d([[s]](α,[K(k)|α7→ [[s1;s2]] ])(σ),
[[s]](α,[K(k)|α·17→ [[s1]] |α7→ [[s2]] ])(σ))
In the sequel we use the notation
ss(s, s Stat)
to express that [[C(s)]](α, K(k)) = [[C(s)]](α, K(k)) for all contexts Cand for all isomorphic
configurations (α, k)
=(α, k) (Conf ).
Theorem 5.12 For all s, s1, s2, s3Stat :
(a) s1+s2s2+s1(commutativity of +)
(b) (s1+s2) + s3s1+ (s2+s3) (associativity of +)
(c) s+ss(idempotency of +)
(d) (s1+s2); s3s1;s3+s2;s3(right distributivity of ; over +)
(e) s1; (s2;s3)(s1;s2); s3(associativity of ; )
(f) s+δs
(g) δ;sδ
(h) s1ks2s1s2+s2s1
(i) asa;s
(j) (a;s1)s2a; (s1ks2)
(k) (s1+s2)s3s1s3+s2s3(right distributivity of over +)
(l) s1ks2s2ks1(commutativity of k)
(m) s1k(s2ks3)(s1ks2)ks3(associativity of k)
;binds stronger than k,. Also, k,bind stronger than +.
Proof: First notice that [[s]] = [[s]] ss, for any s, s Stat. Indeed, [[s]] = [[s]]
[[C(s)]] = [[C(s)]] for any context C(by the compositionality of [[·]]) and [[C(s)]] = [[C(s)]] ss,
by Corolarry 5.6(a). Therefore, the properties stated by Theorem 5.12 (a)-(d), (f)-(h), (k)
and (l) follow immediately by Lemma 5.1.
On the other hand, the properties stated by Theorem 5.12(e), (i), (j) and (m) can be
proved for continuations containing only denotations of statements (not for arbitrary con-
tinuations) and require more involved arguments based on the identification of computing
invariants and the use of contraction. By Lemma 5.8 and Corolarry 5.6(a), in order to prove
Continuation Semantics for Asynchronous Concurrency 32
ssit is enough to show that [[s]](α, K(k)) = [[s]](α, K(k)) for any (α, k)Conf (or that
[[s]](α, K(k))(σ) = [[s]](α, K(k))(σ) for any (α, k)Conf and an arbitrary σΣ).
Property 5.12(e) follows by using Lemma 5.11.
[[s1; (s2;s3)]](α, K (k))(σ)=[[s1]](α·1,[K(k)|α7→ [[s2;s3]] ])(σ)
[Lemma 5.4(a)]
= [[s1]](α·1, K[k|α7→ (s2;s3) ])(σ)(5.12.1)
It is easy to check that (α·1,[k|α7→ (s2;s3) ])
=(α·1·1,[k|α7→ (s2;s3) ]). Thus (5.12.1) =
[[s1]](α·1·1, K[k|α7→ (s2;s3) ])(σ), by Corollary 5.6(a), and
[[s1]](α·1·1, K[k|α7→ (s2;s3) ])(σ) [Lemma 5.4(a)]
= [[s1]](α·1·1,[K(k)|α7→ [[s2;s3]] ])(σ) [Lemma 5.11(b)]
= [[s1]](α·1·1,[K(k)|α·17→ [[s2]] |α7→ [[s3]] ])(σ)
= [[s1;s2]](α·1,[K(k)|α7→ [[s3]] ])(σ)
= [[(s1;s2); s3]](α, K(k))(σ)
Property 5.12(i) is an easy consequence of Corollary 5.6. We only treat the subcase when
I(a)(σ) = σΣ.
[[as]](α, K(k))(σ)
= [[a]](α·1,[K(k)|α·27→ [[s]] ])(σ)
=σ·kc[K(k)|α·27→ [[s]] ](σ) [Lemma 5.4(a)]
=σ·kc(K[k|α·27→ s])(σ)
[ (α, k)Conf [k|α·27→ s]
=[k|α7→ s], Corollary 5.6(b)]
=σ·kc(K[k|α7→ s])(σ) [Lemma 5.4(a)]
=σ·kc[K(k)|α7→ [[s]] ](σ)
= [[a]](α·1,[K(k)|α7→ [[s]] ])(σ)
= [[a;s]](α, K(k))(σ)
In the proofs of 5.12(j) and (m) one can use Lemma 5.10. For 5.12(j) we only consider
the subcase when I(a)(σ) = σΣ.
[[(a;s1)s2]](α, K(k))(σ)
Continuation Semantics for Asynchronous Concurrency 33
= [[a;s1]](α·1,[K(k)|α·27→ [[s2]] ])(σ)
= [[a]](α·1·1,[K(k)|α·17→ [[s1]] |α·27→ [[s2]] ])(σ)
=σ·kc[K(k)|α·17→ [[s1]] |α·27→ [[s2]] ])(σ) [Lemma 5.10(a)]
=σ·kc[K(k)|α7→ [[s1ks2]] ](σ)
= [[a]](α·1,[K(k)|α7→ [[s1ks2]] ])(σ)
= [[a; (s1ks2)]](α, K (k))(σ)
Next we prove the property stated by Theorem 5.12(m). First, we expand the expressions
involved as follows:
[[s1k(s2ks3)]](α, K (k))(σ)
= [[s1]](α·1,[K(k)|α·27→ [[s2ks3]] ])(σ) +
[[s2ks3]](α·1,[K(k)|α·27→ [[s1]] ])(σ) [+ is associative]
= [[s1]](α·1,[K(k)|α·27→ [[s2ks3]] ])(σ)(5.12.2) +
[[s2]](α·1·1,[K(k)|α·27→ [[s1]] |α·1·27→ [[s3]] ])(σ)(5.12.3) +
[[s3]](α·1·1,[K(k)|α·27→ [[s1]] |α·1·27→ [[s2]] ])(σ)(5.12.4)
[[(s1ks2)ks3]](α, K(k))(σ)
= [[s1ks2]](α·1,[K(k)|α·27→ [[s3]] ])(σ) +
[[s3]](α·1,[K(k)|α·27→ [[s1ks2]] ])(σ)
= [[s1]](α·1·1,[K(k)|α·27→ [[s3]] |α·1·27→ [[s2]] ])(σ)(5.12.5) +
[[s2]](α·1·1,[K(k)|α·27→ [[s3]] |α·1·27→ [[s1]] ])(σ)(5.12.6) +
[[s3]](α·1,[K(k)|α·27→ [[s1ks2]] ])(σ)(5.12.7)
We show that (5.12.2) =(5.12.5) ,(5.12.3) =(5.12.6) and (5.12.4) =(5.12.7) . First we prove
that (5.12.3) =(5.12.6) . Indeed:
[[s2]](α·1·1,[K(k)|α·27→ [[s1]] |α·1·27→ [[s3]] ])(σ) [Lemma 5.4(a)]
= [[s2]](α·1·1, K[k|α·27→ s1|α·1·27→ s3])(σ)
[(α, k)Conf
(α·1·1,[k|α·27→ s1|α·1·27→ s3])
=
Continuation Semantics for Asynchronous Concurrency 34
(α·1·1,[k|α·27→ s3|α·1·27→ s1]), Corollary 5.6(a)]
= [[s2]](α·1·1, K[k|α·27→ s3|α·1·27→ s1])(σ)
= [[s2]](α·1·1,[K(k)|α·27→ [[s3]] |α·1·27→ [[s1]] ])(σ)
Both (5.12.2) =(5.12.5) and (5.12.4) =(5.12.7) can be handled by using Lemma 5.10(b).
As the proofs are similar, we only treat here (5.12.2) =(5.12.5) .
[[s1]](α·1,[K(k)|α·27→ [[s2ks3]] ])(σ) [Lemma 5.10(b)]
= [[s1]](α·1,[K(k)|α·2·17→ [[s2]] |α·2·27→ [[s3]] ])(σ) [Lemma 5.4(a)]
= [[s1]](α·1, K[k|α·2·17→ s2|α·2·27→ s3])(σ)
[(α, k)Conf
(α·1,[k|α·2·17→ s2|α·2·27→ s3])
=
(α·1·1,[k|α·27→ s3|α·1·27→ s2]), Corollary 5.6(a)]
= [[s1]](α·1·1, K[k|α·27→ s3|α·1·27→ s2])(σ) [Lemma 5.4(a)]
= [[s1]](α·1·1,[K(k)|α·27→ [[s3]] |α·1·27→ [[s2]] ])(σ)
Remark 5.13
(a) As it is well-known, the properties stated by Theorem 5.12 provide a finite axiomati-
zation for the parallel composition operator k; see, e.g., [5].10 For any non-recursive
Lprogram (closed term) sStat there is a non-recursive program sStat that
contains only the operators for sequential composition (;) and nondeterministic choice
(+) and such that the above set of laws imply ss. The operators kand can
be eliminated from any non-recursive asynchronous Lprogram. Such an elimination
can always be performed without manipulating continuations explicitly. For example
a1ka2a1a2+a2a1a1;a2+a2;a1.
(b) The semantics of sequential composition (;) is defined using continuations, but it ulti-
mately relies on the prefixing operation σ·p. Notice that if δ /pthen σ·(p+{δ}) =
σ·p6=σ·p+{σδ}=σ·p+σ· {δ}. Therefore we cannot expect to get a model which
also satisfies the law s1; (s2+s3)s1;s2+s1;s3, i.e. the left distributivity of ;over +.
Recall that D[[s]]σ= [[s]](α0, κ0)(σ) (see Definition 4.1(c)). For any aAct,s, sStat and
for any context Cone can easily check the following:
ssimplies D[[C(s)]] = D[[C(s)]],
10Strictly speaking, properties 5.12(l) and 5.12(m) are not needed for this purpose.
Continuation Semantics for Asynchronous Concurrency 35
• D[[a;s]]σ=if (I(a)(σ) =)then {δ}else I(a)(σ)· D[[s]](I(a)(σ))11 and
• D[[s+s]]σ=D[[s]]σ+D[[s]]σ.
For example, if I(a1)(σ) = σ1, I (a2)(σ1) = σ2and I(a2)(σ) =then
D[[a1ka2]]σ=D[[a1a2+a2a1]]σ=D[[a1;a2+a2;a1]]σ
=D[[a1;a2]]σ+D[[a2;a1]]σ={σ1σ2}+{δ}={σ1σ2}
6 Concluding remarks and future work
We presented a method of reasoning about the behavior of programs in denotational models
designed with metric spaces and continuation semantics for concurrency (CSC) [31]. The
method was illustrated on the particular case of a simple asynchronous language [10]. We
proved that the semantic operators designed with continuations obey concurrency laws such
as the associativity and commutativity of parallel composition. The method is general; we
think it could be applied to every language designed by using CSC. The method relies on
the identification of computing invariants as relations between continuation structures in
combination with arguments of the kind ’ε1
2·εε= 0’, which are standard in metric
semantics. The significance of the results is given mainly by the flexibility provided by the
continuations technique which can thus be used to describe concurrent behaviour.
In previous work, we developed CSC-based denotational models for a couple of advanced
concepts, including nondeterministic promotion in Andorra-like languages [33], and syn-
chronous communication on multiple channels [32] in the style of Join calculus [17]. In
ongoing work, we investigate the possibility to develop a denotational semantics designed
with CSC for membrane computing [26]. As far as we know such advanced control concepts
have not been modeled denotationally until now without CSC. It should be possible to use
the proof method presented in this paper to reason compositionally about the behavior of
such advanced concepts. Still, this has to be verified.
In this paper the domain of continuations (Kont ={| 1
2·D|}) was modelled with the aid
of a function space from a set of identifiers (endowed with a partial order) to the domain
of computations: Id 1
2·D(see Section 3 where the construction {| · |} was introduced).
According to Corollary 5.6, any two isomorphic continuations behave the same. Intuitively,
the domain of continuations could be defined in terms of isomorphism classes [I d 1
2·D]
of such structures. Since the existing models based on isomorphism classes of semantic
structures (in particular the metric pomset model [6]) do not involve domains defined by
reflexive equations (like D), such a construction also requires further work.
11Notice that κ0=K(k0), where k0= (, t0), with t0(I d Stat), t0(α) = δ,αId. The property follows
by using Corollary 5.6 and the fact that [ k0|α7→ s]\α
=k0,αId. In fact [ k|α7→ s]\α
=k,
kKonf if α/id(k).
Continuation Semantics for Asynchronous Concurrency 36
References
[1] P. America and J.J.M.M. Rutten, Solving reflexive domain equations in a category of
complete metric spaces, J. of Comp. Syst. Sci 39(3), 343–375, 1989.
[2] J.W. De Bakker and E.P. De Vink, Rendez-vous with metric semantics, New Generation
Computing 12, 53–90, 1993.
[3] J.W. De Bakker and E.P. De Vink, Control Flow Semantics, MIT Press, 1996.
[4] J.W. De Bakker and J.I. Zucker, Processes and the denotational semantics of concur-
rency, Inf. and Control 54, 70–120, 1982.
[5] J.C.M. Baeten and W.P. Weijland, Process algebra, Cambridge Univ. Press, 1990.
[6] J.W. De Bakker and J.H.A. Warmerdam, Metric pomset semantics for a concurrent
language with recursion, LNCS 469, 21–49, Springer, 1990.
[7] S. Banach, Sur les operations dans les ensembles abstrait et leur applications aux equa-
tions integrales, Fundamenta Matematicae 3, 133—181, 1922, .
[8] J.A. Bergstra and J.W. Klop, Algebra of communicating processes with abstraction,
Theoretical Computer Science 37(1), 77–121, 1985.
[9] D.G. Bobrow and B. Wegbreit, A Model and Stack Implementation of Multiple Envi-
ronments, Comm. ACM 16(10), 591–603, 1973.
[10] F.S. De Boer, J.N. Kok, C. Palamidessi and J.J.M.M. Rutten, A paradigm for asyn-
chronous communication and its application to concurrent constraint programming. In
Apt, K.R., De Bakker, J.W. and Rutten, J.J.M.M, eds., ”Logic Programming Languages:
Constraints, Functions and Objects”, MIT Press, 82-114 (1993)
[11] S. Brookes, Traces: a unifying semantic framework for parallel programming languages,
MFPS 18, New Orleans, 2002.
[12] A. de Bruin, Experiments with continuation semantics: jumps, backtracking, dynamic
networks, Ph.D. thesis, Vrije Universiteit, Amsterdam, 1986.
[13] A. De Bruin and W. Bohm, The denotational semantics of dynamic networks of pro-
cesses, ACM Transactions on Programming Languages and Systems 7(4), 656–679, 1985.
[14] G. Ciobanu and E.N. Todoran, Continuation semantics for concur-
rency, Technical Report FML-09-02, Romanian Academy, 2009. (Available at
http://iit.iit.tuiasi.ro/TR/reports/fml0902.pdf)
[15] G. Ciobanu and E.N. Todoran, A methodology for concurrent languages development
based on denotational semantics, Proc. IEEE SYNASC’09 , 290–298, 2009.
Continuation Semantics for Asynchronous Concurrency 37
[16] O. Danvy, On evaluation contexts, continuations and the rest of the computation, 4th
ACM SIGPLAN Continuations Workshop, 13–23 2004.
[17] C. Fournet and G. Gonthier, The Join calculus: a language for distributed mobile
programming, LNCS 2395, 268–332, 2002.
[18] R. van Glabbeek, U. Goltz and J.W. Schicke, On Synchronous and Asynchronous
Interaction in Distributed Systems. LNCS 5162, 16–35, 2008.
[19] K. Honda, M. Tokoro, An object calculus for asynchronous communication, LNCS
vol.512, 133–147, Springer (1991)
[20] T. Jech, Set theory, Springer, 2003.
[21] J.N. Kok and J.J.M.M. Rutten, Contractions in comparing concurrency semantics,
Theoretical Computer Science 76, 179–222, 1990.
[22] R. Milner, A calculus of communicating systems, LNCS 92, Springer, 1980.
[23] R. Milner, Communication and concurrency, Prentice Hall, 1989.
[24] R. Milner. Communicating and mobile systems: the πcalculus. Cambridge University
Press, 1999.
[25] C. Palamidessi, Comparing the expressive power of the synchronous and the asyn-
chronous πcalculus, Math. Structures in Computer Science, 13(5): 685–719, 2003.
[26] Gh. Paun, Membrane computing. An introduction. Springer, 2002.
[27] G. Plotkin, A powerdomain construction, SIAM Journal of Computing 5(3), 452–487,
1976.
[28] J.J.M.M. Rutten, Semantic correctness for a parallel object oriented language, SIAM
Journal of Computing 19(2), 341–383, 1990.
[29] V. Saraswat, Concurrent constraint programming, MIT Press, 1993.
[30] C. Stratchey and C. Wadsworth, Continuations: a mathematical semantics for handling
full jumps, Higher-Order and Symbolic Comput. 13, 135–152, 2000.
[31] E.N. Todoran, Metric semantics for synchronous and asynchronous communication: a
continuation-based approach, ENTCS 28, 119–146, 2000.
[32] E.N. Todoran, Comparative semantics for modern communication abstractions, Proc.
IEEE ICCP’08, 153–160, 2008.
[33] E.N. Todoran and N. Papaspyrou, Continuations for parallel logic programming, Proc.
ACM PPDP’00, 257–267, 2000.
Continuation Semantics for Asynchronous Concurrency 38
[34] E.N. Todoran and N. Papaspyrou, Continuations for prototyping concurrent languages,
Technical Report CSD-SW-TR-1-06, National Technical University of Athens, 2006.
Available at http://www.softlab.ntua.gr/research/techrep/CSD-SW-TR-1-06.pdf
[35] Synchronous and Asynchronous Interaction in Distributed Systems
(SAS), Project funded by DFG (German Research Foundation), 2010,
http://concurrency-theory.service.tu-berlin.de/joomla/projects/projects.
... However, it is usually considered that continuations do not perform well enough as a tool for describing concurrent behaviour [16]. In [21,6], we introduced a technique for denotational and operational semantic design named continuation semantics for concurrency (CSC) which can be used to handle advanced concurrent control mechanisms [9,10,22]. The distinctive characteristic of the CSC technique is the modelling of continuations as structured configurations of computations. ...
... We assume the reader is familiar with metric spaces, multisets, metric semantics [2], and the λ -calculus notation. For the used notions and notations, we refer the reader to [5,6,7,8]. ...
... Also, any operator type Ot ∈ Ot class is a metric domain [2]. 5 Note that the (restricted) function space A → At and the compact and non-empty and compact powerdomain constructions P co (At) and P nco (At)) 6 are not needed in the approach presented in this paper, and are rarely used in practice to specify argument types. The compact powerdomain constructions can be used to specify nondeterministic behaviour by using operators for nondeterministic scheduling 7 . ...
Preprint
Full-text available
We develop denotational and operational semantics designed with continuations for process calculi based on CCS extended with mechanisms offering support for multiparty interactions. We investigate the abstractness of this continuation semantics. We show that our continuation-based denotational models are weakly abstract with respect to the corresponding operational models.
... However, it is usually considered that continuations do not perform well enough as a tool for describing concurrent behaviour [16]. In [21,6], we introduced a technique for denotational and operational semantic design named continuation semantics for concurrency (CSC) which can be used to handle advanced concurrent control mechanisms [9,10,22]. The distinctive characteristic of the CSC technique is the modelling of continuations as structured configurations of computations. ...
... We assume the reader is familiar with metric spaces, multisets, metric semantics [2], and the λ -calculus notation. For the used notions and notations, we refer the reader to [5,6,7,8]. ...
... Also, any operator type Ot ∈ Ot class is a metric domain [2]. 5 Note that the (restricted) function space A → At and the compact and non-empty and compact powerdomain constructions P co (At) and P nco (At)) 6 are not needed in the approach presented in this paper, and are rarely used in practice to specify argument types. The compact powerdomain constructions can be used to specify nondeterministic behaviour by using operators for nondeterministic scheduling 7 . ...
... We offer a semantic description of SN P systems based on a domain of continuations We need a domain of continuations which can store computations (between firings and spikings) in CSC style [Todoran -2000, Ciobanu & Todoran -2014] ...
Article
Full-text available
We present a metric denotational semantics for an experimental concurrent language inspired by the spiking neural P systems. At syntactic level, the language provides constructions for specifying the neurons, synapses and rules with time delays defining a spiking neural P system. The denotational semantics presented in this paper is designed by using continuations. We employ metric spaces, including a metric powerdomain to describe the nondeterministic behaviour. Our denotational semantics describes accurately the time delays between firings and spikings, the nondeterministic behaviour and the synchronized functioning that are specific of a spiking neural P system. An implementation in the functional language Haskell is also provided; it can be tested and evaluated, being available for software experiments.
Article
Full-text available
This article presents the Haskell implementations of spiking neural P systems and of two variants subsequently introduced in the literature, namely the spiking neural P systems with inhibitory rules and spiking neural P systems with structural plasticity. These implementations are obtained using their operational semantics in which the involved configurations use continuations. For each variant, the formal syntax is presented, together with the semantics given accurately by the Haskell implementation.
Article
Full-text available
We use the functional programming language Haskell to design semantic interpreters for the spiking neural P systems. Haskell provides an appropriate support for implementing the denotational semantics of a concurrent language inspired by the spiking neural P systems. This language and its semantics describe properly the structure and behaviour of the spiking neural P systems. The semantic interpreters capture accurately the nondeterministic behaviour, the time delays between firings and spikings, and the synchronization specific to spiking neural P systems.
Article
This paper presents a calculus inspired by the spiking neural P systems. Its operational and denotational semantics are defined; they are related by using the metric semantics methodology, showing that the denotational semantics is correct with respect to the operational one. We use the continuations for concurrency to describe precisely the nondeterministic behaviour, the time delays between firings and spikings, as well as the synchronized functioning specific to spiking neural P systems.
Conference Paper
We present a denotational semantics for a simple concurrent language based on Milner's CCS extended with multiparty synchronous interactions. We show that our denotational model is weakly abstract with respect to a corresponding operational semantics. The denotational semantics is designed with metric spaces and continuation semantics for concurrency. The significance of the results presented in this paper is given also by the flexibility provided by the continuations technique.
Article
Full-text available
The Asynchronous pi-calculus, proposed by Honda and Tokoro (1991) and, independently, by Boudol (1992), is a subset of the pi-calculus (Milner, 1992) which contains no explicit operators for choice and output-prefixing. The communication mechanism of this calculus, however, is powerful enough to simulate output-prefixing, as shown by Honda and Tokoro (1991) and by Boudol (1992), and input-guarded choice, as shown by Nestmann and Pierce (2000). A natural question arises, then, whether or not it is as expressive as the full pi-calculus. We show that this is not the case. More precisely, we show that there does not exist any uniform, fully distributed translation from the pi-calculus into the asynchronous pi-calculus, up to any "reasonable" notion of equivalence. This result is based on the incapability of the asynchronous pi-calculus to break certain symmetries possibly present in the initial communication graph. By similar arguments, we prove a separation result between the pi-calculus and CCS, and between the pi-calculus and the pi-calculus with internal mobility, a subset of the pi-calculus proposed by Sangiorgi where the output actions can only transmit private names.
Conference Paper
Full-text available
By using the "continuation semantics for concurrency" (CSC) technique [6] denotational semantics can be used both as a method for formal specification and as a general method for designing tractable compositional prototypes for concurrent languages [8]. A denotational specification produces as final yield an element of a classic power domain structure. A denotational prototype designed with CSC produces incrementally a single execution trace and uses a random number generator to model the nondeterminism of a "real" concurrent system. In this paper we present a methodology for concurrent languages development based on denotational semantics. The main step of this methodology is the establishment of the formal relationship between a denotational prototype and a corresponding denotational specification. We illustrate this methodology on the particular example of a CSP-like language extended with communication on multiple channels in the style of Join calculus. We employ techniques from metric semantics in designing and relating the denotational prototype and the denotational specification for the language under study. We prove that the (single) trace produced by the denotational prototype is always an element of the collection of traces that is produced by the denotational specification. This result is independent of the random number generator that is given as a parameter to the denotational prototype.
Conference Paper
Full-text available
In this paper we employ the mathematical methodology of metric semantics in designing and relating an operational and a denotational semantics for a simple imperative distributed language LJ . LJ is a CSP-like language extended by us with communication on multiple channels and synchronization based on join patterns in the style of Join calculus. The semantic models are designed with a continuation semantics for parallel and distributed computing, introduced by us in previous work. The flexibility of continuations appears to be essential for the success of our semantic design. As far as we know, this is the first paper that reports a denotational semantics for a language with communication a la Join calculus.
Article
0. Introduction.- 1. Experimenting on nondeterministic machines.- 2. Synchronization.- 3. A case study in synchronization and proof techniques.- 4. Case studies in value-communication.- 5. Syntax and semantics of CCS.- 6. Communication trees (CTs) as a model of CCS.- 7. Observation equivalence and its properties.- 8. Some proofs about data structures.- 9. Translation into CCS.- 10. Determinancy and confluence.- 11. Conclusion.
Chapter
This paper presents a technique by which solutions to reflexive domain equations can be found in a certain category of complete metric spaces. The objects in this category are the (non-empty) metric spaces and the arrows consist of two maps: an isometric embedding and a non-distance-increasing left inverse to it. The solution of the equation is constructed as a fixed point of a functor over this category associated with the equation. The fixed point obtained is the direct limit (colimit) of a convergent tower. This construction works if the functor is contracting, which roughly amounts to the condition that it maps every embedding to an even denser one. We also present two additional conditions, each of which is sufficient to ensure that the functor has a unique fixed point (up to isomorphism). Finally, for a large class of functors, including function space constructions, we show that these conditions are satisfied, so that they are guaranteed to have a unique fixed point. The techniques we use are so reminiscent of Banach's fixed-point theorem that we feel justified to speak of a category-theoretic version of it.
Chapter
We study the semantics of a simple language with concurrency and recursion. Our semantic domain consists of (sets of) finite and infinite partially ordered multisets (pomsets) in order to model true concurrency (i.e. non-interleaved parallel execution). It will be shown that the set of pomsets can be turned into a complete ultra-metric space. With the induced notion of convergence, it is possible to provide meaning to infinite computations. Operational and denotational semantics for the considered language are provided and their equivalence is established by showing that both are fixed points of a contracting higher order operator. In a final section we give a tentative denotational semantics for an extension of the language with synchronization.
Article
A comparative semantic study is made of an element of the family of concurrent object-oriented programming languages. Particular attention is paid to two notions: (i) dynamically evolving process structures, including a mechanism to name and refer to processes and a means to create new processes, and (ii) rendez-vous between processes involving the sending and answering of messages and the induced execution of method calls. The methodology of metric semantics is applied in the design of operational and denotational semantics, as well as in the proof of their equivalence. Both semantics employ domains which are determined as fixed points of a contracting functor in the category of complete metric spaces. Moreover, fruitful use is made of the technique of defining semantic meaning functions as fixed points of contracting higher-order mappings. Finally. syntactic and semantic continuations play a pervasive role.