Cause-effect structures

Cause-effect structures

Information Processing Letters 26 (1987/88) 313-319 North-Holland CAUSEEFFECT 25 January 1988 STItUCTURES Ludwik CZAJA institute of Informatics, U...

927KB Sizes 27 Downloads 84 Views

Information Processing Letters 26 (1987/88) 313-319 North-Holland

CAUSEEFFECT

25 January 1988

STItUCTURES

Ludwik CZAJA institute of Informatics, University of Warsaw, PKiN VII@, 00-901 Wusaw, Poland

Communicated by W.M. Turski Received 1 October 1986 Revised 28 April 1987

Keyword:

Cause-eifect structure, concurrency, Petri net

1. Introduction

A cause-effect structure is a directed graph in which predecessors and successors of each node are grouped into regions (see Fig. 1). Nodes are considered as actions, whose status is either active or passive, predecessors and successors of an action are its causes and effects respectively, and a region is a group of action’s causes sufficient to make it active, or of its effects sufficient to make it passive. An action-a working entity, like processor, neuron or whatever-is active if it is ready to send output to an effect region and passive if ready to receive input from a cause region. A change of status occurs on these transac-

Fig. 1.

tions, while the working phase of an action is neglected. An action can be activated (passivated) if it is passive (active) and each of its causes (effects) from at least one region can be passivated (activated). This ‘recursive’ phrase leads to equations directly obtained from a cause-effect structure. Their solution defines a local semantics of the structure: (1) it explicitly states when an action x can change its status, and (2) for an action x, it determines a family of x’s impact regionssets of actions whose status change must occur along with x’s status change; only one such set is chosen to ‘fire’. Solving semantical equations is a sort of analysis of the structure, finding a structure from ‘ behavioural’ functions-subject not investigated here- its synthesis. Global semantics is a strategy of selecting a number of regions to fire in one step. Obviously, this is a partial-order semantics in that some actions can change status in unspecified order. It follows, in this respect, a line of bilogic graphs [2] and, especially, of Petri nets [l], in contrast to linear order (interleaving) semantics which underlies, for example, the Karp-Miller model [4], CSP [3] or CCS [5]. Unlike in bilogic graphs, the relationship among nodes of cause-effect structures is not that simple and, unlike in Petri nets, the graph is one-partite, not bipartite. But, cause-effect structures are in a sense equivalent to condition/event Petri nets (see Section 4). This work is an attempt to devise an algebraic calculus for analysing behaviour of con-

0020-0190/88/$3.50 0 1988, Elsevier Science Publishers B.V. (North-Holland)

313

Volume 26.

current systems represented as cause-effect structures. “Wepresent a primary idea of this calculus only. Two issues, namely exact characterization of global semantics in the calculus and combining cause-effect structures by means of operators like parallel composition with communication and nondeterministic choice, need more extensive treatment and are left to successive work.

2. A notation for families of sets Consider a well-formed expression built up of individual variables, infix operators ., + and parentheses. Let the operators be idempotent, cornmutativt, associative and let distribute over + , i.e., we identify a a with a, a (b + c) with a b + a c etc. Such an expression can be transformed into a normal Corm: l

l

l

l

l

( u.v.

... l w) -t. . . .

+(py.....z),

whereu, q,..., w,..., x,y ,..., zareindividualvariPI&s. We take this normal form as a notation for a ‘one-level’ family of finite sets:

u

u, v

‘...,

25January1988

INFORMATION PROCESSING LETTERS

Number6

w},..., (x,

y ,... J}}.

and assume that all equivalent expressions denote the same family of sets as their normal form. For instance, a + ba(c* a + d) denctes ((a}, {b, d}, {a, b, c} } (assume priority of over + ). Conversely, a finite family of finite sets l

3. Cause-effect structures A cause-effect structure is a triple (X, C, E), where X is a set, the elements of which are called actions; C : X + P(P(X)) and E : X + P(P(X)) are functions satisfying: Vx, y XE UC(y)

iff yE u

C(x) and E(x) are respectively called the family of causes and effects of action x, and their members are respectively called cause and effect regions. In the following, C(x) and E(x) will also denote the respective family expressions. Cause-effect structure (X, C, E) may be represented by a graph: actions from X are its nodes, there is an arc from x to y iff x E Ll C(y) (or, equivalently, y E U E(x)), and every node x is superscripted by C(x) and subscripted by E(x): x2:,‘. Also, conversely, a set of individual variables superscripted and subscripted by family expressions represents a cause-effect structure. For example, the set

1a,,

be, ce, d,, ep:g(Tic)fd, fe, ge, he>

represents the graph in Fig. 1 where cause regions and effect regions of action e have been encircled. Without encircling, the graph looks like the one depicted in Fig. 2. If a linear order in this set matters, we shall use parentheses instead of braces. 3.I. Local activity of cause-effect structure Every action may haue an active (1) or passive

11 u, v , . . . . W),...,(&Y9...,Z)}, where u, v, . . . , w, . . . , x, y, . . . 5z are individual objects, may be denoted by (u.v . . . . ‘w)+ . . .

be _c(py.-..

'Z)

\

or by any equivalent expression. We call such expressions “farnil expressrons. If F is a family of sets, then by u’ F we denote a flattening of F, i.e.. LIF=(x:~XEFXCEX}.

P(X) denotes the powerset oi’ the set X, i.e., the set of all subsets of X. 314

E(x);

Fig. 2.

INFORMATION

Volume 26, Number 6

PROCESSING LETTERS

(0) status. Local behaviour of the structure will be defined iff: - a condition is given under which a status of any action may be changed (see Section 3.1.1), - a rule is given in accordance to which a change of action’s status enforces a change of another actions’ status, i.e., a local state transition rule (see Section 3.1.2). To formalise this, let s : X + {0, 1) be a function called state and let S = (0, 1)’ be the set of all states. Action x in a state s is active if s(x) = 1 and passive if s(x) = 0. 3. I. I. Condition for action’s status change We associate with action x two functions which will indicate when, in a given state, x can be activated or passivated: x’(~):S+

(0,l)

and

xMxJ:S + (0,l).

They will be defined soon after we have introduced some auxiliary notions. The intension of this definition is to indicate the possibility of activation of x in a state s by condition x~(~)(s)= 1 while passivation is indicated by condition xUxJ(s) = 1. Both functions will be the solutions of a system of functional equations which may be straightforwardly written for a given cause-effect structure. To this end, note that the set of functions W = (0, 1)’ with operations V , A, and complement, defined by the following equalities:

gl(s)= f(s)v g(s)9 if Agl(s)= f(s)Ag(s)9 f(s)= ,f(s), ff v

is a compiete Boolean algebra. On the right-hand side of the equalities, V , A, -, respectively mean disjunction, conjunction and negation of the truth-values 1 (true) and 0 (false). Since we shall look for the least solutions of equations in this algebra, we need a partial order in the set W, but defined in reverse direction to the one defined ordinarily: f < g iff (V’sE S) (g(s) = 1) implies f(s) = 1 (or, equivalently, f < g iff f A g = g). Consistently, zero .J_ and unit T members of the algebra are such tilat (Vs E S) ( _L(s) = 1) and (VS E S) (T(s) = 0). Indeed, I < f G T, for any f E W.

25 January 1988

In particular, (W, 6) is a complete partial order Moreover, considering any action x E X as a function from W defined by x(s) = s(x) and assuming X to be finite, we can state the following: (i) any member of (W, < ) is expressible by a Boolean polynomial, i.e., an expression built up of action na&mes,possibly barred, operators A, V, and parentheses, (ii) any such polynomial represents a member of (W, G). We are now in a position to define functions xc’ ‘) and xQx). Let (cpo).

C(x) =(a*b=

l

.. l c) + ... +(paq*

.a.

lr),

where (a*b* .*. *c),...,(p*q*

... or)

are all cause regions of action x and let E(x)=(k*d*...*m)+

. . +(u*v*...*w),

l

where (k+

lm),...,(u*v=

...

l

.= l w)

are all effect regions of x. Denote by X

a-b=

. . . ‘C

xk=F’-

. . . . .r

XP’9

,

,

X u-v-

. . . .m,

. . . .W

functions of type S + (0, l}, being the least (with respect to our partial order < ) solutions of the following functional equations: a-b.

...

lc

X

=KA(a,V A

(b,

.*. V -

A (ccv

l

l

Va,p)

vb&

A ---

- - VC,f), l

. . . xP’q

. . . . .r

=KA(p+

*a* vpP’)

A(qQV A(r,V Xk-P*

. . . .,n

=xA(kKV

/\(dLV

l

--*

Vq&\

..

Vr,t),

-a-

.*.

A (mM V -0.

--’

(i )

vkK’) VfL’)A

--.

Vm”‘),

. . . 315

X U’V.

...

=xA(u”V

.W

l

A(vVV A

25 January 1988

INFORMATION PROCESSING LETTERS

26, Number 6

Volume

l

(wWv

a*

cause

vu”‘)

l

l

-* VVV’)A- - vwW’),

l

region a* b - - - .c iff xaob’ “* “(s) = 3 and passivated by its effect region k 9 I!‘* - lm iff = 1. The functional equations (1) xk=t’* . . . . &) formally express that an action x in a state s can be activated by its cause region a* b lc iff K(s) = 1 and every a, b, . . . , c can be passivated by at least one of its effect regions containing x (the same holds for cause region p q or). Likewise, x in state s can be passivated by its effect region k t!’ m iff x(s) = 1 and every k, +?, . . . , m can be activated by at least one of its cause regions containing x (the same holds for effect region u v 0 - 0~). Notice the indispensability of stipulation “. . . containing x”: without it, in the cause-effect structure (ax.y+Z, xa, ya, z”), action x in state s = (1, 0, 1, 0) could be activated, since a can be passivated by z, although not by x y. Activation of x would be caused by passivation of a, which would be caused by activation of z-an entirely inadequate causal dependence. l

along with all analogous equations defining unknowns

l

aA ,---, A’ ,--*, TR ,-*-, l-R',-.',kK ,-a-, kK’,-*-,

a

,‘.',WW',

WW

l

where A,. . . , A’ are all effect regions of a, containing x; B, . . . , B’ are all effect regions of b, containing x; . . . . K , . . . , ]K’ are all cause regions of k, containing x; L, . . . , L’ are all cause regions of r?, containing x, etc. Finally, xC(x) = Xa-b-

--- lc v

. . . vxp’q=

XUx)= Kk./. ... .m V ’ * vx,.,. l

*-* ‘r

, . .. .W’

Example. For the cause-effect structure

l

l

l

l

l

l

l

l

l

l

l

l

l

l

l

l

l

(2) {a,, b,,

$9 x aob+b*c) the equations are

Impact region of an action. Solving equations (1)

Xa=b

for, for example, xasb’ ‘*’l’ one gets a Boolean polynomial of variables Z, a, b, . . . , c and, perhaps, some others. For example, in the latter example:

Xb*c

=

ax

=xAa,Ab,, b,Ac,,

=xA

a A xamb,

b, = b A (xagb v CX

X

=

X xbeC),

A xboc,

c

a=b+b*c

=

X

a-b v Xb*c_

Comments. (1) These functional equations are di-

rectly obtained from a given cause-effect structure. The method of their solving is simple: by ordinary elimination of unknowns, provided that there are a finite number of equations. However, there is no need to confine to finite systems, because functions xaob’ .**l c, xk+ ... .m, ... exist in the cpo ((0, l?“, <) even if it were infinite, since operators A and V are continuous and the overbar is not regarded to be an operator in the cpo: no function, except for individual variables x, y, * 9 may be barred. (2) The functional equations (2) formally express that an action in a given state can be activated (passivated) iff it can be activated (passivated) by at least one of its cause (effect) regions. Action x in a state s can be activated by its l

316

l

a-b

=XAaAb

V KAaAbAc.

Since XAaAbGKAaAbAc, we have that X

a*b

=KAaAb

and likewise X

b-c

=Yi

A cAb.

On the other hand, b,=bAaAE

V

bAcA%

cannot be reduced, since functions b A a A Szand b A c A E are incomparable by < . The sets {b, a, x} and {b, c, x} are called impact regions of x induced by d l‘: and b c respectively. They are also impact regtons of b, induced by x. In general, let f V g V V h be a Boolean polynomial in disjunctive normal form, so the terms f, g,. ‘. , h are of the form x A y A - A z where every factor xv Y, . . . , z is an action symbol, possibly barred. If, l

l

l

l

l

l

INFORMATION PROCESSING LETTERS

Volume 26, Number 6

for example, f < g, then g may be discarded since fvgv .*. vh=fv a=* vh. We say that fvg V - - V h is reduced if no two terms are comparable by < . Let

25 January 1988

A reachable state (from a state) is defined in the obvious way.

l

X

a-b-

““‘=fvgv

. . . i/h,

in reduced disjunctive form, be the least solution of equations (1). Let I,, I,, . . . , I, be sets of actions whose symbols occur in f, g,. . . , h, respectively. These sets are called impact regions of x, induced by a*b* ... lc. Such a set, for example I,, is said to be enabled in a state s iff f(s) = 1. Likewise the impact region of x, induced by x’s effect region is

defined. An impact region of x induced either by x’s cause or effect region is called x’s impact region. Obviously. (i) .4ction x belongs to each *f its impact regions. (ii) For any state s, an ;tion x can change its status in s iff each action from at least one of x’s impact regions can. (iii) If an action y is outside x’s impact region. then activability/passivability of y is independent of that of x. 3.1.2. Loca; state transition rule Activation of action x in a state s may occur iff x’(‘)(s) = 1, which means that, for at least one lc of x, we have that cause region a 0b a.b. ....c (s)= 1. To activate x in s proceed as X follows: (1) Select exactly one cause region a b q - lc of x, such that xaob’ *.’“(s) = 1. (2) Select exactly one impact region of x induced by a*be .a lC and enabled in s. (3) Invert the status of ,every action from the selected impact region. The procedure with passivation goes likewise: merely replace causes with effects. An impact region I may be seen as the following ‘next-state’ partial function F, : S + S. F,(s) is undefined iff a certain x E I is not activable/passivable in state s. Otherwise, l

l

l

l

l

l

h(s)(x)

=

x(s)

for x E 9,

i x(s)

for x 4 I.

l

l

3.2. Global activity of cause-effect structure In accordance with the above rule: (1) exactly one impact region of an action is selected to change its state, (2) all actions in the selected set change their status simultaneously-we say: it inverts its state-and, (3) this change has no impact outside it. Thus, the proper entity undergone a local activity is an impact region rather than a single action and simultaneity is defined among actions, not among impact regions. We say that distinct impact regions I and I’ (perhaps of distinct actions) conflict if there is an x E-I n I’ such that I and I’ are both impact regions of x induced by one or more of x’s cause region(s) or by one or more of x’s effect region(s). 3.2.1. Global state transition rules Global activity of cause-effect structure will be described iff it is said which impact regions can invert their states concurrently, i.e., in such a way that the final state resulting from their inversion does not depend on the order in which they are being inverted (in particular, they can invert their states ‘simultaneously’-informally speaking this time, with the same result). We can distinguish two global activity rules: (1) All impact regions from an arbitrarily cho-

sen family of nonconflicting and enabled (in a state s) ones invert their state. (2) All impact regions frzn an arbitrarily chosen maximal (with respect to C) set of nonconflicting and enabled (in a state s) ones invert their state. These rules correspond to ARB and MAX semantics respectively [6].

4. Relation of cause-effect ctmctures to condition/ event Petri nets We assume the reader to be familiar -*ith Petri nets, but we fix the notation: the structure of a net is a triple (P, T, F), where P is a set of places, T is a set of transitions (P n T = fl)? and F C P X T U 317

Volume 26, Number 6

Tx P tively

INFORMATION

PROCESSING

25 January 1988

LETTERS

a set of arrows. By lx and x’ we respecdenote a preset and a postset of X E P U T, is

X

i.e., ‘x = (y : (y, x) E F),

Yw.2

W+Z

I>(I 0

0

w

zx+y

X*Y

x’= (y:(x,y)~F).

Fig. 3.

A net is a condition/event (c/e) net iff: (i) functions M : P + (0, 1) are its markings, and (ii) a marking M’ follows from M in effect of firing transition t E T iff (vx E ‘t, y E t’)(M(x) = M’(y) = 1 A M(y) = M’(x) = 0) (next marking rule). This definition of a c/e net is equivalent to the original one (in terms of so-called cases and their transformations) where places are called conditions and transitions are called events. In the activity of a c/e net, we can make observa:i~ns either of its event occurrences or of its condition holdings. Confining to condition holdings, we have the following direct correspondence between c/e nets and cause-effect structures. Conditions in c/e nets correspond to actions in cause-effect structures, whereas events in c/e structures correspond to impact regions. Given a cause-effect structure, the construction of a behaviourally equivalent c/e net proceeds as follows. For any action x, find all x’s impact regions induced by x’s cause regions and let every such impact region be an event in the c/e net; make arrows going from these events to x; proceed similarly with x’s impact regions induced by X’S elfect regions, but make arrows from x to the found events. Given a c/e net ( P, T, F), the construction of the behaviourall;’ equivalent cause-effect structure (X, C, E) proceeds as follows: X = P,

5. Examples (1) Cause-effect structure (x,+,, wxoy, yW.,, z’+~) is depicted in Fig. 3. Its semantic equations (1) and (2) are given as XW= x A wX’Y, wx’Y

=

GA x,

Y\Y.Z= y A

A ,v~.~,

wxwy A zy,

Xz =xAzX, zx =ZAxxz, zY = ii A Y,,,.~,

Xw+z = x, v x,, zx+Y= zx v ZY” The least solution is given as XW

=

x,=zx

wxgy

=

yw_

=

zy

=

x

A y A WA&

=xAZ,

Xw+z = zx+Y=

xAyA%Aa.

V

xAii=xA%

Comments. The equations are solved by elementary elimination of the unknowns. On the other hand, the solution can directly be read off from the cause-effect structure if its semantics is well understood. There are two impact regions: (x, y, w, z] and (x, z}. For example, in state s = (0, 1, 0, l), no action can change its status since Xw+z0S = wX’Y(s)= y,.,(s) = ZXfY(S)= 0.

C(x)= (‘t:tET/ixC-t’), E(x)= (t’:tETAxE’t), for every x E X. The behavioural equivalence of a cause-effect structure and corresponding c/e net consists in that the local state transition rule and the next marking rule lead, in the evident sense, to the same results. 318

X

w

W+Z

Y w*z

0

0

W

x.y

Fig. 4.

z

X’Y

INFORMATIOM ?ROCESSING LETTERS

Volume 26, Number 6

(2) Cause-effect structure (x,+,, wxmy, y%_, zxoy) is depicted in Fig. 4. Its semantic equations (1) and (2) are given as

xw= x A *w

wX’Y,

= -

WAX, A X0!,

=yAIV YV.I*Z .&d-Y = -

z A x,

xz= x X

zx'Y,

ylJ/=z,

A zxoy,

=x,

W-l-2

A

yw-z,

A

v

=X =

W x,

=

WX’Y

=

y,.,

=

ZX’Y

0S = wX’Y(s)= ywJs)

=

zX’Y(s)= 1.

(3) Cause-effect structure (xy_, y,“, zxgy) is depicted in IFig. 5. Its semantic equations (1) and (2) are given as $Z = x A yx A zxgy, y"= fY

y =

A

x0 =j?,

xg=x,

YB =y,

Y@=Yv

zg = z,

z0 =z,

uB =ii,

IQ”&

&BI=G,

wpw,

.?

=xAyA%Az.

Conrments. There is only one impact region: (x, y, w, z]. Fassivation of action x by its effect region (w) enforces passivation by its other effect region (z) and vice versa. Only in state s = (3,0, 1,O) the structure may work since, only then, X W+Z

of deadlock is a structural one: for no state, the system may work. Another yort of deadlock occurs when in certain states a system cannot work. (4) Cause-effect structure ix, y, z, u, w), in WI+& every action is independent, represents a chaos. It equations (and their least solution)

x,.

The least solution is given as X w+z

25 January 1988

xy.zr

x0,

etc.

denote functions indicating activability and passivability of action x with no causes and no effects. Note that in all former examples we have omitted superscripts and subscripts if they were p(.

Acknowledgment I have had numerous discussions on the subject presented here with the following of my colleagues: Jarek Deminet, Leszek Holenderski, Jarek Kania, and Andrzej Szalas. They all contributed to the development of the concept of cause-effect structure.

2 A yz A Xy-zr

yz = y A zxgv.

References

The least solution is given as xy.z = yx = z X-Y

=

111W. Brauer, ed., Net Theory and Applications,

Y,=T.

Comments. Recall that (Ws)(T(s) = Q). This sort

[2]

[If] [4] [5]

Lecture Notes in Computer Science, Vol. 84 (Springer, Berlin, 1980). V.G. Cerf, Multiprocessors, Semaphores, and a Graph Model of Computation, PhD. Thesis, Dept. of Computer Science, Univ. of California, Los Angeles, April 1972. C.A.R. tloare, Communicating sequential processes. Comm. ACM 21 (8) (1978) 666-777. R.M. Karp and R.E. Miller, Parallel program schemata, J. Comput. System Sci. 3 (4) (1969) 167-195. R. Mimer. A Calculus of Communicating Systems, Lecture Notes in Computer Science, Vol. 92 (Springer. Berlin.

1980). ]6] A. Salwicki and T. Miildner, On the Algorithmic Properties of Concurrent Programs, Lecture Notes in Computer Sciexe, Vol. 125 (Springer, Berlin, 1981). 319