Laboratoire de Mathématiques et Informatique pour la Complexité et les Systèmes, CentraleSupélec, 9 rue Joliot-Curie, Gif-sur-Yvette, Francehttps://orcid.org/0000-0002-5322-4337 Laboratory of Systems Requirements and Conformity Engineering, CEA-LIST, P.C. 174, Gif-sur-Yvette, Francehttps://orcid.org/0000-0001-6865-5108 Laboratoire de Mathématiques et Informatique pour la Complexité et les Systèmes, CentraleSupélec, 9 rue Joliot-Curie, Gif-sur-Yvette, Francehttps://orcid.org/0000-0002-8955-6835 \CopyrightErwan Mahe and Chritophe Gaston and Pascale Le Gall {CCSXML} <ccs2012> <concept> <concept_id>10003752.10010124.10010131.10010133</concept_id> <concept_desc>Theory of computation Denotational semantics</concept_desc> <concept_significance>300</concept_significance> </concept> <concept> <concept_id>10003752.10010124.10010131.10010134</concept_id> <concept_desc>Theory of computation Operational semantics</concept_desc> <concept_significance>300</concept_significance> </concept> <concept> <concept_id>10003752.10003753.10003761.10003764</concept_id> <concept_desc>Theory of computation Process calculi</concept_desc> <concept_significance>300</concept_significance> </concept> </ccs2012> \ccsdesc[300]Theory of computation Denotational semantics \ccsdesc[300]Theory of computation Operational semantics \ccsdesc[300]Theory of computation Process calculi \hideLIPIcs\EventEditors \EventNoEds1 \EventLongTitle \EventShortTitle \EventAcronym \EventYear \EventDate \EventLocation \EventLogo \SeriesVolume \ArticleNo
A structural operational semantics for interactions with a look at loops
Abstract
Message Sequence Charts & Sequence Diagrams are graphical models that represent the behavior of distributed and concurrent systems via the scheduling of discrete and local emission and reception events. We propose an Interaction Language (IL) to formalize such models, defined as a term algebra which includes strict and weak sequencing, alternative and parallel composition and four kinds of loops. This IL is equipped with a denotational-style semantics associating a set of traces (sequences of observed events) to each interaction. We then define a structural operational semantics in the style of process algebras and formally prove the equivalence of both semantics.
keywords:
interactions, sequence diagrams, distributed & concurrent systems, formal language, denotational semantics, operational semantics, loopcategory:
\relatedversion1 Introduction
Specifying the behavior of distributed and concurrent systems is the object of a large literature. In particular modelling asynchronous communications between concurrent processes is possible under a variety of formalisms, including process algebras [18], Petri Nets [4], series-parallel languages [9], distributed automata [1], or formalisms derived from Message Sequence Charts (MSC) [14]. In the context of this paper, we focus on the latter. MSCs are graphical models which represent the exchange of information between sub-systems. Various offshoots of MSCs, which notably include UML Sequence Diagrams (UML-SD), have been proposed and we may call languages from that family "Interaction Languages" (IL). Interactions are particularly interesting due to their graphical nature and ease of understanding.
In order to use interactions for formal verification, they have to be fitted with formal semantics. A major hurdle in defining those lies in the treatment of weak sequencing. In a few words, weak sequencing allows events taking place on different locations to occur in any order while strictly ordering those that take place on the same location. The survey [15] provides an overview of solutions found in the literature. Those can be roughly categorized as follows: (a) direct denotational semantics, which define the trace semantics of interactions directly. They either rely on partial order sets [19, 13] or algebraic operators [7]; (b) semantics by translation, which rely on translating interactions into some other models such as Petri Nets [3] or automata [8] and then use (generally operational-style) semantics of those other formalisms and; (c) direct operational-style semantics, which notably include that of [14].
While approaches in (c) are highly valuable for defining algorithms for formal verification, approaches in (a) are adapted to reason about interactions and their properties. Our contribution provides a framework encompassing (a) and (c) based on an IL which includes strict and weak sequencing, alternative and parallel composition and four semantically distinct loops. We propose a denotational-style semantics extending that of [7] with the addition of repetition operators in the form of variants of the algebraic Kleene closure. We also define a structural operational semantics in the fashion of process algebras [2] with a particular care for the handling of weak sequencing and which uses dedicated rules to address the various loops. The equivalence of both semantics is formally proven (with an automated proof made with Coq available in [11]). Languages such as MSC or UML-SD only propose a single loop construct. By contrast, our contribution highlights the use of distinct loops to express nuances in the repetition of behaviors.
This paper is organized as follows: Sec.2 introduces the concept of interactions and traces. Sec.3 defines repetition operators on sets of traces. Sec.4 presents the syntax of our IL and defines a trace semantics in denotational-style using operators introduced in the previous sections. Sec.5 defines a structural operational semantics on interactions with loops in the style of process calculus. In Sec.6, we demonstrate the equivalence of both semantics. Finally, in Sec.7 we discuss some related works and we conclude in Sec.8. Detailed demonstrations are included in the appendix.
2 Basic interactions & intuition of their meaning
Interactions describe the behavior of distributed and concurrent systems through the perspective of their internal and external communications. They are defined up to a signature where is a set of lifelines and is a set of messages. Lifelines are abstractions of sub-systems, or groups of sub-systems while messages represent data sent and received by sub-systems.
2.1 Preliminaries
The executions of systems are characterized by sequences of events called communication actions (actions for short) which are of two kinds: either the emission of a message from a lifeline , denoted by , or the reception of a message by a lifeline , denoted by . We note the set of actions defined up to . For any such action , denotes the lifeline on which occurs.
Sequences of actions from , called traces, are words in , with "." denoting the classical concatenation law and being the empty word (empty trace). We denote by the set of traces. Thus, for any two traces and , is the trace composed of the sequence of actions of followed by the sequence of actions of .
We now introduce operators111We use notations from [7]. to compose traces. Those operators model different notions of scheduling: the interleaving () and the weak sequencing ().
The set of interleavings of traces and is defined by:
Interleaving allows elements of distinct traces to be reordered w.r.t. one another while preserving the order that is specific to each trace. By contrast, weak sequencing only allows such permutations when actions do not occur on the same lifeline. Defining weak sequencing requires introducing a predicate: for any trace and lifeline , the predicate means that contains at least an action occurring on (we say that has conflicts w.r.t. ). It is defined as follows:
The set of weak sequencing of traces and is defined by:
The previous binary operators (".", "" & "") defined on traces are canonically extended to sets of traces as follows. Given and two sets of traces, denotes the set of all traces s.t. and . Likewise, with , is the union of all the sets s.t. and . By choosing ";" for denoting the extension of "." to sets of traces, we adopt the same notation as in [7]. ";" is called the strict sequencing operator. The use of the strict sequencing (";"), weak sequencing ("") and interleaving ("") operators is illustrated on the right of Fig.1 so as to compute the semantics of an example interaction. For instance, weak sequencing allows to be reordered before but not before while interleaving allows to be placed anywhere w.r.t. and .
2.2 Basic interactions
Interactions can be drawn as "sequence diagrams" of which an example is given in the left of Fig.1. Lifelines are drawn as vertical lines. Emission and reception actions are drawn as horizontal arrows carrying the transmitted message and which respectively exit the emitting lifeline or point towards the receiving lifeline. When a direct emission-reception causality can be identified we draw both actions as a single arrow from the emitter towards the receiver.
The top to bottom direction relates to the passing of time. An action (arrow) drawn above another generally occurs beforehand. This scheduling of actions corresponds to the weak sequencing operator. By contrast, strict sequencing may be used to enforce precedence relations between actions occurring on different lifelines. In Fig.1, the arrow carrying and specifying its passing between and is modelled by the interaction . The fact that this arrow stands above that carrying can be modelled using the weak sequencing operator: . Using here instead of allows for instance to occur before even though the latter is drawn above. However cannot occur before because they both occur on .
Parallel and alternative compositions can also be used to specify more complex behavior. On Fig.1, the passing of and the emission of are scheduled using parallel composition. In the diagram representation this corresponds to the box labelled with "par". This can be modelled with the term . Actions scheduled with can occur in any order w.r.t. one another. Here, can occur before , after or in between those two actions. Alternative composition proposes an exclusive non-deterministic choice between behaviors. Like , is drawn as a box labelled with "alt".
![]() |
3 Repetition operators in the semantic domain
Scheduling operators define compositions of traces obtained from enabling or forbidding the reordering of actions according to some scheduling policy. All three are associative (in addition, is commutative) and admit as a neutral element. As a result, we can define (Kleene) closures of those operators to specify repetitions.
Definition 3.1 (Kleene closures).
For any and any ,
the Kleene closure of is defined by:
The three Kleene closures , and are respectively called, strict, weak and interleaving Kleene closures.
Within the K-closure we can find traces obtained from the repetition (using as a scheduler) of any number of traces of . In the example from Fig.2 we consider a set containing two traces and . The first 3 powersets of (i.e. ) are displayed, the rest of the weak K-closure of (i.e. ) is represented by the .
Let us remark a useful property of the K-closures which is that .
Given a scheduling operator whenever (with and any action and trace and and any sets of traces), it may be so that action is taken from a trace that belongs to either or . In Def.3.2, we define restricted versions of the scheduling operators so as to impose action to be taken from .
Definition 3.2 (Restricted scheduling operators).
For any , we define the operator such that for any sets of traces and we have:
As an example, given and , we have:
We use the restriction on operators to define Head-First closures (abbr. HF-closure) of scheduling operators in Def.3.3.
Definition 3.3 (Head-first closures).
For any , we define the Head-First closure of as i.e. the Kleene closure of the restricted operator.
In the following we will show that HF-closure and K-closure are equivalent for ; and but that this is not the case for .
Lemma 3.4.
For any , , in and we have:
Proof 3.5.
By induction on given . In the case of we use its commutativity.
Lemma 3.6 (Equivalence of HF & K closures for ; & ).
For any set of traces :
Proof 3.7.
By induction on a member trace .
Let us detail a counter example showing that the weak K-closure and the weak HF-closure are not equivalent. Given , let us consider the powerset of . By definition, . Here we can choose to take as a first action and therefore . However, . Also, we have for any smaller or greater that . This can be explained by not having the correct actions and/or not the right numbers of actions to reconstitute . As a result and hence . This example will be further illustrated in Sec.5.4 with the help of the operational semantics.
4 Syntax & denotational semantics
Interactions terms are defined inductively. Basic building blocks include the empty interaction which specifies the empty behavior (observation of no action) and any atomic action , which specifies the single-element trace (observation of ). More complex behavior can then be specified inductively using:
-
•
binary constructors, which are , , and (introduced in Sec.2.2)
-
•
unary constructors, which are (the strict loop), (the head loop up to the weak sequencing operator), (the weak loop) and (the parallel loop)
Definition 4.1 (Interaction Language).
We denote by the set of terms inductively defined by the set of operation symbols s.t.:
-
•
symbols or arity (constants) are
-
•
symbols of arity are
-
•
symbols of arity are
In Def.4.1 we define our Interaction Language (IL) as a set of terms inductively defined from a finite set of symbols provided with arity in . The set of sets of traces admits the structure of a -algebra using operators introduced in Sec.2 and Sec.3. The denotational semantics of interactions is then defined in Def.4.2 using the initial homomorphism associated to this -algebra.
Definition 4.2 (Denotational semantics).
is the -algebra defined by its carrier and the following interpretations of the operation symbols in :
The denotational semantics of is the unique -homomorphism between the free term -algebra222The free term -algebra is defined by its carrier and by interpreting operation symbols of as constructors of new terms: for of arity , for , is interpreted as itself. and .
The semantics of constants and are sets containing a single element being respectively and . The , , and symbols are respectively associated to the ;, , and union operators on sets of traces. Their use is shown on Fig.1. On the right of Fig.1, we detail the semantics of the interaction drawn on the left. The resulting set of traces is given on the bottom right. , , , are semantically distinct (as shown on simple examples in [13]). From a system designer perspective, using either loop is motivated by different goals:
-
•
With , each existing instance of a repeatable behavior (specified by ) must be executed entirely before any other can start. This implies that, at any given moment there can only exists zero or a single instance. can therefore be used to specify some critical repeatable behavior of which there can only exist one instance at a time.
-
•
With , all existing instances can be executed concurrently w.r.t. one another, and, at any given moment, new instances can be created. can therefore be used to specify protocols in which any number of new sessions can be created and run in parallel.
-
•
With , new instances can be created whenever the action triggering the instantiation occurs on a lifeline which is not occulted by previous instances. This can be roughly explained as follows: (1) on each individual lifeline only one instance can be active and (2) given that, for any such instance, a lifeline might "have finished" before the others then it is allowed to start another instance. can therefore be used to specify repeatable behaviors that are sequential but that have no enforced synchronization mechanisms.
-
•
The head loop is associated to the weak HF-closure operator which is an ad-hoc algebraic artifact and not a K-closure. We include it in our IL because it might correspond to a more intuitive understanding of sequential loops than , as illustrated in Sec.5.4.
5 A structural operational semantics
In this section we present a structural operational semantics for interactions in the style of process calculus [2]. It relies on the definition (by structural induction) of two predicates: "" (the termination predicate) indicates that interaction term accepts the empty trace and "" (the execution relation) indicates that traces such that is accepted by are accepted by . We define in Sec.5.1. The relation allows the determination, for any interaction , of which actions can be immediately executed, and, of potential follow-up interactions which express continuations of traces accepted by . Defining an execution relation is a staple of process calculus [2]. However, as we want to define such a similar relation for our IL, particular care is needed when dealing with weak sequencing. Hence we introduce intermediate notions in Sec.5.2 before defining in Sec.5.3.
5.1 Termination
By reasoning on the structure of an interaction term , we can determine whether or not the empty trace belongs to its semantics. When this holds, we say that terminates and use the notation as in [2]. is defined as an inductive predicate in Def.5.1 and its characterization w.r.t. the semantics of interactions is given in Lem.5.2.
Definition 5.1 (Termination).
The predicate is s.t. for any and from , any and any we have:
All rules of Def.5.1 are evident. The empty interaction only accepts , and thus terminates. An interaction with a loop at its root terminates because it is possible to repeat zero times its content. As specifies a choice, it terminates iff either or terminates. An interaction of the form , with being a scheduling constructor, terminates iff both and terminate.
Lemma 5.2 (Termination w.r.t. ).
For any we have
Proof 5.3.
By induction on the term structure of interactions.
5.2 Dealing with weak-sequencing using evasion & pruning
Weak sequencing only allows interleavings between actions that occur on different lifelines. As a result, within an interaction of the form , some actions that can be executed in may also be executed in . In other words, given a trace , action might correspond to an action expressed by . This is however conditioned by the ability of to express traces that have no conflict w.r.t. so that may be placed in front of what is expressed by when recomposing .
In the previous section we have seen that the termination predicate states that interaction is able to express the empty trace. We define "evasion" as a similar, although weaker, notion than "termination" that can be described as a form of local termination. For a lifeline , we say that evades , denoted by , if accepts at least one trace that does not contain actions occurring on . Evasion is defined inductively in Def.5.4. For any and , it is always decidable whether or . We may then denote by the fact that and say that collides with .
Definition 5.4 (Evasion).
The predicate is s.t. for any and from , any , any , any and any we have:
The empty interaction evades any lifeline as contains no action. An interaction reduced to a single action evades iff does not occur on . As for termination, an interaction with a loop at its root evades any lifeline because it accepts . Choice and scheduling operators are also handled in the same manner as for the termination predicate.
Lemma 5.5 (Evasion w.r.t. ).
For any and ,
Proof 5.6.
By induction on the term structure of interactions.
Let us remark that, for any , if then , . Indeed, has no conflict w.r.t. any . However the opposite does not hold: it suffices to consider and and observe that , holds while does not.
The application of the evasion predicate (w.r.t. lifeline ) is illustrated on Fig.3. On the right is represented the syntaxic structure of an interaction , and, on the left, the corresponding drawing as a sequence diagram. On the syntax tree, the nodes are decorated with symbols \faCheckCircle to signify that the sub-interaction underneath that node evades or \faTimesCircle to indicate that this is not the case (i.e. that it collides with ). Starting from the leaves we can decorate all nodes and conclude once the root is reached. By taking the right branch of the alternative and by choosing not to instantiate the loop, we can see that accepts some traces that have no conflict w.r.t. lifeline (in our case, only the trace ). As a result the interaction verifies . On the diagram representation, evasion can be illustrated by drawing a line over the lifeline of interest. This line can be decomposed into several segments that correspond to specific areas of the diagram (operands) and that are colored either in green or in red. The coloration of the segment depends on whether the sub-interaction corresponding to the operand evades or collides with the lifeline of interest.
With evasion we can determine whether or not an action that is executable in i.e. s.t. is also executable in . However, this is not enough to define a rule which is compatible with the semantics . must specify continuations s.t. . By definition of , continuation traces have to be build from traces and such that and . By defining as the interaction which expresses exactly those traces s.t. we may produce a rule that is compatible with . The computation of is ensured by a process that we call pruning.
Pruning is defined as an inductive relation s.t. indicates that the pruning of w.r.t. yields . Pruning is defined so has to preserve "a maxima" the original semantics of so that is the maximum subset of that contains no trace conflicting with (see Lem.5.10).
Definition 5.7 (Pruning).
The pruning relation is s.t. for any , any and any :
Let us immediately remark that evasion and pruning are intertwined notions. Indeed, as per Lem.5.8 evasion is equivalent to the existence and unicity of a pruned interaction. We could define pruning without evasion. However, so as to draw parallels w.r.t. the termination predicate and in order to separate concerns and ease the understanding of proofs we have defined both notions separately.
Lemma 5.8 (Conditional existence & unicity for pruning).
For any and any :
Proof 5.9.
Immediate, by induction on the term structure of interactions.
Let us comment on the rules defining the pruning relation. We have because the semantics of being , there are no conflicts w.r.t. . Any action is prunable iff . In such a case, needs not be eliminated and thus . For to be prunable we must have either or both of or . If both branches evade they can be pruned and kept as alternatives in the new interaction term. If only a single one does, we only keep the pruned version of this single branch. For any scheduling constructor , if , in order to have we must have both and . In that case the unique interaction such that is simply defined as the scheduling, using , of the pruned versions of and . Finally, for loops, i.e. with , we distinguish two cases: (a) if then any execution of will yield a trace conflicting . Therefore it is necessary to forbid repetition; (b) if then it is not necessary to forbid repetition, given that can be pruned as with not expressing traces conflicting . This being the modification which preserves a maximum amount of traces, we have .
![]() |
![]() |
|
before pruning | pruning w.r.t | after pruning |
We have seen that the interaction of Fig.3 satisfies . Therefore Lem.5.8 implies the existence of a unique s.t. . Fig.4 illustrates the computation of . The blue lines represent the modifications in the syntax of that occur during its pruning into . On Fig.3 we decorated sub-interactions of with \faTimesCircle whenever they did not evade . During pruning, those sub-interactions must be eliminated given that the resulting term must not express actions occurring on . Hence, on Fig.4, we have crossed in blue the problematic sub-interactions. The root node is an . Let us note . On Fig.3 we have seen that we have and . Therefore we have with being such that . This selection of the right branch of the is illustrated on Fig.4 by the curved arrow which "replaces" the by the on its bottom right. There remains to determine s.t. . At the root of we have a . Let us note . As per Fig.3 we have both and and therefore such that and . Underneath , no actions occur on and hence . At the root of we have a . Let us note . As per Fig.3 we have and therefore which is illustrated on Fig.4 by the in blue, which "replaces" the by . Finally there remain , which is drawn as a SD on the right of Fig.4.
Lem.5.10 states that given , the pruned interaction exactly specifies all the executions of that do not involve .
Lemma 5.10 (Pruning w.r.t. ).
For any and any and from :
Proof 5.11.
By induction on the term structure of interactions.
In the next section we make use of pruning so as to formally define an execution relation for our IL and we use it to formulate a structural operational semantics in the style of process algebra.
5.3 Execution relation & operational semantics
A structural operational semantics, presented in the style of Plotkin [17] allows determining accepted traces such that through the assertion of a succession of predicates of the form representing the evolution of the system. By expressing action , the system goes from being modelled by to being modelled by . We present this execution relation "" as an inductive predicate, in a similar fashion as the pruning relation "".
Definition 5.12 (Execution relation).
The execution relation is s.t.:
The formulation of most of the rules is very similar to what can be found in process algebras. The notable differences mainly concern the rules handling weak sequencing and loops. In an interaction reduced to an action , may be executed with so that what remains to be executed is the empty interaction . If within , action can be executed in either or with either or then it may be executed in and the resulting interaction is either or . For , if we have either or then may be executed in and the resulting interaction naturally is either or . Executing actions on the left of either a or a follow the same rule as in the case of a because no precedence relations are enforced on the left-hand side. However, it is only possible to execute an action on the right of if terminates. Indeed, in that case may express the empty trace as per Lem.5.2 and nothing prevents to be the first action to be executed. The resulting interaction is then given that we force to express . Likewise, within there is a condition for executing an action on the right. This condition is that , which, as per Lem.5.8 is implied by the condition . Given s.t. we therefore have given that we prune the left sub-interaction and execute the action on the right sub-interaction.
The rules for , and reflect the definitions of the corresponding HF-closures which respectively are , and . Let us indeed consider . Whenever we have . As a result, any is s.t. for a certain . Given that , this corresponds to choosing action from the first iteration of the loop i.e. , which coincides with using the restricted operator as a scheduler. is explicitly associated to and thus the formulation of its rule is self-evident. In the case of and it is the fact that the HF and K-closures of ; and are equivalent (as per Lem.3.6) which enables their respective rules to be formulated in this manner.
The rule for allows for the first action of a trace to be taken from a later iteration of the loop. Let us consider and . The rule is formulated such that with and . Indeed, action is expressed by sub-interaction so there exists s.t. . Also, given that is a loop, it is always prunable (Lem.5.8) so there exists s.t. . The fact that translates into having . Then:
-
•
If is taken from the first iteration of the loop, then, given that (Lem.5.10) we have with a continuation of the first iteration s.t. .
-
•
If is taken from the second iteration of the loop, let us consider the first iteration and the second one (from which is taken and hence ). We then have and the condition . This condition implies, as per Lem.5.10 that .
-
•
The reasoning is the same when is taken from later instances. Let us indeed consider . We then have because is either a loop (and therefore absorbing) or the empty interaction (in that degenerate case all the are ) and hence the rules indeed allows to be taken from any iteration.
Definition 5.13 (Operational semantics).
is s.t.:
This execution relation then constitutes the small steps of the operational semantics that we define in Def.5.13.
5.4 Illustrative example
On Fig.5 we illustrate both the operational semantics and the counter-example from Sec.3 showcasing the difference between and . We consider repetitions of . On the first row we illustrate the construction of a trace accepted by where is repeated twice using weak sequencing. Here, the second occurrence of action (at the bottom) is immediately executable because, with pruning, we can force the choice of the right branch of the first alternative which evades . From that point on the execution of the remainder is straightforward, and, in total, we can conclude that the trace is expressed by . Now, if we were to try to reproduce this behavior using to repeat (i.e. with ) we would get what is illustrated on the second row of Fig.5. We can manage to execute the first action but from that point, the second action of which is is not executable. Indeed, the presence of at the top of the diagram prevents it to be executed. As we have indicated earlier (and by definition) is associated to the weak HF-closure and not to the K-closure . It is therefore expected that could not be accepted by in this example. However, as illustrated on the third row of Fig.5, can recognize . The addition of the pruned version of the loop allows one to delay the determination of the instance as part of which the initial is executed. In this case, the pruned loop is instanciated once, which means that was part of the second instance.
6 Proving the equivalence of both semantics
In the following we formally prove the equivalence of and . Details of the proofs are available in the appendix and a formalisation using Coq is available in [11].
Let us at first prove that for any interaction we have . The first step to do so is to characterize the execution relation "" w.r.t. , which we do in Lem.6.1.
Lemma 6.1 (Property 1 of w.r.t. ).
For any , and and from :
Proof 6.2.
By induction on the 13 cases that makes the hypothesis possible.
We then remark that Lem.6.1 and Lem.5.2 state that the semantics accepts the same two construction rules (that for the empty trace and that for non empty traces of the form ) as those that define inductively. As a result any trace that might be accepted according to must also be accepted according to . This implies the inclusion from Th.6.3.
Theorem 6.3 (Inclusion of in ).
For any we have
Proof 6.4.
By induction on a member trace .
Let us now prove the reciprocate, i.e. that for any interaction , . As in the previous case, we provide, with Lem.6.5, a characterization of "" w.r.t. . Lem.6.5 is, in a certain manner, the reciprocate of Lem.6.1.
Lemma 6.5 (Property 2 of w.r.t. ).
For any , and :
Proof 6.6.
By induction on the term structure of interactions.
Theorem 6.7 (Inclusion of in ).
For any we have
Proof 6.8.
By induction on a member trace .
We have therefore proven both inclusion and can conclude that the operational semantics is indeed equivalent to the denotational-style semantics .
7 Related works
The main inspiration for the syntax & denotational semantics of our IL is [7]. In [7], a semantics for interactions is formulated using operators on sets of traces. However, loops are not handled. In [14], an operational semantics for MSC is presented. Similarities between [14] and our work notably include the use of pruning which, in [14], relates to a "permission relation". However we have some major distinctions concerning which constructors are defined and how they are handled by rules of the semantics. In [14] loops are not handled and there is no constructor. Indeed, causal relations between actions occurring on different lifelines (e.g. emission-reception) are handled by maps that are updated during execution. In [15] a survey of formal semantics associated to UML-SDs is proposed. It is notable that UML-SDs are described semi-formally in the norm [16]. This allows for a rich language with operators such as or [5] which are not covered in our IL. However a full formalisation proves difficult, as explained in [15, 5]. As mentioned in the introduction, most approaches rely on translations towards other formalisms [3] or consist in denotational semantics [19] that are most often based on partial order sets. The extent to which UML-SDs are formalised may vary [15]; some works formalize loops [10], others do not [7], and some only allow finitely many iterations [19]. In all cases where there are loops, only one loop operator is proposed and may correspond to either or .
Earlier works of ours [13, 12] focused on the application of the operational semantics for formal verification. In particular we were interested in the static analysis of traces and multi-traces (sets of locally defined traces) against interaction specifications (the membership problem). In those works we have used an "algorithmicized" version of the operational semantics. The inductive predicates for , and the and relations were presented in functional style and we separated concerns between the determination of which actions are immediately executable (uniquely identified by their positions) and the execution of said actions. Novel contributions in this paper w.r.t. [13, 12] consist in the distinction of & , the formulation of the operational semantics in the style of process algebras and the proof of equivalence w.r.t. a denotational semantics (a Coq proof is available in [11]).
8 Conclusion & further work
In this paper we defined an IL for specifying the behavior of distributed and concurrent systems. This language includes weak and strict sequencing, parallel & alternative composition as well as four distinct loop operators to specify different kinds of repetition. We formulate the semantics of this IL: (1) in denotational-style, making use of composition & algebraic operators and (2) in operational-style by reconstructing accepted traces via the succession of atomic executions. The equivalence of both formulations is proven (Coq proof in [11]). As demonstrated in [13, 12], the operational semantics can be further exploited in formal verification techniques such as multi-trace analysis. Other techniques may be explored in further work, such as online testing, monitoring or test generation. In addition, we may also investigate enriching our language with some form of value passing i.e. instead of exchanging abstract messages we may interpret them concretely or symbolically with typed data. This last point is notably addressed in some process calculi frameworks [6].
References
- [1] S. Akshay, Benedikt Bollig, Paul Gastin, Madhavan Mukund, and K. Narayan Kumar. Distributed timed automata with independently evolving clocks. In Franck van Breugel and Marsha Chechik, editors, 19th Conf. on Concurrency Theory (CONCUR), pages 82–97, Berlin, Heidelberg, 2008. Springer Berlin Heidelberg.
- [2] J.C.M. Baeten. Process algebra with explicit termination. Computing science reports. Technische Universiteit Eindhoven, 2000.
- [3] Christoph Eichner, Hans Fleischhack, Roland Meyer, Ulrik Schrimpf, and Christian Stehno. Compositional semantics for uml 2.0 sequence diagrams using petri nets. In Andreas Prinz, Rick Reed, and Jeanne Reed, editors, SDL 2005: Model Driven, pages 133–148, Berlin, Heidelberg, 2005. Springer Berlin Heidelberg.
- [4] Serge Haddad and Igor Khmelnitsky. Dynamic recursive petri nets. In Ryszard Janicki, Natalia Sidorova, and Thomas Chatain, editors, Application and Theory of Petri Nets and Concurrency, pages 345–366, Cham, 2020. Springer International Publishing.
- [5] David Harel and Shahar Maoz. Assert and negate revisited: Modal semantics for UML sequence diagrams. Software and Systems Modeling, 7(2):237–252, 2008.
- [6] Anna Ingólfsdóttir and Huimin Lin. A symbolic approach to value-passing processes. In J.A. Bergstra, A. Ponse, and S.A. Smolka, editors, Handbook of Process Algebra, pages 427–478. Elsevier Science, Amsterdam, 2001. doi:10.1016/B978-044482830-9/50025-4.
- [7] Alexander Knapp and Till Mossakowski. UML Interactions Meet State Machines - An Institutional Approach. In 7th Conf. on Algebra and Coalgebra in Computer Science (CALCO), volume 72 of Leibniz International Proceedings in Informatics (LIPIcs), 2017.
- [8] Alexander Knapp and Jochen Wuttke. Model checking of uml 2.0 interactions. In Thomas Kühne, editor, Models in Software Engineering, pages 42–51, Berlin, Heidelberg, 2007. Springer Berlin Heidelberg.
- [9] Kamal Lodaya and Pascal Weil. Series-parallel languages and the bounded-width property. Theor. Comput. Sci., 237(1–2):347–380, April 2000. doi:10.1016/S0304-3975(00)00031-1.
- [10] Lunjin Lu and Dae-Kyoo Kim. Required behavior of sequence diagrams: Semantics and conformance. ACM Trans. Softw. Eng. Methodol., 23(2), April 2014. doi:10.1145/2523108.
- [11] Erwan Mahe. Coq proof for the equivalence of the semantics. erwanm974.github.io/coq_hibou_label_semantics_equivalence/. Accessed: 2021-04-29.
- [12] Erwan Mahe, Boutheina Bannour, Christophe Gaston, Arnault Lapitre, and Pascale Le Gall. A small-step approach to multi-trace checking against interactions. In Proceedings of the 36th Annual ACM Symposium on Applied Computing, SAC ’21, page 1815–1822, New York, NY, USA, 2021. Association for Computing Machinery. doi:10.1145/3412841.3442054.
- [13] Erwan Mahe, Christophe Gaston, and Pascale Le Gall. Revisiting semantics of interactions for trace validity analysis. In Heike Wehrheim and Jordi Cabot, editors, Fundamental Approaches to Software Engineering, pages 482–501, Cham, 2020. Springer International Publishing.
- [14] Sjouke Mauw and Michel Adriaan Reniers. Operational semantics for msc’96. Computer Networks, 31(17):1785–1799, 1999. doi:10.1016/S1389-1286(99)00060-2.
- [15] Zoltán Micskei and Hélène Waeselynck. The many meanings of uml 2 sequence diagrams: a survey. Software & Systems Modeling, 10(4):489–514, 2011.
- [16] OMG. Unified Modeling Language v2.5.1. omg.org/spec/UML/2.5.1/PDF, 12 2017.
- [17] Gordon Plotkin. A structural approach to operational semantics. The Journal of Logic and Algebraic Programming, 60-61:17–139, 07 2004. doi:10.1016/j.jlap.2004.05.001.
- [18] Arend Rensink and Heike Wehrheim. Weak sequential composition in process algebras. In Bengt Jonsson and Joachim Parrow, editors, 5th Conf. on Concurrency Theory (CONCUR), Lecture Notes in Computer Science, pages 226–241. Springer, 1994. doi:10.1007/BFb0015012.
- [19] Harald Störrle. Semantics of interactions in uml 2.0. In IEEE Symposium on Human Centric Computing Languages and Environments, 2003. Proceedings. 2003, pages 129–136, 10 2003. doi:10.1109/HCC.2003.1260216.
Appendix A Proofs of section 3
Lemma (Lem.3.4).
For any , , in and we have:
Proof A.1.
By definition of the K-closure, implies the existence of s.t. . We can then reason by induction on the power :
-
•
we cannot have because
-
•
if then and therefore the property holds
-
•
if the fact that implies the existence of s.t. then:
-
–
if this implies that:
-
*
either is of the form and and therefore
-
*
or and and we can use the induction hypothesis to conclude
-
*
-
–
if this implies that:
-
*
either is of the form and and therefore
-
*
or there exists a certain s.t. we have and . Let us then remark that given that we have we can apply the induction hypothesis to reveal such that and . We can then use the associativity and commutativity of as follows:
-
*
-
–
Lemma (Lem.3.6).
For any set of traces :
Proof A.2.
Let us consider . By definition, we already have . To prove the other inclusion let us reason by induction on a member trace:
-
•
by definition and
-
•
if the trace is of the form then if , then, as per Lem.3.4 there exists a trace such that and . This in turn implies that:
-
–
given that action is taken from , we have
-
–
and there exists such that . Given that is strictly smaller than , we can apply the induction hypothesis to obtain that .
Therefore we have that , and hence
-
–
Appendix B Proofs of section 5
Lemma (Lem.5.2).
For any we have
Proof B.1.
Let us reason by induction on the term structure of .
-
•
If the empty interaction, then we have both and .
-
•
If , we have neither nor .
-
•
Let us now suppose that is of the form , with and two sub-interactions that satisfy the induction hypotheses and .
-
Let us suppose that . By definition of for the constructor, this implies the existence of and such that . This trivially implies that and . We can therefore apply the induction hypotheses, to obtain that and . This in turn means that .
-
Reciprocally, if , this means that both and . As per the induction hypotheses, this means that and . Therefore .
-
-
•
For interactions of the form and , the reasoning is the same as for the previous case.
-
•
If is of the form :
-
If this means that either or or both. Let us suppose that it is in (the other cases can be treated similarly). As per the induction hypothesis, we have which implies that .
-
Reciprocally, if , then either or (or both). Let us suppose we have . The induction hypothesis implies that and hence .
-
-
•
If , with we always have and .
Lemma (Lem.5.5).
For any and ,
Proof B.2.
Given , let us reason by induction on the term structure of .
-
•
If , then we have and satisfies .
-
•
If , we have:
-
–
iff
-
–
and with trace verifying iff
The two conditions are therefore equivalent.
-
–
-
•
Let us now suppose that is of the form , with and two sub-interactions that satisfy the induction hypotheses (we use the distributivity of over ;):
-
If then both and . We can therefore apply the induction hypotheses, which lets us consider two traces and such that and . By definition of , we have . This implies that s.t. and this trace is in .
-
Reciprocally, if s.t. , then, by definition of , this means that there exist two traces and s.t. . Then, we have and . We can therefore apply the induction hypothesis which implies that and , which, per the definition of , implies that .
-
-
•
For interactions of the form and , the reasoning is the same as for the previous case except that we reason on (respectively) the operators and over both of which the conflict is also distributive.
-
•
If :
-
If then either or both and . Let us suppose we have (the other cases are similar). By the induction hypothesis, we have s.t. . We then simply observe that .
-
Reciprocally, if s.t. , this means that this trace must be found in either or . Let us suppose the first case (the other is similar). We can therefore apply the induction hypothesis which implies that . Then, by the definition of , this implies that .
-
-
•
Let us finally consider the case where is of the form , with . By definition, we always have and the empty trace verifies .
Lemma (Lem.5.10).
For any and any and from :
Proof B.3.
Given , let us reason by induction on the term structure of .
-
•
If then and . having no conflict w.r.t. , the property holds.
-
•
If , the precondition implies that . Also, we have and has a single trace with no conflict w.r.t. . Hence the property holds.
-
•
Let us now suppose that is of the form , with and two sub-interactions that satisfy induction hypotheses i.e. such that, given and we have and . Also, by definition of pruning, we have and let us denote it by for short.
-
If then there exist and such that . By the induction hypothesis, we have and and and . Therefore , and .
-
If is s.t. then this implies the existence of and s.t. . The fact that implies that both and . According to the induction hypothesis, this means that and . Therefore and hence .
-
-
•
For interactions of the form and , the reasoning is the same as for the previous case except that we reason on (respectively) the operators and over both of which the conflict is also distributive.
-
•
Let us now suppose that is of the form with and let us note the corresponding operator on sets of traces, i.e. if , if , if and if . We then have:
-
–
if , then . As per the reciprocate of Lem.5.5, if does not avoid , this means that all the traces from have conflicts with . This means that all the traces obtained from merging traces from have conflicts with . Therefore the empty trace is the only trace from which has no conflict with . Given that , the property holds.
-
–
if , then there exists a unique such that and we suppose the induction hypothesis . Then we have:
Indeed, the conflict distributes over and hence any trace obtained from merging traces from has no conflict w.r.t. iff it is obtained from merging traces from that all have no conflict with . Therefore, traces that have no conflict w.r.t. are exactly those that are obtained from merging traces with no conflicts w.r.t. . Those traces are those from as per the induction hypothesis. Therefore the property holds.
-
–
Appendix C Proofs of section 6
Lemma (Lem.6.1).
For any , and and from :
Proof C.1.
Given and in , in and , let us suppose that and that . In order to prove let us reason by induction on the cases that makes the hypothesis possible. There are 13 such cases, as per the 13 rules from Def.5.12:
-
1.
when executing an atomic action, we have and . Then and . The property holds.
-
2.
when executing an action on the left of an alternative, we have of the form , and such that . As a result, and . We can therefore apply the induction hypothesis on sub-interaction to obtain that . Given that , the property holds.
-
3.
the case for executing an action on the right of an alternative can be treated similarly
-
4.
when executing an action on the left of a , we have of the form , and such that and . By definition of , we have that there exist s.t. . Therefore we have and . Hence we can apply the induction hypothesis on sub-interaction to obtain that . Given that is the union of all the with and traces from and , we have that . In particular, we know that , so, by definition of the operator, we have that . Therefore the property holds.
-
5.
the case for executing an action on the right of a can be treated similarly
-
6.
executing an action on the left of a can be treated like 4.
-
7.
when executing an action on the right of a , we have of the form , and such that with the added hypothesis that . Given that and , we can apply the induction hypothesis on sub-interaction to obtain that . Given that includes when , and given that we know to be true, the property holds.
-
8.
executing an action on the left of a can be treated like 4.
-
9.
when executing an action on the right of a , we have of the form , and such that and with the added hypothesis that implied by the fact that prunes into . Given that , there exists and s.t. . We then remark that:
-
•
and . Hence we can apply the induction hypothesis on sub-interaction to obtain that .
-
•
the fact that implies, as per Lem.5.10 that . As a result, by definition of the weak sequencing operator, includes .
Finally, given that includes all s.t. and , we have, in particular . Hence the property holds.
-
•
-
10.
when executing an action underneath a , we have of the form and such that . We have that . Therefore there exists and s.t. . We then remark that:
-
•
and . Hence we can apply the induction hypothesis on sub-interaction , which implies that .
-
•
and as a result, given that , and , we have, i.e.
Then, given that , we have immediately that because it is always possible to add actions from the left. Therefore , so the property holds.
-
•
-
11.
executing an action underneath a can be treated like 10.
-
12.
when executing an action underneath a , we have of the form and such that and . Given that , there exists , and s.t. . We then remark that:
-
•
Given that we have that:
-
–
and, given that , is a weak Kleene closure we have that and therefore
-
–
and, given that , we have as per Lem.5.10 that . Therefore, for any and any we have given that we can take action , which have no conflict w.r.t , on the right side
-
–
-
•
We have and . Hence we can apply the induction hypothesis on sub-interaction , which implies that
-
•
Given that , and , we have, i.e.
Finally, given , the property holds.
-
•
-
13.
executing an action underneath a can be treated like 10.
Theorem (Th.6.3).
For any we have
Proof C.2.
Let us consider and and let us reason by induction on the trace .
-
•
If , then, as per the definition of , this means that . Then as per Lem.5.2, this means that .
-
•
If then, by definition of , iff s.t. and . Let us therefore consider such an interaction . By the induction hypothesis on trace , we have . As a result we have and . We can therefore apply Lem.6.1 to conclude that . Hence the property holds.
Lemma C.3 (Lem.6.5).
For any , and :
Proof C.4.
Let us consider , and . Let us suppose that and let us reason by induction on the term structure of .
-
•
we cannot have because it contradicts
-
•
if then implies that and . We then have the existence of which indeed satisfies that and
-
•
if is of the form then implies either or . Let us suppose it is the first case (the second is identical). Then, we can apply the induction hypothesis on sub-interaction , which reveals the existence of such that and . By definition of the execution relation "", this implies that . As a result, we have identified which satisfies the property.
-
•
if is of the form then implies the existence of traces and such that and and . This then implies:
-
–
either that is of the form and
-
–
or is of the form and
As both case can be treated identically, let us suppose it is the first case. Given that we have , we can apply the induction hypothesis on sub-interaction , which reveals the existence of such that and . By definition of the execution relation "", this implies that . By definition of , given that and , we have . Then, given that , this implies that . We therefore have identified which satisfies the property.
-
–
-
•
if is of the form then implies the existence of traces and such that and and . This then implies:
-
–
either that is of the form and . In that case we can apply the induction hypothesis on sub-interaction , which reveals the existence of s.t. and . By definition of the execution relation "", this implies that . By definition of , given that and , we have . Then, given that this implies that . Hence satisfies the property.
-
–
or that and . On the one hand, the fact that implies, as per Lem.5.2, that . On the other hand, with , we can apply the induction hypothesis on sub-interaction , which reveals the existence of s.t. and . By definition of the execution relation "", and because the precondition is verified, this implies that . As a result, we have identified which satisfies the property.
-
–
-
•
if is of the form then implies the existence of traces and such that and and . This then implies:
-
–
either that and . In that case we can apply the induction hypothesis on sub-interaction , which reveals the existence of s.t. and . By definition of the execution relation "", this implies that . By definition of , given that and , we have . Then, given that , this implies that . We therefore have identified which satisfies the property.
-
–
or that and that is of the form with . On the one hand, the fact that is such that , ensures, as per Lem.5.5, that and therefore, as per Lem.5.8, that there exists a unique such that . On the other hand, with , we can apply the induction hypothesis on sub-interaction , which reveals the existence of s.t. and . By definition of the execution relation "", this implies that . Given that is such that , as per Lem.5.10, this implies that . By definition of , given that and , we have . Then, given that , this implies that . We therefore have identified which satisfies the property.
-
–
-
•
if is of the form then means that and hence, as per Lem.3.4, this implies the existence of a trace such that and . Then, the fact that allows us to apply the induction hypothesis on sub-interaction to reveal the existence of such that and . By definition of the execution relation "", this implies that . By definition of , given that and that , we have that . Hence satisfies the property.
-
•
for is of the form the proof can be handled as in the previous case
-
•
if is of the form then means that . By definition, there exists such that . Because the restricted operator only allows to take the first action of recomposed traces from the left hand side, we can identify a trace s.t. and . Hence, we can apply the induction hypothesis on sub-interaction to reveal the existence of such that and . By definition of the execution relation "", this implies that . By definition of , given that and that , we have that . We therefore have identified which satisfies the property.
-
•
if is of the form then means that . By definition there exists such that . As a result, we can identify traces through such that for any , and . By definition of the weak sequencing operator, action is taken from a certain with which is therefore of the form and we have, for any , (otherwise we could not take from ) and . We can then remark the following:
-
–
considering such that (which existence is guaranteed by Lem.5.8 given that a loop always evades any lifeline), because, for any , we have then, as per Lem.5.10, for all , we have . Then:
-
*
If all the are the empty trace then ( contains at least because does)
-
*
If at least one is not the empty trace then is a non empty , and, because it is a , given that for all , we have then (because a is closed under repetition by )
Hence and therefore
-
*
-
–
given that, for any we have that and because is a loop (), then and therefore
-
–
given that we can apply the induction hypothesis on sub-interaction to reveal the existence of such that and . By definition of the execution relation "", this implies that
-
–
finally, given that we have shown that and because , by definition of we can conclude that . Therefore we have identified which satisfies the property.
-
–
Theorem (Th.6.7).
For any we have
Proof C.5.
Let us consider and and let us reason by induction on the trace .
-
•
If , the fact that implies, as per Lem.5.2, that . Then, by definition of , this means that .
-
•
If then, the fact that implies, as per Lem.6.5, that there exists an interaction such that and . Let us therefore consider such an interaction . By the induction hypothesis on trace , we have . As a result we have and . By definition of the operational semantics, this implies that . Hence the property holds.