ELEKTROTEHNI ˇ SKI VESTNIK 88(4): 190–196, 2021 ORIGINAL SCIENTIFIC PAPER Realizable Choreographies for Systems of Components Communicating via Rendezvous, Mailboxes and Letter Queues Monika Kapus-Kolar Joˇ zef Stefan Institute, Department of Communication Systems, Jamova 39, SI-1111 Ljubljana, Slovenia E-mail: monika.kapus-kolar@ijs.si Abstract. A recently proposed class of realizable compositionally specified choreographies for systems of components communicating over first-in-first-out channels with exactly one channel for every source-sink pair is generalized to systems with an arbitrary number of first-in-first-out channels, mailboxes and rendezvous channels, with no restrictions on who is allowed to exchange letters on individual channels. Keywords: choreography, semantics, realizability, pomset, communicating state machine Izvedljive koreografije za sisteme komponent, ki komunicirajo prek sreˇ canj, poˇ stnih nabiralnikov in pisemskih vrst Pred kratkim predlagan razred izvedljivih kompozicijsko speci- ficiranih koreografij za sisteme komponent, ki komunicirajo prek pisemskih vrst, z natanko eno vrsto za vsak par poˇ siljatelj- prejemnik, je posploˇ sen na sisteme s poljubnim ˇ stevilom pisemskih vrst, poˇ stnih nabiralnikov in kanalov za izmenjavo pisem prek sreˇ canj, brez omejitev glede tega, kdo sme izme- njevati pisma prek posameznih komunikacijskih kanalov. 1 INTRODUCTION When designing a distributed application supposed to run on a given distributed system, a possible way to proceed is to first conceive a choreography, i.e. a model of interactions among the system components from the global point of view. Ideally, the choreography is realizable, i.e. component processes for its correct implementation can be obtained simply by its projection. The paper generalizes our recent extension [1] of the work of Tuosto and Guanciale [2] on compositional construction of realizable choreographies for systems in which (1) every communication channel is between a pair of two different components, (2) from any com- ponent to any other component, there is exactly one communication channel, and (3) every channel is an initially empty, infinite-capacity buffer in which mes- sages are queued in the order of arrival and exactly the first in the queue is available for reception. Newly we allow (1) any number of channels, with no restrictions on who is allowed to use them for the exchange of letters (i.e. triplets consisting of the identifier of the Received 6 May 2021 Accepted 24 August 2021 sender, the identifier of the recipient and the message carried), (2) besides channels with an infinite-capacity buffer also channels whose buffer capacity is zero, so that any letter sent on it must be received in the same event - a rendezvous of its sender and its recipient, and (3) besides infinite-capacity communication buffers with the first-in-first-out (FIFO) policy also such (we call them mailboxes) in which letters are not queued and can be retrieved at any time. In line with the argumentation of Tuosto and Guan- ciale [2] that in the formal study of choreographies, it pays to go abstract, we follow the abstract view of [1] that a choreography is a set of partially ordered multisets (shortly pomsets) of interactions. An interaction is an individual exchange of a certain letter on a certain buffer and consists of two actions: a transmission of an instance of the letter into the buffer and its reception from the buffer at the same or some latter point. In case of a zero-capacity buffer, the two actions by definition occur simultaneously, so that the interaction can be regarded as a compound action. With the adopted abstract approach, we define the semantics, projection and well-formedness of choreogra- phies in a way independent of their concrete syntax. Like [1], [2] and also [3], in which Tuosto and Guanciale discuss the realizability of choreographies with mailbox communication only, we define the semantics of a given choreography as a set of action pomsets, and component processes obtained by projection as communicating state machines (CSMs) [4]. Like [2] and [1], but unlike [3], we simplify the discussion by banning choreographies with auto-concurrency (i.e. with multiple concurrent instances per action) and by assuming that individual CSMs are allowed to permanently stop exactly when in a state with no further actions defined. We prove that all well-formed choreographies are realizable. REALIZABLE CHOREOGRAPHIES 191 The choreography composition operators introduced as syntax sugar are the same as in [1], namely the operators of choice, parallel composition and sequential composition. For each of them we adapt to the gener- alized setting the operand constraints which [1] proves sufficient for the well-formedness of the choreography resulting from the composition. As a final contribution, we compare our definition of well-formed choreographies with the conceptually similar definitions recently proposed in [5]–[7]. Contrary to what is allegedly proved in the three papers, we demonstrate that (and explain why) none of the similar definitions secures the realizability of every well-formed choreography. 2 BASIC CONCEPTS AND NOTATIONS 2.1 (Inter)actions and Their Instances We assume that choreographies are designed for a system with component setC. Elements ofC are ranged over by c. Communication buffers, i.e. channels, are ranged over by b. For a given buffer b, Fifo(b) denotes that it is a FIFO channel, Mb(b) that it is a mailbox, and Rv(b) that it is a rendezvous channel. Messages are ranged over by m. A letter is denoted as (c;c 0 ;m) wherec is its sender,c 0 its recipient andm its message. Letters are ranged over by l. Interactions are ranged over by x. An interaction in which a given letterl is exchanged over a given bufferb is denoted as b :l, whereas its constituent transmission and reception are denoted as b!l and b?l, respectively. In case of Rv(b), the compound action representing a simultaneous execution of the two constituent actions of b :l is denoted as b!?l. Actions, i.e. transmissions, receptions and rendezvous regarded as compound actions, are ranged over by a, action sequences by , and sets of action sequences by A. The participant set of a given action a of the form b!(c;c 0 ;m), b?(c;c 0 ;m) or b!?(c;c 0 ;m) is denoted as prt(a) and defined asfcg,fc 0 g orfc;c 0 g, respectively. (Inter)action instances are alternatively called events. Events are ranged over by e, event sets byE, and event sequences by ". For a given event e, (e) denotes its label, i.e. the (inter)action of which it is an instance. For a given action instance sequence " = (e i ) i=1:::k , asq(") denotes the action sequence ( (e i )) i=1:::k . Interaction instances and their sets are alternatively (to expose their nature) ranged over byg andG, respec- tively. For a given interaction instanceg,e ! g denotes the constituent transmission instance, ande ? g the constituent reception instance. For a given instance g of an inter- action b : l with Rv(b), e !? g denotes the action instance representing a simultaneous execution ofe ! g ande ? g . For a given instance g of an interaction b : l with:Rv(b) or Rv(b), ais(g) denotes the action instance set defined asfe ! g ;e ? g g orfe !? g g, respectively. 2.2 Partially Ordered Sets of (Inter)action Instances A binary relation on a given event setE is a subset of EE . If it is reflexive, anti-symmetric and transitive, it is called partial order. The transitive closure of a given binary relation R is denoted as R ? . A partially ordered set of events (shortly poset) is an event setE endowed with a partial order and denoted as (E; ). Posets are ranged over by p. If for given posetsp = (E; ) andp 0 = (E 0 ; 0 ) there exist bijections :E!E 0 and 0 :! 0 with (1)8e2E : ( (e) = ( (e))) and (2)8(e;e 0 )2 : ( 0 ((e;e 0 )) = ( (e); (e 0 ))), then p and p 0 are isomorphic. For a given poset p = (E; ), esq(p) denotes the set of all event sequences (e i ) i=1:::jEj with (1)E =fe i g i=1:::jEj and (2)81 i