~q O P E R A T I O N A L SEMANTICS F O R CSP (Extended Abstract) Gordon Plotkin The p r e s e n t work is intended to illustrate semannics of p r o g r a m m i n g CSP, of communicating languages. sequential a method of giving the operational As an example a v a r i a n t of Hoare's processes is considered [Hoa]. At the same time some attempt is made to develop an approach to language analysis guiding principle of simplicity of the abstract syntax. language, following a This idea is independent of the semantic m e t h o d used and can just as well be combined with other approaches, such as that of d e n o t a t i o n a l The o p e r a t i o n a l <F,T,+>, of semantics. semantics employs the well-known where F (ranged over b y y) is a set of configurations final configurations configuration and ÷ c F x F is the t r a n s i t i o n new is the specification induction on the abstract !o <C0~> <C0~g> ÷ <C0;Cl~> Dijkstra~s principle relation. and define the transition relation by structural <Co';Cl,g'> g' ÷ <Cl,a'> of simplicity we try to minim~se CSP [Dij]. Applying our the number of syntactic categories way and take guarded commands that for example if b is a Boolean e x p r e s s i o n another a p p l i c a t i o n What is For this we follow the syntax by means of such rules as: guarded command language underlies in a non-artificial further any ÷ <C0~'C~> <C0;Cl,g> + 2. A typical (no c o m m a n d left to be executed). of the transition m o d e r n emphasis on structure systemsn and T c F is the set relation. could be <c~0>, where c is a c o m m a n d and ~ is a store; store u could be a final configuration Sequence idea of transition as 5eing themselves commands and c is a c o m m a n d so is b + c. we do not wish to a l l o w n-ary syntactic constructions so As (for every n) as implied by this syntax for conditions: __if b I + C 1 ~ Rather we regard this~ [ [ ~ b n + Cn --fi for each n, as a composite the above binary guarding and a unary conditional ..o construction, if c fi. c::= a I skip abort (= derived) The syntax for commands I c;e I if c fi construction b + c, a Dinary choice c o n s t r u c t i o n I b => c I fail I do c o d is then I c ~ c 1 from c Q c 251 where a r a n g e s over p r i m i t i v e actions and h => c is a strong g u a r d i n g construction, useful for concurrency, w h i c h does not a l l o w a n y interruption by any p r o c e s s b e t w e e n the t e s t i n g of b and the first action of c. The above w e a k g u a r d i n g can be d e r i v e d from the strong one by: b ÷ c = def b => nil; c This can be e x p r e s s e d b y the rules: Guarding i. <c, ~> ÷ y <b => c,o> + 7 (if b is true in ~) 2. <b => c,a> ÷ failure (if b is false in o) w h e r e failure is a n e w c o n f i g u r a t i o n standing for failure. are s p e c i f i e d a l o n g similar lines The other constructs (and another n e w configuration, abortion, is needed). The advantage of the strong g u a r d i n g is that it allows the r e s o l u t i o n of c o m p l e x g u a r d e d commands in CSP c o n t a i n i n g input commands, into h => such as b~ A ? x ÷ c, (A ? x; c) and that in turn avoids the r e d u n d a n c y of input commands a p p e a r i n g in two places in the syntax. The most complex construct in CSP is the p a r a l l e l c o m m a n d [Pl::c11[---llPn::Cn] where, of course, the c. can p e r f e c t l y well c o n t a i n further p a r a l l e l commands. l We v i e w this as a b l o c k (with II r e p l a c i n g ~) and r e g a r d the p r o c e s s identifiers, Pi' as analogous to label identifiers; then the scope of the Pi can he taken, f o l l o w i n g the U s u a l rules, as the whole of the block. With this idea we can analyse the p a r a l l e l conlmand into a binary p a r a l l e l construction, cIle and a u n a r y labelling c o n s t r u c t i o n P::c and a b i n a r y d e c l a r a t i o n c o n s t r u c t i o n p r o c e s s P~c as follows p r o c e s s PI~...; p r o c e s s Pn ~ begin P1::cl ii---[I ~ ::c n n end (where begin ... end are just a pair of brackets). And we have a simple syntax for CSP C: := (guarded c o m m a n d construction) c II e I P::c I process P; c I P?r I Q.'w I 252 where r ranges o~er a n d we have o m i t t e d processes. a set o f input o p e r a t i o n s certain details and w over a set of o u t p u t o p e r a t i o n s relating We h a v e a l s o o m i t t e d v a r i a b l e to n o n - i n t e r f e r e n c e declarations, between parallel process arrays or g u a r d e d c o m m a n d s w i t h ranges. For the o p e r a t i o n a l transition and ÷c systems, semantics <r,T,M,+> w i t h their intuitive for the g u a r d e d - an i n t e r n a l idea of l a b e l l e d (= c o m m u n i c a t i o n s ) are t h e same as before, F o r C S P the a p p r o p r i a t e but messages are: a c t i o n of a p r o c e s s P ? v - P sends v to an u n k n o w n Q I v - an u n k n o w n P,Q commands for the messages. meanings P,Q ? v - Q r e c e i v e s the w e l l - k n o w n w h e r e n o w M is a set of m e s s a g e s F × M x F.. The r u l e s w i t h an m above the a r r o w s we e m p l o y agent agent sends a value v to Q v from P I v - P sends v to Q. Here are some t y p i c a l Output <Q rules Q:v ~ w,0>-=---9~ Labelling <c~0> P?v (where v is the v a l u e )<ca j,> transmitted b y w given store ~) (if P # Q) < Q : : c , ~ > "-p'Q?V 2 < Q : : c ' , ~ ' > p~ Communication <C0'G> p,Q?v ~<c0, <%1 lh,o> This t r e a t m e n t w o u l d require omits cQnsideration a little the c o n f i g u r a t i o n s , additional of Hoare's this k i n d of o p e r a t i o n a l s p e c i f y one step of e x e c u t i o n s are m a n y choices choice semantics in general and does not in g e n e r a l which these are i n t e n d e d to to b e the and the usual d e n o t a t i o n a l semantics. and do not say h o w to p u t these t o g e t h e r for two such b e h a v i o u r s and we r e m a i n n e u t r a l semantics specify convention, F i n a l l y we note a g r e a t d i f f e r e n c e or w h a t it means denotational )<cl, O > (One adds a t h i r d c o m p o n e n t labels; processes.) between o t h e r h a n d any normal termination complication. We o n l y to m a k e up g l o b a l b e h a v i o u r s .,Q.v ~ ><e0'IIh',°'> n a m e l y a set of p r o c e s s set of labels of all t e r m i n a t e d There ~><Cl,0 ~ between both automatically all the d e t a i l s to be equal. them. On the reflects of the e x e c u t i o n such a sequences. References [Dij] Dijkstra, [Hoa] Hoare~ C.A.R~ (1978) No. 8, 666-677. E.W. (1976) A Discipline Communicating of Programming. Sequential Prentice-Hall. Processes~ CACM, vol. 21,
© Copyright 2026 Paperzz