86
A Logical View of Composition
Martn Abadi and Gordon D. Plotkin
Systems Research Center
DEC's business and technology objectives require a strong research program. The Systems Research Center (SRC) and three other research laboratories are committed to lling that need.
SRC began recruiting its rst research scientists in l984|their charter, to advance the state of knowledge in all aspects of computer systems research. Our current work includes exploring high-performance personal computing, distributed computing, programming environments, system modelling tech-niques, specication technology, and tightly-coupled multiprocessors. Our approach to both hardware and software research is to create and use real systems so that we can investigate their properties fully. Complex systems cannot be evaluated solely in the abstract. Based on this belief, our strategy is to demonstrate the technical and practical feasibility of our ideas by building prototypes and using them as daily tools. The experience we gain is useful in the short term in enabling us to rene our designs, and invaluable in the long term in helping us to advance the state of knowledge about those systems. Most of the major advances in information systems have come through this strategy, including time-sharing, the ArpaNet, and distributed personal computing.
SRC also performs work of a more mathematical avor which complements our systems research. Some of this work is in established elds of theoretical computer science, such as the analysis of algorithms, computational geome-try, and logics of programming. The rest of this work explores new ground motivated by problems that arise in our systems research.
DEC has a strong commitment to communicating the results and experience gained through pursuing these activities. The Company values the improved understanding that comes with exposing and testing our ideas within the research community. SRC will therefore report results in conferences, in professional journals, and in our research report series. We will seek users for our prototype systems among those with whom we have common research interests, and we will encourage collaboration with university researchers.
A Logical View of Composition
Gordon D. Plotkin is at the Department of Computer Science of the Uni-versity of Edinburgh.
A preliminary version of this material appeared in \A Logical View of Com-position and Renement," in the proceedings of the Eighteenth Annual ACM Symposium on Principles of Programming Languages (1991).
c
Digital Equipment Corporation 1992
Authors' Abstract
Contents
1 Introduction
1
2 Overview
3
2.1 A calculus of sets of behaviors
: : : : : : : : : : : : : : : : : :
3 2.2 A calculus of sets of processes: : : : : : : : : : : : : : : : : :
5 2.3 Testing: : : : : : : : : : : : : : : : : : : : : : : : : : : : : :
73 Intuitionistic Logic
8
3.1 Composition
: : : : : : : : : : : : : : : : : : : : : : : : : : :
9 3.2 Stuttering: : : : : : : : : : : : : : : : : : : : : : : : : : : : :
124 Intuitionistic Linear Logic
14
5 Classical Linear Logic
21
6 Comparisons
28
Acknowledgements
33
1 Introduction
Modular, hierarchical methods for specifying reactive systems [13] include rules for composing and rening specications (e.g., [9]). The form of the rules suggests a possible specication logic. In it, the propositions would be system specications; the notations for combining specications would become logical connectives; and the rules for composition and renement would be formulated as sound inference rules. The logic would thereby provide a setting for the study of composition and renement rules. It should also provide a framework for writing specications and for verifying them using these rules.
In this paper, we dene and develop such a logic for composition. We intend to treat renement in a second paper, and thereby complete a framework for the use of the modular specication methods that composition and rene-ment rules underpin. At that point it will be natural and useful to consider a formal logic; in this paper we prefer to work at the semantical level. (The treatment of renement and the formal logic were sketched in a preliminary version of this paper [2].)
In fact two logics of composition arise naturally. One of the logics is an intuitionistic logic, while the other one is linear [12]. In the intuitionistic logic, a specication is a set of allowed behaviors, as in [19, 6]. In the linear logic, a specication is a set of allowed processes, much as in the sense of Abrahamson [3].
Composition rules rules typically apply to safety properties, and also, some-times with signicant complication, to certain liveness properties. Here we treat only safety properties. With this restriction, the logics provide a new understanding of some current specication methods, and suggest exten-sions. They are intended as a basis for Lamport's transition-axiom method for reactive systems [21].
A Composition Principle gives a way of combining assumption-guarantee specications while discharging their assumptions [23, 24, 26, 1]. A simple version of the principle, applied to two reactive systems
p
1 andp
2, says:If
p
1 satisesM
2 )M
1
and
p
2 satisesM
1 )M
2,
then when they are run in parallel
p
1 satisesM
1 andp
2 satisesM
2.As stated, the Composition Principle is not sound in general. The underlying propositional reasoning is obviously (and intriguingly) circular.
However, the principle is sound when
M
1 andM
2 are safety properties, andunder some additional hypotheses. For instance, consider two processes
p
1and
p
2 that communicate by the distributed integer variablesx
1 andx
2; itis assumed that only
p
1 writesx
1 and that onlyp
2writesx
2. LetM
1 be \x
1never decreases" and
M
2be the corresponding assertion forx
2, and supposethat
p
1 andp
2 satisfyM
2 )M
1 and
M
1 )M
2, respectively. Then it is
sound to conclude that
M
1 andM
2 both hold, that is, that neitherx
1 norx
2 ever decreases.An important test for a logic of specications is whether it can be used to express and to illuminate the Composition Principle. Both of our logics are designed to satisfy this criterion. For example, the intuitionistic formulation of the principle just given is:
(
M
2 !M
1) ^(
M
1 !
M
2) `
M
1 ^
M
2
with a proviso to guarantee that
M
1 andM
2 are specications of separateprocesses. The logics can express also other variants of the Composition Principle; they serve in comparing these variants and, occasionally, in dis-covering new ones.
linear logic to concurrency. Other evidence can be found in work on Petri Nets (e.g., [22]) and testing equivalence [5].
We introduce our logics in Section 2. In Section 3 we develop the intuitionis-tic logic of safety properties of behaviors, treating also invariance under stut-tering. In Section 4 we develop the intuitionistic linear logic of safety prop-erties of processes. As well as the natural logical structure, a new connective is needed to formulate a Composition Principle in this setting. In Section 5 we consider notions of testing for processes. We begin with an external no-tion, somewhat after the manner of De Nicola and Hennessy [10, 14], where the tests are not themselves processes in the model; then we obtain an in-ternal notion where they are. If we equate processes indistinguishable under testing we obtain a model of classical linear logic; this can also be obtained from the intuitionistic one as the collection of facts for a choice of ?
re-lated to testing, following another suggestion of Abramsky [27]. Finally, in Section 6 we relate the intuitionistic logic with the intuitionistic linear logic showing how the latter can be regarded as an abstraction of the former. The reader may wish to consult [8, 17, 25] for information on partial orders, cpos (complete partial orders), complete Heyting algebras, and quantales.
2 Overview
We review the basic propositional intuitionistic and linear calculi. We de-scribe the usual connectives, and motivate the addition of new constructs, which are needed in order to support the assumption-guarantee specication style.
2.1 A calculus of sets of behaviors
The intuitionistic logic is inspired by the work of Lamport, Pnueli, and others, where the specication of a system is a set of allowed behaviors. In turn, a behavior is a sequence of state transitions, and a state is an assignment of values to state components, or variables. Each state transition is attributed to an agent, the environment process or system process that caused the state change. Thus, a behavior is a sequence
s
0a1 !
s
1
a2 !
s
2
where each
s
i is a state and eacha
i is an agent, and the sequence is eitherinnite or else ends in a state
s
m for somem
0.The use of agents is motivated by the obvious need to distinguish between actions performed by the environment and those performed by the system. In any particular specication, it suces to consider two agents: the envi-ronment and the system. However, it is preferable to allow arbitrary sets of agents, in order to ease the composition of specications. Agents are taken as a primitive notion below, but this can be avoided, for example as in Pnueli's work [24].
Since we are concerned only with safety properties, we restrict attention to nite behaviors. A safety property is then a prex-closed set of behaviors. In the logic, the propositions denote safety properties, and `simply stands for . The collection of safety properties forms a complete Heyting algebra [17]
and so the intuitionistic logical operations ^,_, and ! are available. The
rst two are intersection and union.
Conjunction serves its usual logical role: a process
p
satisesM
1 ^M
2 if and
only if it satises both
M
1 andM
2. Conjunction represents also parallelcomposition: if
p
1 satisesM
1 andp
2 satisesM
2 thenp
1 andp
2 in parallelsatisfy
M
1 ^M
2. For instance, suppose that only
p
1 writes the variablex
1, and it guarantees thatx
1 never decreases, and similarly forp
2 andx
2; then the parallel composition ofp
1 andp
2 guarantees thatx
1 neverdecreases and that
x
2 never decreases. Further, disjunction corresponds tonondeterministic choice: if
p
1 satisesM
1 andp
2 satisesM
2 then a processthat acts like either
p
1 orp
2 satisesM
1 _M
2.
Implication turns out to be a familiar and handy operation:
E
!M
isthe set of all behaviors that satisfy
M
for as long as they satisfyE
, or longer. The connective !has arisen in works on the Composition Principle(in [1], and implicitly in [23] and [24]). Under reasonable hypotheses, the specications
E
)M
andE
!M
have the same implementations, andhence ) can be replaced with !. The fact that the logical formulation
naturally yields this connective is encouraging, as it suggests that the logic might be sensible and useful.
most
, and writeM /
.With this notation, the Composition Principle reads: for any
M
1 andM
2,(
M
2 !M
1) ^(
M
1 !
M
2) `
M
1 ^
M
2
provided
M
1/
1,M
2/
2, and the sets1 and 2 are disjoint. The provisoexpresses the requirement that
M
1andM
2describe dierent processes. (Theprinciple is not sound otherwise, for example if
M
1 andM
2 are the same.)Note how the logical approach obviates the need for explicit reference either to processes (as in [23, 24]) or to the realizable parts of properties (as in [1]). Many variants of the Composition Principle can be treated in this frame-work; for example, we easily obtain:
E
^M
2`
E
1
E
^
M
1`
E
2(
E
1 !M
1) ^(
E
2 !
M
2)
`(
E
!M
1^
M
2)where
M
1/
1 andM
2/
2. Some of these variants are well known, whileoth-ers seem to be new. All of them can be proved equivalent using propositional reasoning and a few rules about the constrains relation.
2.2 A calculus of sets of processes
In the linear calculus, a proposition denotes a set of processes. We take a process to be a set of sequences of state pairs. Intuitively, a process that contains (
s
1;t
1)(s
2;t
2)(s
3;t
3):::
can change the state froms
1 tot
1, andlater from
s
2 tot
2, and later yet froms
3 tot
3,:::
.In the study of safety, it suces to consider nite sequences of state pairs. We require also that processes be prex-closed. It turns out that the set of safety properties is isomorphic to the set of processes; thus, we may identify safety properties and processes.
The logical operations^,_, and!are still meaningful. They arise as before
from the complete Heyting algebra structure of the partial order of safety properties.
The property
M
1 ^M
2 allows the processes that are allowed by both
M
1and
M
2; conjunction does not have any particular relation withconcur-rency. Disjunction corresponds to nondeterministic choice, as before. Fi-nally,
M
1!
M
2 includes the processes that behave like a process in
M
2 forIntuitionistic linear logic arises when we consider the parallel composition of two processes. The parallel composition of
p
1 andp
2 is the set of shuesof
p
1 sequences withp
2 sequences. At the level of specications, this givesrise to a new logical operation, , which is the multiplicative conjunction in
linear logic. A process satises
M
1M
2 if it is the parallel composition of
an
M
1 process with anM
2 process. Thus, ifp
1 satisesM
1 andp
2 satisesM
2 then the parallel composition ofp
1 andp
2 satisesM
1M
2.
Associated with the connective is a linear implication operation, . The
property
M
1M
2 is the largest
N
such thatM
1N
is a subset ofM
2.Thus,
p
2M
1M
2 if and only if the parallel composition of
p
with anyq
2M
1 satises
M
2.Conjunction and disjunction are then the additive connectives of linear logic. The exponential operator ! is trivial, but a nontrivial ()
construct can be
added to represent the parallel composition of a number of like processes. In the next subsection, we propose an interpretation of the classical constructs. The standard intuitionistic linear connectives do not suce as a basis for assumption-guarantee specications. In particular,
p
2E
M
is notequiv-alent to the desired \
p
satisesM
in any environment that satisesE
." The assertionp
2E
M
means only that the composition ofp
with anyE
process
q
is anM
process. It is possible thatq
is not the whole environment ofp
|there could be a third process running in parallel; it is also possible thatp
does not satisfyM
in this environment|the parallel composition ofp
andq
does.To remedy this deciency, we introduce a connective . The property
M
1M
2 consists of the processes that, when run in parallel with an
M
1process (and with nothing else), behave like
M
2 processes. The special caseof
M
1M
2 where
M
1 contains only the null process 1 is of particularinterest; f1g
M
is the set of all processes that behave like a process inM
when run by themselves, with no interference from the environment. We denote this property byM
.Now the Composition Principle goes:
(
M
2M
1) (
M
1
M
2) `(
M
1
M
2)
are available, and for example we have also the more general:
E
M
2`
E
1
E
M
1`
E
2(
E
1M
1) (
E
2
M
2)
`(
E
M
1M
2)2.3 Testing
The linear logic described so far is an intuitionistic one. It does not include a constant ? that resembles falsehood, or a negation-like involution ()
?.
The notion of testing suggests useful ? and ()
? constructs, and gives rise
to a dierent account of assumption-guarantee specications. We can view the environment of a process as a tester for the process. Tests start from a distinguished state
; and another distinguished state represents the result of successful tests. A processp
passes the test ofq
ifp
andq
may yield the state when they run in parallel, starting from , andq
failsp
otherwise. A process succeeds if it may yield
when it runs in isolation, starting from , and it fails otherwise. Thus,p
passes the test ofq
if the parallel composition ofp
andq
succeeds.Failure is a safety property, and we write ? for the set of all processes
that fail. A sort of negation can also be dened:
M
? is the set of allprocesses that fail
M
processes. Naturally, we are particularly interested in the propositionsM
such thatM
= (M
?)?, which are called facts. Theseare the specications that have sound and complete testers; they can be characterized explicitly with a simple set of closure conditions.
Certain expressions in this classical linear logic are reminiscent of assump-tion-guarantee specications. In particular, (
E
^M
?)?is the set of processes
that fail all of the tests that
M
processes fail, provided these tests are fromE
. In other words, (E
^M
?)? includes all of the processes that cannot
be distinguished from
M
processes inE
environments (byE
tests). It is analogous to the assumption-guarantee specicationE
)M
, but theobvious analogues of the Composition Principle do not hold. A small correction solves this problem. Let
E
+=E
[f
u
(s;
)ju
2E; s
a stategThe processes in
E
+ behave like processes inE
, except that they may passthe testee at any point. If
E
andM
are facts, thenE
M
= (E
+\
M
?)?3 Intuitionistic Logic
The model that underlies the intuitionistic logic is a small variant of that used by Abadi and Lamport in [1]; we refer the reader to this and previous works for additional motivation.
We assume a nonempty set of states,
S
, and a nonempty set of agents,A
. These sets are disjoint. A behavior is an alternating nite sequence of states and agents that both begins and ends with a state. It can be pictured as:s
0a1 !
s
1
a2 !
s
2
a3 !
:::s
n1
an !
s
nwhere each
s
i is a state and eacha
i is an agent. We identify states with thecorresponding one-element sequences. If
is a sequence,a
an agent, ands
a state, then a!s
denotes the concatenationas
. The set of all behaviorsis denoted by B.
A safety property is a set of behaviors closed under prexes. The set of all safety properties is denoted by Sb, and ordered by subset. It will be
convenient to use the turnstile symbol ` to denote the subset ordering.
Safety properties, as we have dened them, are isomorphic to the safety properties of [1], for example, with the caveat that we have not yet treated invariance under stuttering. It is quite natural, and desirable, to add a straightforward condition of invariance under stuttering to our denitions, as rst advocated by Lamport [20]. For simplicity, we do not do so at this point, but do give a full discussion below.
The length j
j of a behavior is the number of agents that occur in .If 0
m
jj then jm is the prex of of lengthm
; ifm >
jj, then jm=.Proposition 1
Sb is a complete Heyting algebra, where^is\, WisS
, and the associated implication is
M
1 !M
2 =
f
j8n
0:
if jn2M
1 then
jn2M
2 g
Proof
AsSb is closed under nite intersections and arbitrary unions, theset-theoretic operations are the lattice-theoretic ones. For implication, note that
M
1 !M
2 =
f
j8n
0:
jn2(B nM
1)[
M
2g
Hence, the algebra of safety properties is a model for intuitionistic logic. The next subsection discusses composition in this intuitionistic setting, and the following one adds the treatment of stuttering.
3.1 Composition
We say that the safety property
M
constrains at most the set of agents, and writeM /
, if both:1. if
s
2S
thens
2M
; and2. if
2M
,s
2S
, anda
2, thena
!
s
2M
.Note that if
M /
then (N
!M
)/
for everyN
, and that if andM /
thenM /
. The collection of safety properties that constrain at most is closed under non-empty joins and nite meets.Further, let
M
be the smallest superset ofM
that constrains at most .The denition of \constrains at most," in the form of a monotone closure condition, guarantees that such an
M
exists. In fact, a behavior inM
iseither a behavior in
M
extended with arbitrary steps, or simply a behavior that consists exclusively of steps. So ()is a monotone closure operation.It commutes with arbitrary non-empty joins, and also with nite meets. We are now in a position to formulate a version of the Composition Principle of [1] specialized to safety properties. If
I
is a set of states, we write ^I
for the safety propertyf j begins with an element ofI
g; such a safety propertyis an initial condition.
Theorem 1 (Composition Principle)
Forn >
0 andi
= 1;n
let i besets of agents, let
I
i andI
be sets of states, and letM
i/
i andE
i/
i.Suppose that
I
Ti
I
i and, fori
= 1;n
,E
^ Vj
M
j ^I
^i `E
i. Then ^i (^
I
i^
E
i!M
i)`I
^^E
! ^i
M
i (1)Proof
We show by induction on the length of that, fori
= 1;n
, if is in the set on the left-hand side and is also in ^I
^E
then it is inM
i. So pickand an
i
between 1 andn
. In casehas length zero, the result is immediate asM
i/
i. Otherwise, has the form0 a!
s
. By induction hypothesis, 0We are left with the case where
a
2i. As2I
^^E
we get 02
E
^I
^i. Butnow, as
0 2V
j
M
j by the induction hypothesis, we get02
E
i (since, byassumption,
E
^ Vj
M
j^I
^i`E
i) and so 2E
i (asE
i/
i). So, nally, aswe now have
2I
^i^E
i !M
i and 2I
^i^E
i, we get2M
i as required.The Composition Principle corresponds to that of [1] restricted to safety properties once stuttering is taken into account (but with somewhat weaker hypotheses). The principle is designed to be of direct use in applications. As such, it is rather complex, and we turn to nding simpler but equivalent versions. An immediate simplication is obtained by removing the initial conditions to obtain that if
M
i/
i,E
i/
i, andE
^V
i
M
i ` Vi
E
i, then^
i (
E
i!
M
i)`E
! ^i
M
i (2)This is evidently a special case of the principle. It also implies the principle, as follows. Let us assume the hypotheses given in the statement of the Composition Principle. The remarks above on the
/
relation yield (^I
i !E
i)/
i, and so we can substitute ^I
i !E
i forE
i in (2), obtaining: ^i ((^
I
i!
E
i)!M
i)`E
! ^i
M
i (3)But now, (1) follows from (3) and ^
I
` Vi
I
^i by propositional reasoning. (Bythat we mean that if we treat (1), (3), and ^
I
` Vi
I
^i as sequents in a suitableintuitionistic calculus, regarding the
E
,E
i,M
i, ^I
, ^I
i as propositionalsym-bols, and ^ and ! as logical connectives, then (1) can be derived from (3)
and ^
I
` Vi
I
^i.)It is instructive to consider the case
n
= 1 which amounts to the fact that ifE
^M
1 `
E
1 then (
E
1 !M
1)
` (
E
!M
1). By propositional reasoning
this is equivalent to the case where
E
= (M
1 !E
1), which can be written
as:
(
E
1 !M
1) ^(
M
1 !
E
1) `
M
1 (
M
1/ ;E
1/
) (4)for any
j
(where 1j
n
) we have: Vi(
E
i !M
i)^E
`(E
j !M
j)^ Vi6=j(
E
i!
M
i)^E
`(E
j !M
j)^(E
^M
j !V
i6=j
M
i) ^E
(by induction hypothesis, since
E
^M
j^ Vi6=j
M
i `V
i6=j
E
i) `(E
j !M
j)^(E
^M
j !E
j)^E
(since by assumption
E
^M
j^ Vi6=j
M
i `E
j) `(E
j !M
j)^(M
j !E
j)`
M
j(by (4)) In short, we get V
i(
E
i !M
i) ^E
`M
j (forj
= 1;n
), and hence also Vi(
E
i!M
i)`E
! Vi
M
i as desired.If we allow the () operator in our statements, (4) can be further reduced
to:
(
M
!
M
)`M
(M /
) (5)This formula follows by propositional reasoning from (4) (taking
M
1 =M
and
E
1 =M
) and the fact thatM
`M
. But (5) also implies (4), once we
add to our propositional reasoning a fact about the () operator given by
Lemma 1:
Lemma 1
IfM
andE
are safety properties and is a set of agents, thenM
!E
`M
!E
.Proof
The proof is a simple chain of implications: (M
!E
)^M
`(M
!E
)^M
`((
M
!E
)^M
) (as () preserves intersections) `E
(as () is monotone)Now to see that (4) follows from (5), suppose that
M/
,E/
, and calculate: (E
!M
)^(M
!E
) `(E
!M
)^(M
!
E
) (by Lemma 1)
`
M
!
M
(sinceE /
)3.2 Stuttering
Two behaviors are stuttering equivalent if they dier only as regards the presence or absence of steps of the form
s
a!s
. Formally, dene stutteringequivalence as the least equivalence relation 'on behaviors such that:
usasv
'usv
(6)Orienting this equation from left to right we obtain a strongly normalizing Church-Rosser reduction system. The normal forms are the behaviors con-taining no stuttering steps. Write
\
for the normal form of ; it is the shortest behavior stuttering equivalent to .Following [1] we concern ourselves with properties closed under '. Let Stb
be the collection of safety properties closed under stuttering, and order it by inclusion. It turns out thatStb is again a complete Heyting algebra with
nite meets and arbitrary joins given set theoretically and the associated implication is the restriction of that forSb. The rst part of these assertions
is obvious; for the second we need to examine the relationship between the prex ordering on behaviors and stuttering equivalence.
Lemma 2
Suppose that 0' . Then there exists a
0 such that
0 '0
.Proof
Since ';
can be obtained from by a sequence of steps of theform (6) or the converse. We prove the result for the case of one such step; an evident inductive argument then completes the proof. So rst suppose that
;
have the formsusasv
andusv
. Since0 =usasv
either 0us
or
us <
0. In the rst case we have0 and so we can take0=
0. Inthe second case
0must have the formusasv
0 wherev
0v
and we can take 0 =usv
0. It remains to consider the situation where;
have the formsusv
andusasv
. Since 0
usv
we have either that 0
u
(when we cantake
0 =0) or that 0 has the formusv
0 withv
0
v
(when we can take 0=usasv
0).We can now check that if
M
1 andM
2 are inStb then so is
M
1!
M
2 (where ! is as dened above). It follows that ! is the intuitionistic implication
in Stb. For this, suppose that
' 2M
1!
M
2. Suppose further that
jn2M
for somen
0. Then, by the Lemma, for some 0 , jn' 0.M
1!
M
2), and
jn2
M
2 (as
M
2 is also'-closed). Hence,
2M
1!
M
2.The relation betweenSb and Stb is best explained by the map
'
:Sb ! Sbwhere
'
(M
) is dened to be the least safety property that containsM
and is closed under stuttering.Proposition 2
1.'
(M
) =f j92M:
'g.2.
'
is a monotone closure operation preserving all joins;Stb is its partial order of xed-points.
Proof
1. It suces to show that the right-hand side is a safety property and this is immediate from Lemma 2.
2. Obvious.
As the lattice-theoretic operations in Stb are the set-theoretic ones, the
collection of stuttering-closed safety properties that constrain at most
is closed under non-empty joins and nite meets; and we also know that ifM
is such a property then so is
N
!M
, for anyN
in Stb. ForM
in Stb, letM
be the least superset ofM
in Stb which constrains at most .Proposition 3
1.M
='
(M
).2. () is a monotone closure operation that preserves non-empty joins
and nite meets.
Proof
1. It suces to show that
'
(M
) constrains at most . First we havethat
S
M
'
(M
). Second, suppose that 2'
(M
);a =
2, ands
2S
. Then ' some inM
. Soa
!
s
'a
!
s
2M
and we2. Evidently ()is a monotone closure operation. It preserves non-empty
joins as both
'
and () do. All closure operations preserve the topelement. For binary meets, we just prove the inclusion
'
(M
)\'
(N
)'
((M
\N
))the other direction being a trivial consequence of monotonicity. So suppose that
' inM
and ' inN
. It is straightforward toshow, for any
M
in Stb, that if 2M
then\
2M
. So we get that '\
2(M
\N
), as\
=\
=\
. But (M
\N
) = (M
\N
)as()preserves binary intersections, and so we have
2'
((M
\N
)),as required.
The Composition Principle goes through with stuttering-invariance exactly as it did before. We need only note that ^
I
is inStb, and that meet, join, andimplication for Stb are the restrictions of the corresponding Sb operations.
All the reductions of the principle to simpler ones also go through exactly as before, as they are either propositional or use the expected corresponding facts for (), that
M
`M
andM
!E
`M
!E
|the proof of thelatter being perfectly analogous to that of Lemma 1.
4 Intuitionistic Linear Logic
In this section we develop the intuitionistic linear logic proposed in the overview. The study of classical linear logic is postponed to the next section. We assume given only a set of states
S
; there is no notion of agent in this calculus. A transition is a pair of states. A process is a prex-closed set of sequences of transitions. (Note that the empty sequence"
is allowed.) The set of all processes is denoted by P. It is partially ordered by andas such it is a complete semilattice, which is to say that it has least upper bounds of all subsets. For two given complete semilattices
L
andM
, we writef
:L
!lM
, and say thatf
is linear, meaning thatf
preserves allleast upper bounds, that is
f
(WX
) = Wx2X
f
(x
) for all subsetsX
ofL
.The set
L
!lM
of linear functions fromL
toM
itself forms a completesemilattice under the so-called pointwise ordering:
f
g
if
(x
)g
(x
) forComplete semilattices
L
can be viewed as cpos (partial orders with a least element and least upper bounds (lubs) of directed sets) endowed with a continuous semilattice operation, +, such thatx
x
+y
. (Note thatx
+y
must be
x
_y
, the least upper bound in the partial order.) In the work ofHennessy and Plotkin [15], this kind of algebra was found to be appropriate to the study of lower powerdomains, which are just free algebras of that kind. Following ideas in [16], we now dene a safety property on such a structure as a non-empty Scott-closed subset closed under the semilattice operation. Intuitively, a safety property asserts that nothing ever goes wrong, and \going wrong" has the following three qualities:
1. nothing can go wrong with ?, the least element, as ?corresponds to
nothing happening;
2. if nothing can go wrong with each element of a directed set
X
then nothing can go wrong withWX
either, as \going wrong" is continuous; 3. if nothing can go wrong withx
ory
then nothing can go wrong withx
+y
, as all that can happen withx
+y
is whatever happens withx
or whatever happens with
y
.This intuition can be formalized by taking as a way of going wrong a linear map
f
:L
!lI
whereI
is the two-point complete semilattice,f?;
>g, with ? >. The collection of elements ofL
wheref
does not \go wrong" isf
1(?) and this yields an isomorphism S(
L
)
= (
L
!lI
)op
where we order the collection of safety propertiesS(
L
) by subset.Consider-ing again our desire to work with elementary means, note that every safety property
X
L
has a largest element, namelym
(X
) =defW
X
.gory of domains tailored to nondeterminism, in the fashion of [15]. Specically, working in the category of complete semilattices, we nd thatPis the initial solution to the equation:
P
= (}(S)! l
}(S)P) ?
where the lifting operator ()
?adds a new least element, and the tensor product is dened
by a universal property: there is a universal bilinear map LM
! LM. Thus P can be obtained by the methods available in domain theory, and as such it provides
Proposition 4
The functionm
: S(L
) !L
is an isomorphism of partialorders.
Proof
The function is clearly monotone. Its inverse ism
1(x
) =f
y
jy
x
gwhich is also monotone.
This isomorphism, together with the remarks above, yields an isomorphism
L
op= (L
!l
I
) which is part of the well-known self-duality of the categoryof complete semilattices [17]. We say the process
p
satisesa safety propertyX
, and writep
j=X
, if and only ifp
2X
. Under the isomorphism this isthe case i
p
m
(X
).We will work with P rather than the more complexS(P). First,P is again
a complete Heyting algebra with the lattice-theoretic operations being the set-theoretic ones and the associated implication being
M
1 !M
2 =
f
u
j8n
0:
ifu
jn2M
1 then
u
jn2M
2 g
where the prex
u
jnis dened as usual for sequences. The empty set(false-hood) is written 0, and the set of all transition sequences (truth) is written
>.
If
p
1andp
2are two processes, their parallel composition isp
1 jjp
2, where jjis
the language shue operator. Conjunction is no longer the logical correlate of parallelism, however. If
p
j=X
andq
j=Y
it is not true in general thatp
kq
j=X
^Y
. Rather, in order to treat parallelism, we dene a newoperator on safety properties by:
X
Y
=fp
kq
jp
j=X;q
j=Y
gswhere (
A
)s is the least safety property containingA
.Proposition 5
m
(X
Y
) =m
(X
)km
(Y
).Proof
Ifp
j=X
andq
j=Y
thenp
m
(X
);q
m
(Y
), and soX
Y
= fr
jr
m
(X
)km
(Y
)g.Working with Pin place ofS(P) we takeonPto bek. Now,commutes
with arbitrary joins in P and gives a commutative monoid, with unit the
Proposition 6
(P;
S;
1;
) is a commutative quantale, where 1 =f"
g.The associated quantalic implication is then given by
M
1M
2 =
f
u
j(fu
g jjM
1)M
2g
It follows immediately that the algebra of safety specications provides a model of intuitionistic linear logic [28, 25]. Parallel composition is the mul-tiplicative conjunction operation, while ^ and_ are the additives.
The exponential operator ! is uniquely, but trivially, determined. If 1
M
then 1!
M
, and in addition !M
1, by the general properties of !, so weget !
M
= 1. On the other hand, if 1M
is false, the only possibility isM
= 0, and !M
= 0, as in every model !M
M
.Instead, a nontrivial ()
operation is available:
M
is dened as Wi0
M
i,
where
M
iis thei
-fold parallel composition ofM
with itself, and it representsan arbitrary number of
M
processes running in parallel.Composition
A chained transition sequence (from
s
tot
) is one of the form (s
1;s
2)(s
2;s
3):::
(s
n 2;s
n 1)(s
n 1;s
n)(where
s
1 =s
ands
n =t
). In particular, the sequences"
and (s
1;s
2)are chained. Intuitively, chained transition sequences correspond to runs of a system by itself, with no interference from the environment. We write
u ^
Iv
ifu
andv
have a chained shue, beginning with an element ofI
.Assumption-guarantee specications are made possible by a new ternary connective . We rst set:
(
M
)yI =f
u
j9v
2M: u ^
Iv
gand then dene
M
1 IM
2 = (
M
1) yI !
M
2The denition says that if a prex
u
of a sequence inM
1 IM
2 has a chained
shue beginning in I with a sequence in
M
1, thenu
is inM
2. Hence, thesequences in
M
1 IM
2 cannot be distinguished from sequences in
M
2 byIt seems rather unfortunate to have to introduce a ternary connective where, furthermore, one of the arguments comes from a set of propositions dierent from the other two. We are missing a principled explanation of this connec-tive arising from the nature of processes. In Section 5 we give one account of it, relating it to the work using intuitionistic logic.
We can now formulate a version of the Composition Principle in intuitionistic linear logic.
Theorem 2 (Composition Principle)
Forn >
0 andi
= 1;n
, suppose thatM
i;E
i 2 P, and letI
i andI
be sets of states. SetM
0
i = N
j6=i
M
j.Suppose that
I
TI
i andE
M
0i `
M
i Ii
E
i. Then Oi (
E
i I iM
i)`
E
I Oi
M
iRather than prove the soundness of this rule directly, we will progressively reduce it to simpler principles, and prove the simplest. First, since I is
antimonotone in
I
the principle is equivalent to the case whereI
i =I
, fori
= 1;n
. We now keepI
xed and often omit it, and write, for example,E
M
.It is straightforward to reduce the principle to the binary case. The unary case follows from the binary case by taking
M
2 = 1,E
2 =E
M
1, andusing the fact that
N
`M
N
, for allM
,N
. Forn
2 we proceed byinduction. The base case is given, so suppose
n
3 andE
M
0i `
M
iE
ifor
i
= 1;n
. So fori
= 2;n
we have (E
M
1)N
j2;j6=i
M
j`
M
iE
i and,by induction hypothesis, we get thatN
i2(
E
iM
i)`E
M
1N
i2
M
i.In order to prove N
i(
E
iM
i) ` (E
Ni
M
i) it is now enough to prove(
E
1M
1)
(
E
M
1M
0 1)`
E
M
1M
01. But this follows from the binary
case, taking
M
2 to beM
01 and
E
2 to be
E
M
1, since
E
M
0 1 `M
1E
1and
N
`M
N
, for allM
,N
.More surprisingly, the general case reduces further to the unary case, which
is:
E
`
M
1E
1(
E
1M
1)
`(
E
M
1)Note that this is equivalent simply to: (
E
1M
1)`(
M
1E
1)M
1 (7)
The proof that the binary case reduces to the unary case has two parts. The rst part applies not only to the binary case but also to the general case; it consists in reducing the general case to its instance where
E
i=E
M
0
i:
O
i (
E
M
0i
M
i)`E
Oi
M
iIn the second part, this instance is derived from the unary case for
n
= 2: (E
M
2
M
1)
(
E
M
1M
2)`
E
(M
1M
2)For the rst part of the proof, assume that
E
M
0i `
M
iE
i. Theantimonotonicity of then gives: O
i ((
M
iE
i)M
i)`E
Oi
M
iand (7) gives: O
i (
E
iM
i)` Oi ((
M
iE
i)M
i)The general principle follows by transitivity.
We need rst a little more about the logic of for the second part of the
proof:
Lemma 3
LetA;B;E
2P. ThenA
(A
E
IB
)`E
IA
B
Proof
It is enough to takew
inA
(A
E
IB
) andx
inE
such thatw ^
Ix
and show thatw
is inA
B
. So taking such aw
andx
, we get rstthat
w
is a shue of an elementu
ofA
with an elementv
ofA
E
B
.Next,
u
andx
must have a shue,y
, say, such thatv ^
Iy
. But theny
isin
A
E
and so asv
is inA
E
IB
, we get thatv
is inB
. So asw
is ashue of
u
(inA
) withv
(inB
) we getw
inA
B
as required.We may now calculate that: (
E
M
2
M
1)
(
E
M
1M
2)`(
E
M
2M
1)((
M
2E
M
1)(by the unary case)
`(
E
M
2M
1)(((
E
M
2M
1)E
)M
2)(as (
E
M
2M
1)E
`M
2E
M
1 by Proposition 3) `
E
((E
M
2
M
1)
M
2)
(by Proposition 3)
`
E
(E
M
1M
2)(by Proposition 3)
`
E
M
1M
2We are left with the task of proving the unary case. The proof requires an induction on the length of transition sequences and it is noteworthy that no other truth of the logic we have so far shown (such as Proposition 3) has done so. Thus all the induction is, as it were, concentrated into this one case.
Proof
We have to show that (E
IM
) ` (M
IE
) IM
for anyE
and
M
in P. In caseM
= 0 the result follows immediately as 0 IE
=>.Otherwise it is enough to show that if
u
is in (E
IM
) andv
is in (M
IE
)and
u ^
Iv
thenu
is inM
; we show this by induction on ju
j+jv
j. Ifthis is 0 then
u
="
2M
. Otherwise letw
be a complete shue ofu
andv
beginning in
I
.There are two cases. In the rst,
w
=w
1(s;t
),v
=v
1(s;t
), andw
1 is acomplete shue of
u
andv
1. Asj
u
j+jv
1j
<
ju
j+jv
j, we then getu
inM
by the induction hypothesis. In the second case,
w
=w
1(s;t
),u
=u
1(s;t
),and
w
1is a complete shue ofu
1 andv
. As ju
1
j+j
v
j<
ju
j+jv
jwe getu
1 inM
, by induction hypothesis. But asv
is in (M
I
E
) andu
1
^
Iv
,we get
v
inE
. But then asu
is in (E
IM
) andu ^
Iv
, we getu
inM
.It also seems possible to obtain variants of the principle that apply to the composition of an arbitrary number of like processes that depend on one another, in an environment
E
. For example, we can show:(
E
M
I
M
)E
IM
To see this is true, in Theorem 2 take
M
i =M
,I
i =I
, andE
i=E
M
n 1,obtaining that:
for
n >
0. But then, sinceM
n 1 `M
, we get:
(
E
M
I
M
)n
`
E
IM
n
for
n >
0, and so, as 1 `M
I 1 and (M
I ) distributes over arbitrarynon-empty joins (as is easily veried), the required result follows.
There does not seem to be an analogous rule in the intuitionistic framework of the previous section.
5 Classical Linear Logic
Once we have a quantale, there is a well-known and straightforward way to interpret classical linear logic; we choose an element ? and, setting
x
? =
x
?, we work with the ()??-closed elements [25]. Here we show that by
an appropriate choice of?we can also nd a Composition Principle within
the framework of classical linear logic. Abramsky [27] has suggested that the choice of ?could depend on a notion of testing, and could be taken to
be the set of processes that, when run by themselves, can be seen as failing (that is, as not passing the test). In this way we would have an internalized notion of testing where processes represent tests: a process
p
would pass a test q i (p
jjq
)2 ?=
.Here we will make this suggestion concrete for safety properties; every test
q
will yield a safety property
q
?so thatp
does not passq
ip
is inq
?.We may think of the safety property yielded by
q
? as being the failureto pass
q
. Once we restrict attention to the ()??-closed subsets, all safety
properties will be of this kind as then
M
=M
??holds.
It is instructive to begin with an external approach to testing and for this we provide a semantical analogue to some of the testing ideas of De Nicola and Hennessy [10, 14], adapted to the present context of processes and safety specications. Let
;
be two distinct entities not inS
, and putS
0 =S
[f;
g. We may think of and as being starting and stopping statesfor an external test scenario. LetP
0be the processes over
S
0; these will bethe tests. Clearly notions and results applying to
S
and Pextend toS
0and P0. For
p
inP and
r
in P0, we say that
p
passesr
i there areu
inp
andv
in
r
such thatu _ v
, meaning that some prexu
0 ofu
and some prexv
0Now we have a natural testing preorder on processes in P:
p
Pq
i8
r
2P0
:
(p
passesr
q
passesr
)In order to characterize this preorder some denitions are needed. Letwbe
the least preorder on transition sequences over
S
such that:uv
wu
u
(r;s
)(s;t
)v
wu
(r;t
)v
uv
wu
(s;s
)v
and, if
n
0 andu
= (s
1
;t
1):::
(s
n;t
n) is a transition sequence overS
, setu
# = (;s
1)(
t
1;s
2):::
(t
n 1;s
n)(t
n;
), and set"
# = (
;
).Proposition 7
1.u _ u
#.2. Suppose
v
wu _ w
. Thenv _ w
.3. Suppose
v _ u
#. Thenv
wu
.Proof
Parts 1 and 2 are easy to prove and we just consider part 3. Ifu
="
then (trivially)v
wu
. Otherwiseu
has the form (s
1
;t
1):::
(s
n;t
n)with
n >
0 and sincev _ u
#,v
must have the formv
1
:::v
nv
0 where, for
i
= 1;n
, eitherv
i ="
ands
i =t
i orv
i is a chained transition sequencebeginning in
s
i and ending int
i. In either casev
iw(s
i;t
i) and sov
wu
.Theorem 3
p
Pq
i8
u
2p:
9v
2q:u
vv
.Proof
First suppose thatp
P
q
andu
2
p
. Letr
=fw
jw
u
#g2P 0.
Then as
u _ u
#, the Proposition 7, we get thatp
passesr
, and sincep
P
q
so doesq
. Hencev _ w
for somev
inq
and somew
u
#. But
then
v _ u
# and sov
w
u
, by the Proposition. Conversely, suppose that 8u
2p:
9v
2q:u
vv
and thatp
passesr
. Thenu _ w
for someu
2p;w
2r
;taking a
v
2q
such thatu
vv
, we getv _ w
by the Proposition, and soq
passes
r
.To internalize, we simply work withP
0 rather than with
P and extend the
notions above. As before, if
u
andv
are transition sequences overS
0,u _ v
means that there are prexes
u
0;v
0ofu;v
which have a chained shue from to. We writep
passesr
also forp
inP0, and correspondingly extend the
testing preorder|the extension is written P
0. To pass to classical linear
logic, we take ? to be the safety property of those processes that do not
contain a chained transition sequence from
to and so indeed we have that:p
does not passr
i (p
jjr
)?Under the isomorphism of processes and safety properties,?becomes
f
w
jno prex ofw
is a chained transition sequence from to gand we get for any safety property (under the isomorphism):
M
?=f
u
j8v
2M:
:(u _ v
)gNote that
p
does not passr
ir
jjp
`?ir
`p
?, so
p
? is the largest testp
does not pass. The internal and external views are linked up as follows:Proposition 8
1. For anyp;q
in P0,
p
P
0
q
iq
?`
p
?.2. The largest process P
0-equivalent to
p
isp
??.Proof
1. Suppose
p
P0
q
. Then asq
does not passq
?, neither does
p
and sop
jjq
?`?. Therefore,
q
?`
p
?. Conversely, suppose
q
? `p
? and
q
does not pass
r
, soq
jjr
`?. Thenr
`q
?`
p
? and so
p
jj
r
`?.2. By the rst part,
p
is P0-equivalent to
q
ip
? =
q
?. But thenp
and
p
?? are equivalent (as we always have, for any choice of?, that
p
? =p
???), and ifp
andq
areP
0-equivalent then
q
q
?? =
p
??(with
q
q
?? true for any choice of ?).
The next task is to extend the characterization of the testing preorder to the whole of P
0. We extend
w to a relation w
0 which is the least preorder
on
S
0-transition sequences such that:u
(r;s
)(s;t
)v
w0
u
(r;t
)v
uv
w0
u
(s;s
)v
(
;
)u
w 0u
u
(s;
)w0
u
(s;t
)v
and ()
# is dened exactly as before. Note that
u
## = (;
)u
(;
)0
u
(where we take
0 to be the equivalence relation induced by w
0).
The analogue of Proposition 7 holds, with w
0 replacing w:
Proof
As before, parts 1 and 2 are easy and we concentrate on part 3. So suppose thatv _ u
#. The caseu
="
is trivial and so we can takeu
to have the form (s
1;t
1)(s
2;t
2):::
(s
n;t
n) (withn >
0). Thenu
# is(
;s
1)(t
1;s
2);
(t
2;s
3):::
(t
n 1;s
n)(t
n;
). Some prexesv
0
;w
ofv;u
# havea chained transition sequence from
to ; we takew
and thenv
0 to be asshort as possible. Then
is either the last state inw
or the last state inv
0.In the rst case (when
is the last state inw
), eitherw
=u
# orw
=(
;s
1)(t
1;s
2):::
(t
m;s
m+1) with 0
m < n
ands
m+1 =
. In the rst ofthese cases
v
0 has the formv
0
v
1:::v
n wherev
0 is"
or is a chainedtran-sition sequence from
to , and fori
= 1;n
eachv
i is"
ands
i =t
i orv
i is a chained transition sequence froms
i tot
i. But then we obtainv
w 0v
0 w0 (
;
)(s
1
;t
1):::
(s
n;t
n) w0
u
. In the second of these casesv
0 has theform
v
0v
1:::v
mwithv
0andv
1;:::;v
mas before. Then we obtainv
w0
v
0 w0
(
;
)(s
1;t
1):::
(s
m;t
m) w0(
s
1
;t
1):::
(s
m;t
m) w0(
s
1
;t
1):::
(s
m;t
m)(;
) w0
(
s
1;t
1):::
(s
m;t
m)(;t
m+1):::
(s
n;t
n) =u
.In the second case (when
is the last state inv
0), since we chose rstw
andthen
v
0 as short as possible,w
has the form (;s
1)(
t
1;s
2):::
(t
n;s
n+1) with0
m < n
andv
0 has the form
v
0
v
1:::v
mv
m+1 withv
0 and thev
i as before(for
i
= 1;m
) and withv
m+1 a chained transition sequence froms
m+1 to.But then
v
w0(
;
)(s
1
;t
1):::
(s
m;t
m)(s
m+1;
) w0
u
.The symmetry of testers and testees in the
_
relation enables a pleasing reformulation of the rst three parts of the analogue of Proposition 7:Proposition 9
v _ u
iv
w0
u
#.Proof
Ifv _ u
then asu
##0
u
we get by part 2 of the analogueof Proposition 7, and the symmetry of
_
thatv _ u
##. So by part 3,Conversely if
v
w0
u
# then asu _ u
# by part 1, we getu
#_ u
bysymmetry and then
v _ u
by part 2.The analogue of Theorem 3 holds, with the analogous proof:
p
P0
q
i8
u
2p:
9v
2q:u
v 0v
and so the facts, being the maximal P
0-equivalence classes by Proposition 8,
are exactly thev
0-downwards closed sets. It follows that the lattice-theoretic
operations are the set-theoretic ones. We can rewrite the formula above for
M
? (whenM
is a fact) using Proposition 9:Proposition 10
M
?= fu
ju
#
=
2M
g.Proof
Taking negations we see that 9v
2M:u _ v
i 9v
2M:v
w 0u
# iu
#2
M
(asM
is a fact).The preorderw
0and the map ( )
# interact in a natural way:
u
##0
u
u
w0
v
iv
# w0
u
#(For the last, note that if
u
w0
v
thenu _ v
# and sov
# w0
u
#, byProposition 9). We call any such map on a preorder an involution. The case where the preorder is a set, say
U
, is well known to the relevance logicians who instead of quantales considered quasi-elds of subsets ofU
closed under the quasi-complement operation::
X
=U
ng
(X
)If we divide out by the equivalence relation
0we obtain a quasi-eld of sets
(
g
([u
] 0) = [u
#]
0) over
U
= f[u
]0
g isomorphic to our lattice of facts. The
sets in the quasi-eld are the subsets of
U
downwards closed in the partial order v0
=
0.
We have already noted that the facts are closed under the set-theoretic op-erations and so the additives^
;
_;
>;
0 retain their set theoretic denitions.Howeverand 1 must be redened, and
M
N
is now (M
kN
)?? and 1 is f
"
g??. At the level of transition-sequences we can make a further
U
to be the collection of equivalence classes as above we obtain a structure (U;R;
["
];g
) whereR
([u
];
[v
];
[w
]) i there areu
0v 0
u;v
0v
0
v
, and a shue,x
, ofu
0andv
0such thatw
v0
x
. This satises all the requirements to be anR
-frame, except for (the undesired) idempotence. Given any such structure (U;R;
0;g
) we obtain a quantale (Q;
;
1) for classical linear logic whereQ
is the collection of -downwards closed subsets of
U
. We takeu
v
iR
(1;v;u
) andA
B
=fz
j9x
2A;y
2R:R
(x;y;z
)g, 1 =fx
jx
0g, and ?=fx
jx
g
(0)g. Starting from the (U;R;
["
];g
) as above we obtain thequantale for classical linear logic considered in this paper.
Composition
To be consistent with the testing idea of starting computations from
, we x the setI
to be fg, and writeM
N
forM
IN
. As suggested insubsection 2.2, let
E
+=
E
[fu
(s;
)ju
2E; s
2S
0g
Note that
E
+ is not a fact in general, even whenE
is a fact.Lemma 4
LetE
be a fact. Supposew
2E
andv ^
fg
w
. Thenv
]2
E
+.Proof
First suppose thatv
="
. Thenv
] is (;
) which is inE
+ as"
isin
E
(sincew
is). Suppose now instead thatw
="
. Thenv
is a chained transition sequence from to some statet
, and sov
] has the formu
(t;
),where
u
is a sequence of stutters, that is transition pairs of the form (s;s
). But then:w
w0
"
w0
u
and sou
is inE
, andv
] is inE
+.We may now therefore suppose that neither
v
norw
are"
. There are two cases depending on whether the chained shue ofv
andw
starts with a transition fromw
, or one fromv
. In the rst case there is a prexw
0 ofw
, statess
0;:::;s
n+1 (withs
0 = ) andt
0;:::;t
n, and alsov
0;:::;v
n andw
0;:::;w
n such thatv
=v
0v
n,w
0 =w
0
w
n, and fori
= 0;n
,v
i is achained transition sequence from
t
i tos
i+1, andw
i is a chained transitionsequence from
s
i tot
i. Nowv
] has the form (s
0;t
0)u
0(
s
n;t
n)u
n(s
n +1;
)where for
i
= 0;n
,u
i is a sequence of stutters. But thenw
w 0w
0w 0
(
s
0;t
0)u
0(