Abstract 1 Introduction 2 Definitions and Notations 3 Undecidability of Send-Synchronizability for Mailbox Systems 4 Send-synchronizability and 𝟏-schedulable Systems 5 Conclusion References Appendix A 𝟏-schedulability and related notions Appendix B A necessary and sufficient condition for send-synchronizability Appendix C Proofs of Section 3

On the Send-Synchronizability Problem for Mailbox Communication

Romain Delpy ORCID LaBRI, Univ. Bordeaux, CNRS, Bordeaux INP, Talence, France Anca Muscholl ORCID LaBRI, Univ. Bordeaux, CNRS, Bordeaux INP, Talence, France Grégoire Sutre ORCID LaBRI, Univ. Bordeaux, CNRS, Bordeaux INP, Talence, France
Abstract

A system of communicating automata is send-synchronizable if its set of send sequences (i.e., the projection on send actions of its executions) is the same when communications are asynchronous and when they are rendez-vous synchronizations. Send-synchronizability was claimed to be decidable for the mailbox semantics (Basu and Bultan, 2011) and for the peer-to-peer semantics (Basu and Bultan, 2016). Finkel and Lozes showed in 2017 that the proofs of these results are flawed, and they proved that send-synchronizability is in fact undecidable for peer-to-peer systems. The send-synchronizability problem for mailbox systems was left open. A partial solution was recently proposed in (Di Giusto, Laversa and Peters, 2024). In this paper, we revisit the send-synchronizability problem for mailbox systems. Firstly, we show that send-synchronizability is undecidable for mailbox systems, thus closing the question left open in (Finkel and Lozes, 2023) and (Di Giusto, Laversa and Peters, 2024). Secondly, we show that send-synchronizability is decidable for the class of 1-schedulable mailbox systems. A system is 1-schedulable if every execution can be re-scheduled into an equivalent execution where each send is either immediately followed by its matching receive, or is never matched. Despite the apparent similarity between send-synchronizability and 1-schedulability, the proof that send-synchronizability is decidable for 1-schedulable mailbox systems is quite involved. We believe that the techniques that we develop in this proof could be used to address other problems on mailbox systems, such as the realizability problem.

Keywords and phrases:
Concurrent programming, Mailbox communication, Verification, Synchronizability
Copyright and License:
[Uncaptioned image] © Romain Delpy, Anca Muscholl, and Grégoire Sutre; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Theory of computation Logic and verification
Funding:
This work was (partially) supported by the grant ANR-23-CE48-0005 of the French National Research Agency ANR (project PaVeDyS).
Editors:
Patricia Bouyer and Jaco van de Pol

1 Introduction

Message-passing is a key synchronization mechanism for concurrent programming and distributed systems. In this model, processes running asynchronously synchronize by exchanging messages over unbounded channels. Typically, the communication follows a peer-to-peer model, which is particularly useful for reasoning about telecommunication protocols.

Recently, mailbox communication has attracted increased attention due to its role in multi-thread programming, as seen in languages like Rust or Erlang. In mailbox communication each process has a single incoming communication buffer, or mailbox, where messages from other processes are multiplexed.

Asynchronous communication poses significant challenges for formal verification, since it can easily emulate Turing machines. The quest for conditions that ensure decidability for automatic verification has led to various restrictions, such as constraints on channel behavior (e.g. lossiness [1, 12], or properties based on partial-orders [18, 14, 20]). More recently, research has focused on restricting the communication protocols themselves [6, 16, 17, 8].

While synchronous communication offers great simplicity, its relevance extends beyond verification. Many specification formalisms, such as choreography languages [2] and multi-party session types [24, 22, 23], are built upon synchronous communication. This raises a fundamental question, considering the inherent asynchrony of real-world systems: how different is an asynchronous system from its idealized synchronous version, where every sent message is instantaneously received?

Send-synchronizability offers one way to compare synchronous and asynchronous semantics. The work [13] defined a system as (send-)synchronizable if the sequence of sent messages is identical under both asynchronous and synchronous semantics. While [2] claimed decidability for mailbox systems and later extended the claim to peer-to-peer systems [3], the latter claim was refuted by [10, 11], showing undecidability for peer-to-peer systems. The decidability of send-synchronizability for mailbox systems, however, remained an open question (see, e.g., [9]), and this paper addresses it.

Send-synchronizability has been explored in several subsequent works [2, 4, 3, 11, 9] with variations such as final states, or requiring that the same state is reached in both the synchronous and asynchronous execution. For example, in [9], each process has a set of final states. This generalized version was shown to be undecidable in [9], with final states playing a key role in the proof. Our first contribution is to show that send-synchronizability remains undecidable even in the standard setting of communicating systems without final states.

Our second contribution shows the decidability of send-synchronizability for 1-schedulable systems. These systems, termed 1-synchronizable in [6] but renamed here for clarity, share similarities with the synchronous semantics. However, a key difference is that not all messages need to be received. A system is 1-schedulable if every execution can be reordered into an equivalent one where each send is either immediately followed by its corresponding receive, or remains unmatched. Being 1-schedulable is a decidable property, with PSPACE complexity [6, 16]. We show that send-synchronizability is decidable for 1-schedulable systems, but the proof is surprisingly intricated because of the unreceived messages. Our proof employs partial-order techniques (commutations), with the main challenge being the unmatched send events.

For convenience, technical terms and notations in the electronic version of this manuscript are hyper-linked to their definitions (cf. https://ctan.org/pkg/knowledge).

2 Definitions and Notations

2.1 Mailbox message-passing systems

We let denote a finite non-empty set of processes, and 𝕄 denote a finite non-empty set of message contents. The set of (communication) actions is 𝐴𝑐𝑡={p!q(m),q?p(m)p,q,pq,m𝕄}. An action p!q(m) denotes a send by p of message m to q and an action p?q(m) denotes a receive by p of message m from q. In both cases, the process performing the action is p. A communicating finite-state machine [7] is a finite set of processes that exchange messages, each process being given as a finite LTS. Recall that a (finite) labeled transition system, LTS for short, is a quadruple (L,A,,i) where L is a (finite) set of states, A is a finite alphabet, L×A×L is a set of transitions, and iL is an initial state. In the following definition, 𝐴𝑐𝑡p denotes the set of actions a𝐴𝑐𝑡 performed by p.

A Communicating Finite-State Machine (CFM for short) is a tuple 𝒜=(𝒜p)p, where each 𝒜p is a finite LTS 𝒜p=(Lp,𝐴𝑐𝑡p,p,ip). States in Lp are called local states. The size of 𝒜 is defined as p(|Lp|+|p|).

The usual semantics of communication is peer-to-peer, with (at most one) fifo channel for each pair of distinct processes. In this paper we focus on the mailbox semantics. Here, every process has a receiving fifo queue in which every other process can enqueue messages. We define the semantics by an associated global transition system.

Let 𝒜=(𝒜p)p be a CFM. The global transition system associated with 𝒜 is the LTS 𝒯(𝒜)=(C𝒜,𝐴𝑐𝑡,𝒜,cin) with set of configurations C𝒜=G×p(×𝕄) consisting of global states G=pLp (i.e., products of local states) and queue contents over the alphabet ×𝕄. Let ((p)p,(wp)p)𝑎𝒜((p)p,(wp)p) if

  • p𝑎pp and q=q for qp, where p is the process performing a.

  • Send actions: if a=p!q(m) then wq=wq(p,m) and wp=wp for pq.

  • Receive actions: if a=p?q(m) then (q,m)wp=wp and wp=wp for pp.

The initial configuration is cin=((ip)p,ε).

An execution of 𝒯(𝒜) is a sequence ρ=c0a1c1ancn with ciC𝒜 such that ci1ai𝒜ci for every i. The sequence a1an is the label of the execution. The execution is initial if c0=cin.

 Remark 2.1.

Note that the queue content includes the identity of the sender. This is to exclude executions labelled by p!q(m)q?r(m) with pr. Without this addition such executions would be allowed in the mailbox semantics, which is clearly not intended.

Definition 2.2 (Trace).

A trace of a CFM 𝒜 is a sequence u𝐴𝑐𝑡 such that there exists an initial execution of 𝒯(𝒜) labelled by u. The set of all traces of 𝒜 is denoted by 𝑇𝑟(𝒜).

Definition 2.3 (Viable).

A sequence v𝐴𝑐𝑡 is called viable if for every p:

  • for every prefix u of v, the number of receives of p in u is less or equal the number of sends to p in u;

  • for every k, if the k-th receive of p in v has label p?q(m) then the k-th send to p in v has label q!p(m).

Definition 2.4 (Rendez-vous).

A sequence from 𝐴𝑐𝑡 is called a rendez-vous sequence if it is of the form p1!q1(m1)q1?p1(m1)pn!qn(mn)qn?pn(mn). Note that every send action is matched in a rendez-vous sequence, and that such sequences are viable. We define 𝑇𝑟rdv(𝒜)𝑇𝑟(𝒜) as the set of traces in 𝑇𝑟(𝒜) that are rendez-vous.

The classical happens-before relation [21], frequently used in reasoning about distributed systems, orders the actions of each process and every (matched) send action before its matching receive. Because of mailbox semantics, an additional order arise between sends to the same process. The happens-before relation together with the mailbox order naturally associates a partial order with every trace, known as message sequence chart:

Definition 2.5 (Message Sequence Chart).

An MSC over is an 𝐴𝑐𝑡-labeled partially ordered set =(E,,λ) of events E, with λ:E𝐴𝑐𝑡 and =(msg<mb) the least partial order containing the relations , msg and <mb, which are defined as:

  1. 1.

    For every process p, the set of events on p is totally ordered by , and is the union of these total orders.

  2. 2.

    msg is the set of matching send/receive event pairs. In particular, (e,f)msg implies λ(e)=p!q(m) and λ(f)=q?p(m) for some p,q and m𝕄. Moreover, msg is a partial bijection between sends and receives such that every receive is paired with a (unique) send. A send is called matched if it is in the domain of msg, and unmatched otherwise.

  3. 3.

    for every process p, we order two sends e<mbe with e=q!p(m) and e=q!p(m) if

    • either e is matched and e is unmatched,

    • or (e,f),(e,f)msg and f<f.

    We call <mb the mailbox order.

For two events e,fE we write ef if neither ef nor fe holds. For a set of events FE we write 𝑃𝑎𝑠𝑡(F)={ffe for some eF} and 𝐹𝑡𝑟(F)={fef for some eF} for the causal past and future of F, respectively.

p0!p1(m0)p1!p2(m1)p2?p1(m1)p2!p1(m2)p1?p0(m0)

Figure 1: A sequence and its MSC. An unmatched send action is marked by a special arrowhead, as for m2. We have here s0<mbs2, so s0s2, and s1s0, with si the send of message mi.

If u=u[1]u[n] is a viable sequence of actions, then we can associate an MSC with u by setting msc(u)=(E,,λ) with E={e1,,en}, λ(ei)=u[i], and the orders defined as expected:

  • eiej if u[i] and u[j] are performed by the same process and ij.

  • (ei,ej)msg if there exists k1 and a process p such that u[i] is the k-th send to p and u[j] is the k-th receive of p.

  • ei<mbej if u[i] and u[j] are both sends to the same process p, u[i] is matched to some u[k], and either u[j] is unmatched, or u[j] is matched to some u[] with k.

 Remark 2.6.

By definition, for any viable sequence u, the associated MSC msc(u) is well-defined. For the converse, for every MSC , every (labelled) linearization of the partial order of is viable. Indeed, all receives of the same process are totally ordered by , and the corresponding sends are ordered in the same way because of the mailbox order. For example, the sequence shown in Figure 1 is viable, but p1!p2(m1)p2?p1(m1)p2!p1(m2)p0!p1(m0)p1?p0(m0) is not.

The next definition introduces an equivalence relation on sequences of actions. Two viable sequences are equivalent up to commuting adjacent actions that are not ordered by being on the same process, being a matching send/receive pair, or being two sends to the same process that are not both unmatched.

Definition 2.7 (Equivalence ).

Two viable sequences u,v𝐴𝑐𝑡 are called equivalent if msc(u)=msc(v) (up to isomorphism), and we write uv in this case.

In this paper, we define (as in [2, 10]) the observable behavior of a CFM as the set of projections on sends. We set S={p!q(m)p,q,pq,m𝕄}. For a sequence u𝐴𝑐𝑡, we denote by u|S the projection of u on S. For any X𝐴𝑐𝑡, we write X|S={u|SuX}.

Definition 2.8 (Send-synchronizability).

Let 𝒜 be a CFM. We say that 𝒜 is send-synchronizable if 𝑇𝑟(𝒜)|S=𝑇𝑟rdv(𝒜)|S.

The send-synchronizability problem is the question whether a CFM is send-synchronizable.

3 Undecidability of Send-Synchronizability for Mailbox Systems

We show in this section that the send-synchronizability problem is undecidable. We rely in our undecidability proof on the following decision problem, which is a variant of the well-known Post correspondence problem.

Pre-MPCP
Input: A finite sequence of pairs (x1,y1),,(xK,yK), with K1, where xi,yiΣ for some finite alphabet Σ.
Output: Yes if there exists a sequence of indices i1,,ik{1,,K}, with k1, such that i1=1, xi1xik=yi1yik and |xi1xij||yi1yij| for every j{1,,k}.

It is well-known that Pre-MPCP is undecidable [19]. The remainder of this section provides a reduction from Pre-MPCP to send-synchronizability.

Consider an instance =(x1,y1),,(xK,yK) of Pre-MPCP over a finite alphabet Σ. We construct a CFM 𝒜() such that is a positive instance of Pre-MPCP if, and only if, 𝒜() is not send-synchronizable. The CFM 𝒜() comprises three processes, namely G (the guesser), R (the relayer), and V (the verifier). So ={G,R,V}. The set of message contents is 𝕄=ΣΣ¯{$,$¯,#}, where Σ¯={a¯aΣ} is disjoint from Σ, and the messages $, $¯ and # denote three distinct symbols that are not in ΣΣ¯. We choose to introduce a copy Σ¯{$¯} of the alphabet Σ{$} in order to easily111In our global transition system 𝒯(𝒜), each message content stored in a buffer is decorated with the channel of the corresponding send action. So our construction would also work without the copy Σ¯{$¯} of Σ{$}, but we believe that this copy makes our construction easier to read. distinguish in the mailbox of V the messages that were sent by G from the messages that were sent by R. The symbols $ and $¯ are used to mark the end of the sequences xi1xik and yi1¯yik¯ guessed by G. It is understood that y1¯,,yK¯ are the words in Σ¯ that are obtained from y1,,yK by replacing each letter a by a¯. The message # is sent by V when the two guessed sequences are equal. The LTSes 𝒜G, 𝒜R and 𝒜V of the processes G, R and V are defined in Figures 2, 3, and 4. To ease understanding, the resulting communication topology, along with the potential message contents in the channels, is depicted in Figure 5. In the description of the guesser process (see Figure 2), we use the shortcuts G!R(xi) and G!V(yi¯) to reduce clutter. Let us explain what we mean by these shortcuts. A transition p!q(m1mn), where mi𝕄, stands for the contiguous sequence of transitions =0p!q(m1)1n1p!q(mn)n= where 1,,n1 are intermediate states. The observant reader will notice that the LTSes 𝒜R and 𝒜V contain silent transitions (from the initial state to the states D and N), which are not allowed in our definition of CFM. This is merely a notational convenience to reduce clutter in the figures. We may safely get rid of these silent transitions since send-synchronizability of a CFM is not sensitive to such transitions.

Figure 2: LTS 𝒜G of the guesser process G of the CFM 𝒜().
Figure 3: LTS 𝒜R of the relayer process R of the CFM 𝒜().
Figure 4: LTS 𝒜V of the verifier process V of the CFM 𝒜().
Figure 5: Topology of the CFM 𝒜() and message contents potentially exchanged along the channels. The + sign serves as a reminder that the channels (G,V) and (R,V) are multiplexed into a single mailbox.

The behavior of the guesser process G should be quite clear. It sends the two guessed sequences and then waits for a message # from V, which it relays to R, signaling that the guessed sequences form a solution. The relayer process R has two operating modes, a normal mode (right-hand side of Figure 3) and a dummy mode (left-hand side of Figure 3). In the normal mode, R simply relays to V every message that it receives from G. For V to process its mailbox properly (see below), the send actions G!V() and R!V() need to be interleaved in lock-step (but there may be executions in 𝒯(𝒜()) where this does not hold). The purpose of the dummy mode is to make 𝒜() send-synchronizable if is a negative instance of Pre-MPCP. Notice that there is no switch between modes. Analogously, the verifier process V has a normal mode and a dummy mode (right-hand and left-hand sides of Figure 4, respectively). In the normal mode, V checks that the contents of its mailbox is of the form a1a1¯anan¯$$¯. It then sends # to G if that is the case (otherwise it is blocked). The purpose of the dummy mode is the same as for R. Observe that the message # sent by V to G is relayed by G to R, and then relayed by R back to V, but V never receives it.

We first show that if is a positive instance of Pre-MPCP, then 𝒜() is not send-synchronizable.

Lemma 3.1.

If is a positive instance of Pre-MPCP then there is an initial execution in 𝒯(𝒜()) leading to the configuration (N,N,N;ε,ε,ε).

Proof sketch..

G guesses a solution i1,,ik, and sends xi1xik$ and yi1¯yik¯$¯ to R and V, respectively. R relays xi1xik$ to V with the appropriate delay so that the mailbox of V is filled by G and R in lock-step. This is possible because our variant of PCP requires that |xi1xij||yi1yij| for every j{1,,k}. We end up with a1a1¯anan¯$$¯ in the mailbox of V. Then V empties its mailbox by iterating the cycle on N.

Corollary 3.2.

If is a positive instance of Pre-MPCP then there is a trace u𝑇𝑟(𝒜()) containing the action R!V(#), hence, 𝒜() is not send-synchronizable.

Now we show that if is a negative instance of Pre-MPCP, then 𝒜() is send-synchronizable. Some additional notations are needed. For every process p, we let L(𝒜p) denote the language recognized by the LTS 𝒜p viewed as a non-deterministic automaton with every state final, and we let u|p denote the projection of a sequence u𝐴𝑐𝑡 on 𝐴𝑐𝑡p. We also define 𝑚𝑎𝑡𝑐ℎ:S𝐴𝑐𝑡 as the morphism given by 𝑚𝑎𝑡𝑐ℎ(p!q(m))=p!q(m)q?p(m).

Lemma 3.3.

If there is a trace in 𝑇𝑟(𝒜()) containing the action R!V(#) then is a positive instance of Pre-MPCP.

Lemma 3.4.

For every trace u𝑇𝑟(𝒜()), if u does not contain the action R!V(#) then 𝑚𝑎𝑡𝑐ℎ(u|S)|pL(𝒜p) for every process p{G,R,V}.

Proof sketch..

Either u contains no send action to G, or u contains a single send action to G, which is V!G(#). In that case, this action is necessarily after G!V($¯) and before G!R(#). In both cases, we get that 𝑚𝑎𝑡𝑐ℎ(u|S)|GL(𝒜G).

All sends to R are from G and all sends by R are to V. The word sent by G to R in u is a prefix of a word in Σ$#. The word sent by R to V in u is a prefix of a word in Σ$, since u does not contain the action R!V(#). It follows that 𝑚𝑎𝑡𝑐ℎ(u|S)|RL(𝒜R), by letting R select the dummy mode.

The word sent to V in u is in (ΣΣ¯{$,$¯}), since u does not contain the action R!V(#). If u contains no send action by V, then 𝑚𝑎𝑡𝑐ℎ(u|S)|VL(𝒜V), by letting V select the dummy mode. Otherwise, u contains a single send action by V, which is V!G(#). The definition of 𝒜V (together with the mailbox semantics) entails that the word sent to V in u is of the form a1a1¯anan¯$$¯. Moreover, the action V!G(#) is necessarily after G!V($¯). We derive that 𝑚𝑎𝑡𝑐ℎ(u|S)|V coincides with the sequence of actions by V in u, hence, 𝑚𝑎𝑡𝑐ℎ(u|S)|VL(𝒜V).

Corollary 3.5.

If is a negative instance of Pre-MPCP then 𝒜() is send-synchronizable.

We then get the next theorem from Corollaries 3.2 and 3.5.

Theorem 3.6.

The send-synchronizability problem is undecidable.

4 Send-synchronizability and 𝟏-schedulable Systems

In this section we show that we can decide send-synchronizability for a subclass of CFMs that we call 1-schedulable.222This decidable class of systems originates from [6] and it is the same as 1-synchronizable there. To better distinguish it from send-synchronizability we decided to rename it here into 1-schedulable. Comparison with other close notions can be found in Appendix A. We start by defining 1-schedulable systems and a commutation relation over send sequences. Then we show that if all traces of a 1-schedulable CFM respect a certain property (and we say the CFM is good in this case) then we can check if the CFM is send-synchronizable. Next we show that any 1-schedulable CFM that is not good, cannot be send-synchronizable. Finally we show that we can check if a 1-schedulable CFM is good.

Definition 4.1 (1-scheduling and 1-schedulable).

A viable sequence u𝐴𝑐𝑡 is a 1-scheduling if every send action in u is either directly followed by its receive or it is unmatched. We also say in that case that u is 1-scheduled. A sequence u𝐴𝑐𝑡 is 1-schedulable if there exists vu such that v is a 1-scheduling.

A CFM 𝒜 is 1-schedulable if every trace u𝑇𝑟(𝒜) is 1-schedulable.

From [8] (see also [16]) we know that 1-schedulability is a decidable property (PSPACE-complete). To make the characterization formal, we need some notation first. Given a binary relation over some set X, a -cycle is any sequence (x1,,xk)X, with k1, such that x1x2xk+1, where xk+1:=x1. A viable sequence w is not 1-schedulable if, and only if, msc(w) contains a (msg1)-cycle with at least two distinct sends [8]. For example, the sequence 1!2(m) 2!1(m) 1?2(m) 2?1(m) is not 1-schedulable, as witnessed by the cycle 1!2(m)<1?2(m)msg1 2!1(m)<2?1(m)msg1 1!2(m).

Throughout this section we will assume that the CFM 𝒜 is 1-schedulable. Our characterization of send-synchronizability will rely on partial commutations applied to the observable behaviors of rendez-vous traces.

Definition 4.2 (Commutations).

We define a commutation relation 𝑆𝐼S×S on the alphabet S of sends as follows. Let a=p!q(m) and b=p!q(m) be two send actions. Then (a,b)𝑆𝐼 if pp, qq and qp.

If (a,b)𝑆𝐼 and w,wS then we write wabw𝑆𝐼wbaw, and we consider the reflexive-transitive closure 𝑆𝐼 of this relation. We denote the commutative closure of a send sequence vS as 𝐶𝑙𝑆𝐼(v)={vSv𝑆𝐼v}. We define 𝐶𝑙𝑆𝐼(E), for ES, as vE𝐶𝑙𝑆𝐼(v).

The example in Figure 6 gives a first intuition about the role of commutations for send-synchronizability. As seen there, if a CFM has an execution w as depicted on the left, and is send-synchronizable, then it has to include also an execution as depicted on the right. This entails that if 1!0(m)2!1(m) is an observable behavior, then so is 2!1(m)1!0(m).

 Remark 4.3.

It is readily seen that one can check if a regular language L satisfies L=𝐶𝑙𝑆𝐼(L). For this it is enough to check that wabwL entails wbawL, for all words w,w and (a,b)𝑆𝐼. Such a test can be done in Pspace, if L is described by an automaton.

Figure 6: In the left scenario, the two send events s and s satisfy ss. Note that (1!0(m),2!1(m))𝑆𝐼, so 1!0(m) 2!1(m)𝑆𝐼2!1(m) 1!0(m). To be send-synchronizable, a CFM must also allow the scenario on the right, where ss.

4.1 From 𝟏-schedulings to arbitrary traces via commutations

In this subsection we start with a sufficient condition that ensures that the send projections of traces of 𝒜 can be obtained via commutations from the send projections of 1-schedulings of 𝒜 (see Proposition 4.5). The definitions that follow are used in Lemma 4.4, that states the relation between commutations and projections for a single trace.

Consider a viable sequence w. We introduce two binary relations and usw over the set of events E of msc(w), defined as follows:

  • fe if there exists p such that e is an unmatched send to p, f is a send from p, and ef.

  • euswf if there exists p such that e and f are unmatched sends to p, e is before f in w, and ef.

We say that w has a backward arc if there exists two events e,f such that fe and e occurs before f in w. Consider for example the trace w1 in Figure 7(a) left: we have s0s1s2s0, so w1 has a backward arc.

The objective of the usw relation is to enforce the order of unmatched sends to the same process. Given two viable sequences w and w, we write wusw if ww and for every process p, the order of unmatched sends to p is the same in w and w. Notice that for every viable sequences w,w such that ww, we have wusw if, and only if, the binary relations usw and usw coincide.

Lemma 4.4.

Let w be a 1-scheduling and suppose that w has no backward arc. Then 𝐶𝑙𝑆𝐼(w|S)={w|Sw is a viable sequence and wusw}.

Proof.

We write 𝒲={w|Swusw}.

We first show 𝐶𝑙𝑆𝐼(w|S)𝒲 recursively on the number of commutation steps. Initially w|S𝒲. Now we take u𝐶𝑙𝑆𝐼(w|S)𝒲, and let u=u0xyu1 with x,yS, u0,u1S and (x,y)𝑆𝐼. Let u=u0yxu1 be the sequence of sends obtained by commuting x and y. As u𝒲, there is some vusw such that v|S=u. We suppose w.l.o.g. that v=v0xyv1: if there were receives between x and y, each one could either swap with x to the left, or with y to the right, since x,y cannot be on the same process, and the sequence obtained would be us equivalent to v. As (x,y)𝑆𝐼 we know that they are not on the same process, and they do not send to the same process, so xy and vusv0yxv1, hence u𝒲.

Now we show that 𝐶𝑙𝑆𝐼(w|S)𝒲 by induction on the size of w. Initially, ε|S=ε. Let w=usr be a 1-scheduling without arc. Consider some wusw such that w=xsyrz, with x,y,z𝐴𝑐𝑡. We have w|S=u|Ss and w|S=x|Ss(yz)|S. We know that wusxyzsr so uusxyz. The case where w=us is dealt with similarly.

By induction, x|S(yz)|S𝐶𝑙𝑆𝐼(u), so x|S(yz)|Ss𝐶𝑙𝑆𝐼(w). Now, we know that s is concurrent with every event of yz. Moreover, there is no arc. So for every s occurring in (yz)|S: if s=p!q(m), then s is not on p, and it is neither a send to p (matched or not) nor to q (matched or not), so (s,s)𝑆𝐼, and w|S𝐶𝑙𝑆𝐼(w).

A viable sequence w is called good if there exists a 1-scheduled sequence w such that wusw and w has no backward arc. Otherwise w is called bad. Note that every good viable sequence is necessarily 1-schedulable. A CFM 𝒜 is good if every trace in 𝑇𝑟(𝒜) is good, and 𝒜 is called bad otherwise.

Proposition 4.5.

For every good CFM 𝒜, it holds that 𝑇𝑟(𝒜)|S is the closure under 𝑆𝐼 of {w𝑇𝑟(𝒜)w is a 1-scheduling}|S.

Proof.

Let K and L be defined as K=K|S and L=L|S, where

K ={w𝑇𝑟(𝒜)w is a 1-scheduling and has no backward  arc}
L ={w𝑇𝑟(𝒜)w is a 1-scheduling}

Note that KL𝑇𝑟(𝒜)|S. We first show that 𝑇𝑟(𝒜)|S=𝐶𝑙𝑆𝐼(K). Consider a trace w𝑇𝑟(𝒜). As w is good, there exists a trace w𝑇𝑟(𝒜) such that wusw, w is a 1-scheduling and w has no backward arc. It holds that 𝐶𝑙𝑆𝐼(w|S)={u|Suusw} according to Lemma 4.4. As w|SK and wusw, we get that w|S𝐶𝑙𝑆𝐼(K). The converse inclusion 𝐶𝑙𝑆𝐼(K)𝑇𝑟(𝒜)|S immediately follows from Lemma 4.4. Since KL𝑇𝑟(𝒜)|S and 𝑇𝑟(𝒜)|S=𝐶𝑙𝑆𝐼(K), we derive that 𝐶𝑙𝑆𝐼(K)𝐶𝑙𝑆𝐼(L)𝐶𝑙𝑆𝐼(𝐶𝑙𝑆𝐼(K))=𝐶𝑙𝑆𝐼(K), hence, 𝑇𝑟(𝒜)|S=𝐶𝑙𝑆𝐼(K)=𝐶𝑙𝑆𝐼(L).

The above proposition provides our first ingredient to decide the send-synchronizability problem for 1-schedulable CFMs. Two additional ingredients are needed to complete our decidability proof. First, we will show that every bad CFM is not 1-schedulable or not send-synchronizable. Second, badness of a CFM will be shown to be decidable. We start with a characterization of bad viable sequences. For a viable sequence w, a (msg1usw)-cycle in msc(w) is called trivial if it is of the form (e,f,,e,f) with (e,f)(msgmsg1), or equivalently, if it does not contain two distinct sends.

Lemma 4.6.

For every viable sequence w, it holds that w is bad if, and only if, there exists a (msg1usw)-cycle in msc(w) that is not trivial.

Proof sketch..

Consider a viable sequence w. For short, let us write 𝑇𝑟𝑣𝐶𝑦𝑐 the condition that every (msg1usw)-cycle in msc(w) is trivial. To prove the lemma, we show that w is good if, and only if, 𝑇𝑟𝑣𝐶𝑦𝑐 holds. We consider the directed graph G whose nodes are the events of msc(w) and whose edges are given by the relations <, msg, <mb, msg1, and usw. Let H denote the directed graph obtained from G by, firstly, merging events that are connected by an msg-arc, and secondly, removing all msg-arcs. It is readily seen that 𝑇𝑟𝑣𝐶𝑦𝑐 is equivalent to the condition that H is acyclic. If 𝑇𝑟𝑣𝐶𝑦𝑐 holds, then the partial order induced by H admits a linearization x1xn. By “unmerging” events in x1xn, we get a linearization w of msc(w) such that w is 1-scheduled and w has no backward -arc nor backward usw-arc, hence, w is good. Conversely, if w is good then the sequence x1xn of nodes of H that is induced by w contains every node of H and has no backward edge, so H is acyclic, hence, 𝑇𝑟𝑣𝐶𝑦𝑐 holds.

We now focus our attention to CFMs that are 1-schedulable. For this class of CFMs, we obtain a characterization of badness of a CFM in terms of cycles that are simpler than those of Lemma 4.6 in the sense that they contain no msg1-arc.

Lemma 4.7.

For every 1-schedulable CFM 𝒜, if 𝒜 is bad then there exists a (bad) trace w𝑇𝑟(𝒜) such that msc(w) contains a (usw)-cycle.

Proof.

Consider a bad trace w𝑇𝑟(𝒜) of minimal length. Let Ξ denote the set of non-trivial (<msg<mbmsg1usw)-cycles in msc(w). We lexicographically order cycles ξ in Ξ first by number of msg1-arcs (accounting for the arc from the last event of ξ to the first event of ξ), second by length of the cycle. By Lemma 4.6, the set Ξ is non-empty. Pick a cycle ξ in Ξ of minimal length, and let us show that ξ contains no msg1-arc.

We first observe that every event of msc(w) is in 𝑃𝑎𝑠𝑡(C), where C denotes the set of events of ξ. By contradiction, assume that this is not the case. There necessarily exists an event e in msc(w) such that e𝑃𝑎𝑠𝑡(C), e is maximal for and e is a receive or an unmatched send. Consider the sequence w corresponding to w with e removed. It is readily seen that w is viable, hence, w𝑇𝑟(𝒜). Moreover, the cycle ξ is still a non-trivial (msg1usw)-cycle in msc(w). So by Lemma 4.6, w is a bad trace in 𝑇𝑟(𝒜), which contradicts the minimality of w.

By contradiction, assume that ξ contains an msg1-arc. Up to a rotation of the cycle, we may assume that ξ is of the form (e1,,ek) with (ek,e1)msg1. Note that k>2 since ξ is non-trivial. For readability, let us write s:=e1 and r:=ek. We make three observations.

  1. 1.

    The event r is maximal for . By contradiction, suppose that r<f for some event f. Since f𝑃𝑎𝑠𝑡(C), we get that fei for some 1ik. Pick a (<msg<mb)-path (f1,,f) with f1=f and f=ei. We get that (ei,,ek,f1,,f1) is in Ξ and has one less msg1-arc than ξ, which contradicts the minimality of ξ.

  2. 2.

    The event s:=ek1 is a send and s<r=ek. Indeed, as ek is a receive, ek1 verifies ek1<r or (ek1,r)msg. If (ek1,r)msg then ek1=s=e1, hence, (e1,,ek2) is in Ξ, which contradicts the minimality of ξ. So ek1<r. It remains to show that ek1 is a send. Suppose by contradiction that ek1 is a receive. We either have ek2<ek1 or (ek2,ek1)msg. In the first case, ek2<r=ek, hence, (e1,,ek2,ek) is in Ξ, which is impossible by minimality of ξ. In the second case, (ek2,ek1)msg, hence, ek2<mbs=e1. This entails that (e1,,ek2) is in Ξ, which is impossible by minimality of ξ.

  3. 3.

    It holds that ss. Let us prove this claim. We have s<r and (r,s)msg1. Note that ss since s and s are sends by distinct processes. If ss then (s,s,r,s) would be a (msg1)-cycle with at least two distinct sends in msc(w), which is impossible since w is 1-schedulable. If ss then ek1=ss=e1, hence, (e1,,ek1) is in Ξ, which contradicts the minimality of ξ.

We now derive a contradiction, which will conclude the proof that ξ contains no msg1-arc. Consider the sequence w′′ corresponding to w with r removed. We have w′′𝑇𝑟(𝒜) since r is a receive and is maximal for , by our first observation above. The event r=ek is the matching receive of s=e1 in msc(w), so s becomes an unmatched send in msc(w′′). In msc(w′′), the event s=ek1 is a send and s is a send to the process performing s, by our second observation above. Moreover, as ss in msc(w), by our third observation above, we still have ss in msc(w′′). It follows that ss in msc(w′′), hence, ek1e1. We derive that (e1,,ek1) is a non-trivial (msg1usw)-cycle in msc(w′′). This entails, by Lemma 4.6, that w′′ is bad, which contradicts the minimality of w.

 Remark 4.8.

Given a viable sequence w, a (usw)-cycle (e1,,ek) in msc(w) is called genuine if e1,,ek are pairwise-distinct and, for every 1i<jk, we have eiej implies j=i+1 and ejei implies i=1 and j=k. Informally, a genuine cycle is a simple cycle such that for every events e,f on the cycle, if ef then the subpath of the cycle from e to f is a single -arc. It is routinely checked that if msc(w) contains a (usw)-cycle then it contains a genuine (usw)-cycle.

4.2 Bad CFMs

Our goal in this section is to analyze bad, 1-schedulable CFMs. We will show a necessary condition for badness in terms of patterns (Proposition 4.10), and we will show that the presence of a pattern prevents a CFM to be send-synchronizable (Proposition 4.11).

We focus on 1-scheduled traces, as they can be effectively constructed from the CFM using automata. The binary relation usw needs to be relaxed as we might need to re-order unmatched sends of a 1-scheduling in 𝑇𝑟(𝒜) in order to exhibit a bad 1-schedulable trace in 𝑇𝑟(𝒜). Given a viable sequence w, we introduce the binary relation us over the set of events E of msc(w), defined by eusf if there exists p such that e and f are unmatched sends to p and ef. Note that us is symmetric and contains usw.

A pattern for a viable sequence w is an alternating sequence of send events (x1,y1,,xk,yk) of msc(w) satisfying, with the convention that xk+1:=x1, the following conditions:

  1. 1.

    xiyi, for every 1ik,

  2. 2.

    yixi+1 or yiusxi+1, for every 1ik,

  3. 3.

    yixi+1 for some 1ik,

  4. 4.

    xixj and yiyj and xiyj, for every 1i,jk with ij.

Example 4.9.

Figure 7 shows two examples of patterns. In Figure 7(a) the sequence w1 has the pattern (s0,s0,s1,s1,s2,s2), with s0s1, s1s2 and s2s0.

The pattern in Figure 7(b) is (s0,s0,s1,s3), with s0s1, s1s3, and s3uss0.

Proposition 4.10.

Let 𝒜 be 1-schedulable CFM. If 𝒜 is bad then there exists a trace w𝑇𝑟(𝒜) that admits a pattern (x1,y1,,xk,yk).

Proof.

By Lemmas 4.7 and 4.8, there exists a trace w𝑇𝑟(𝒜) such that msc(w) contains a genuine (usw)-cycle ξ. Observe that ξ necessarily contains a arc. The reason is that and usw are both contained in the total order over positions of w, hence, there is no (usw)-cycle in msc(w). In order to transform ξ=(e1,,ek) into a pattern, we insert “identity” arcs of the form (ei,ei) as needed to get an alternating sequence (x1,y1,,xk,yk) satisfying the first three conditions of the definition of patterns (recall that usw is contained in us). The fourth (and last) condition holds because ξ is genuine.

(a) MSC of sequence
w1=3!1(m0) 2!3(m1) 1!2(m2).
(b) MSC of sequence
w2=4!1(m0) 3!4(m1) 3!2(m2) 2?3(m2) 2!1(m3).
Figure 7: Sequences with pattern, and their MSC.
Proposition 4.11.

Let 𝒜 be 1-schedulable. If some 1-scheduling w𝑇𝑟(𝒜) contains a pattern, then 𝒜 is not send-synchronizable.

For the proof of Proposition 4.11 we first provide two technical lemmas. Recall that patterns are cycles. Proposition 4.11 will show a contradiction to send-synchronizability by listing the cycle in two ways. Lemma 4.12 identifies traces corresponding to different listings of the cycle in a such way that the part before the cycle is the same. Lemma 4.13 relates arcs of two equivalent traces with the same send-projection, one of which is rendez-vous.

Lemma 4.12.

Let w𝑇𝑟(𝒜) contain some pattern (x1,y1,,xk,yk). Let also Z={x1,y1,,xk,yk}. Then for every 1ik there exist u,v,u𝐴𝑐𝑡 with uvuw satisfying the following:

  • u is a linearization of 𝑃𝑎𝑠𝑡(Z)𝐹𝑡𝑟(Z)

  • uv is a linearization of 𝑃𝑎𝑠𝑡(Z)

  • v contains xi,yi,,xk,yk,x1,y1,xi1,yi1 as subsequence.

Proof.

As in Lemma 4.7 we start with a prefix containing all events that are ordered causally before the events of the pattern: u is a linearization of 𝑃𝑎𝑠𝑡(Z)𝐹𝑡𝑟(Z).

Consider some j,{1,,k}, j. For readability we write Zi for the infix 𝑃𝑎𝑠𝑡(yi)𝐹𝑡𝑟(xi) of msc(w), for every i.

Let also eZj and fZ. If ef would hold true then, using fy and xje, we would also get xjy, contradicting the definition of pattern. By symmetry, we conclude that ef for all such e,f.

Therefore, for 1ik we can define v as linearization of Zi,Zi+1,Zk,Z1,Zi1. By definition, v contains the subsequence xi,yi,,xk,yk,x1,y1,xi1,yi1.

Lemma 4.13.

Consider w𝑇𝑟(𝒜) and w𝑇𝑟rdv(𝒜) with w|S=w|S. Then for every send events xy in w, with x before y in w:

  • If xy in w, then x<z, where z is the matching receive of y in w: (y,z)msg.

  • If xusy in w, then x<mby in w.

  • If xy in w then xy in w by the same causal path.

Proof.

If xy in w, we know that x is a send on some process p and y is an unmatched send to process p. Because w is a rendez-vous execution, with x before y, we get x<z.

Now suppose that xusy in w. Then x and y are two unmatched sends to the same process. The two sends are matched in w, with x<y, where (x,x)msg,(y,y)msg. Thus xy in w because of <mb.

Finally, if xy in w, then xy holds also in w because every arc of type <,msg,<mb on the causal path from x to y is preserved in w.

Proof of Proposition 4.11.

We assume that 𝒜 is send-synchronizable, and consider some w𝑇𝑟(𝒜) with pattern (x1,y1,,xk,yk). We will assume that the pattern is minimal w.r.t. the following parameter: the size of the pattern is the sum of the lengths of the shortest paths from xj to yj, over all j.

By Lemma 4.12 we can assume that w=uv is a linearization of 𝑃𝑎𝑠𝑡(Z), with Z={x1,y1,,xk,yk}, and x1,y1,,xk,yk occurs as subsequence of v. In addition, u is linearization of 𝑃𝑎𝑠𝑡(Z)𝐹𝑡𝑟(Z).

We know that (x1,y1,,xk,yk) is a pattern in v, and we can assume w.l.o.g. that ykx1. Note that k>1 since x1y1 (by definition of patterns) and x1yk (by definition of ). By Lemma 4.12, for every 1ik there exists some vv such that xi+1,yi+1,,xk,yk,x1,y1,,xi,yi is a subsequence of v. Chose for example i=1.

As 𝒜 is send-synchronizable, there exist z,z𝑇𝑟rdv(𝒜) such that (uv)|S=z|S and (uv)|S=z|S. From Lemma 4.13, we get that there exists a (msg1)-path from x1 to yk in z not going through 𝑟𝑐𝑣(x1), the receive matching x1. Indeed, for each 1ik, we have xiyi in w, so we still have it in z and it does not go through 𝑟𝑐𝑣(x1). We also have yixi+1 or yiusxi+1 in w, for every i. If yixi+1 then yi<𝑟𝑐𝑣(xi+1)msg1xi+1 in z. If yiusxi+1, then yi<mbxi+1 in z. In both cases the arcs do not use 𝑟𝑐𝑣(x1).

We inspect now M:=msc(z). Let p be the process of the send yk (recall that it is also the process of 𝑟𝑐𝑣(x1), because ykx1 ). Because of pattern minimality, we can show that the only send event on p in v is yk. Suppose that some syk is a send on process p with s in v. By definition of u,v, we have xksyk. But then the pattern (x1,y1,,xk,s) would be smaller, contradiction. Again by minimality, we can show that the only send to p in v is x1. First there is no matched send to p in v, because such a send s would satisfy sx1 as x1 is an unmatched send to p, hence, if xjsyj with 1jk, then xjx1, which is forbidden by the definition of patterns. Now if we had some sx1 unmatched send event to p, with say xjsyj and 1j<k, then the pattern (s,yj,,xk,yk) would be smaller. Finally, if j=k, so xksyk, then the predecessor of s on the causal path from xk to s is an event on p, and we can shorten path from xk to yk, obtaining a smaller pattern.

Let us construct z from z by moving 𝑟𝑐𝑣(x1) at the end of the sequence. Observe that z=𝑚𝑎𝑡𝑐ℎ(z|S)=𝑚𝑎𝑡𝑐ℎ(u|S)𝑚𝑎𝑡𝑐ℎ(v|S) and similarly z=𝑚𝑎𝑡𝑐ℎ(u|S)𝑚𝑎𝑡𝑐ℎ(v|S), where 𝑚𝑎𝑡𝑐ℎ:S𝐴𝑐𝑡 is the morphism defined by 𝑚𝑎𝑡𝑐ℎ(p!q(m))=p!q(m)q?p(m). We derive from the previous paragraph that the sequence of actions by p is 𝑟𝑐𝑣(x1)yk in 𝑚𝑎𝑡𝑐ℎ(v|S) and yk𝑟𝑐𝑣(x1) in 𝑚𝑎𝑡𝑐ℎ(v|S). As 𝑟𝑐𝑣(x1) is the last receive by p in z, moving it at the end of the sequence preserves viability, so z is viable. Moreover, the sequence of actions by p in z coincides with that of z, and the sequence of actions by qp in z coincides with that of z. Since z𝑇𝑟(𝒜) and z𝑇𝑟(𝒜), we get that z𝑇𝑟(𝒜).

However, note that now there is a (msg1)-cycle with at least two distinct sends in M:=msc(z). Indeed, we still have in M the (msg1)+ -path of M from x1 to yk, as this path does not go through 𝑟𝑐𝑣(x1), and yk<𝑟𝑐𝑣(x1) in M, finishing the cycle with (𝑟𝑐𝑣(x1),x1)msg1. So z is not 1-schedulable because it contains a non-trivial (msg1)+-cycle with at least two sends, which contradicts our assumption that 𝒜 is 1-schedulable.

4.3 Wrap-Up

In this section, we prove that send-synchronizability is decidable for 1-schedulable CFMs, by assembling the results from the previous subsections. We start with the following observation, which is an immediate consequence of Propositions 4.5, 4.10, and 4.11.

Proposition 4.14.

For every 1-schedulable CFM 𝒜, it holds that 𝒜 is send-synchronizable if, and only if, (1) 𝒜 is good, (2) 𝑇𝑟rdv(𝒜)|S={w𝑇𝑟(𝒜)w is a 1-scheduling}|S and (3) 𝑇𝑟rdv(𝒜)|S is closed under 𝑆𝐼.

Proposition 4.15.

It is decidable to check if a 1-schedulable CFM is good.

Proof sketch..

Let 𝒜 be a 1-schedulable CFM. From Proposition 4.10, we know that 𝒜 is bad if there exists a trace with a pattern. The existence of a pattern can be checked on a 1-scheduling, as by construction two equivalent traces have the same patterns, and 𝒜 is 1-schedulable. Moreover the set of 1-scheduling of 𝒜 is regular.

We guess a bad 1-scheduling on-the-fly, together with the sends that form the pattern. We can assume that the pattern occurs in the order of the sequence. If there exists some bad trace in 𝑇𝑟(𝒜), then there is one with a pattern of size at most 2×||, as otherwise there would be at least three sends of the pattern on the same process, and we would have a shortcut.

Let (x1,y1,,xk,yk) be the pattern we read. We need to check that

  • for each 0ik, xiyi and yixi+1 with either or us, and at least one -arc.

  • and for each 0i,jk with ij, xixj and yiyj and xiyj.

To do so, we will keep for each send s of the pattern the set of processes with actions causally ordered after s, and we will update these sets while reading the bad 1-scheduling. So we need a memory of size O(||2).

From the two previous propositions, we get the following theorem.

Theorem 4.16.

The question whether a 1-schedulable CFM is send-synchronizable is Pspace-complete.

Proof.

Let 𝒜 be a 1-schedulable CFM. From Proposition 4.15, we know that we can check in polynomial space if 𝒜 is good. The two sets 𝑇𝑟rdv(𝒜) and {w𝑇𝑟(𝒜)w is a 1-scheduling} are regular, so we can check in Pspace if they are equal. And from Remark 4.3, we know that we can check if 𝑇𝑟rdv(𝒜)|S is closed under 𝑆𝐼 in Pspace.

For Pspace-hardness, we reduce from the automata intersection problem as in [8], with a send that cannot be received if the intersection of the automata is not empty.

5 Conclusion

We showed that send-synchronizability for mailbox CFMs is undecidable, thus closing the question left open in [11, 9]. We also showed that we can decide in Pspace if a 1-schedulable CFM (which is a property that can be checked in Pspace) is send-synchronizable. We think that the techniques developed for the proof could be used to answer others problems for mailbox CFMs, like the realizability problem. Moreover, even if the class of 1-schedulable systems is decidable, it is quite restrictive. It can be interesting to see if our techniques can be used for k-schedulable CFMs and the more general class of CFMs studied in [8].

References

  • [1] Parosh Aziz Abdulla and Bengt Jonsson. Verifying programs with unreliable channels. Information and Computation, 127(2):91–101, 1996. doi:10.1006/INCO.1996.0053.
  • [2] Samik Basu and Tevfik Bultan. Choreography conformance via synchronizability. In Sadagopan Srinivasan, Krithi Ramamritham, Arun Kumar, M. P. Ravindra, Elisa Bertino, and Ravi Kumar, editors, Proceedings of the 20th International Conference on World Wide Web, WWW 2011, Hyderabad, India, March 28 - April 1, 2011, pages 795–804. ACM, 2011. doi:10.1145/1963405.1963516.
  • [3] Samik Basu and Tevfik Bultan. On deciding synchronizability for asynchronously communicating systems. Theoretical Computer Science, 656:60–75, 2016. doi:10.1016/J.TCS.2016.09.023.
  • [4] Samik Basu, Tevfik Bultan, and Meriem Ouederni. Synchronizability for verification of asynchronously communicating systems. In Viktor Kuncak and Andrey Rybalchenko, editors, Verification, Model Checking, and Abstract Interpretation - 13th International Conference, VMCAI 2012, Philadelphia, PA, USA, January 22-24, 2012. Proceedings, volume 7148 of Lecture Notes in Computer Science, pages 56–71. Springer, 2012. doi:10.1007/978-3-642-27940-9_5.
  • [5] Benedikt Bollig, Cinzia Di Giusto, Alain Finkel, Laetitia Laversa, Étienne Lozes, and Amrita Suresh. A unifying framework for deciding synchronizability. In 32nd International Conference on Concurrency Theory, CONCUR 2021, August 24-27, 2021, Virtual Conference, volume 203 of LIPIcs, pages 14:1–14:18. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2021. doi:10.4230/LIPICS.CONCUR.2021.14.
  • [6] Ahmed Bouajjani, Constantin Enea, Kailiang Ji, and Shaz Qadeer. On the completeness of verifying message passing programs under bounded asynchrony. In Computer Aided Verification - 30th International Conference, CAV 2018, Held as Part of the Federated Logic Conference, FloC 2018, Oxford, UK, July 14-17, 2018, Proceedings, Part II, volume 10982 of Lecture Notes in Computer Science, pages 372–391. Springer, 2018. doi:10.1007/978-3-319-96142-2_23.
  • [7] Daniel Brand and Pitro Zafiropulo. On communicating finite-state machines. Journal of the ACM, 30(2):323–342, 1983. doi:10.1145/322374.322380.
  • [8] Romain Delpy, Anca Muscholl, and Grégoire Sutre. An automata-based approach for synchronizable mailbox communication. In 35th International Conference on Concurrency Theory, CONCUR 2024, September 9-13, 2024, Calgary, Canada, volume 311 of LIPIcs, pages 22:1–22:19. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2024. doi:10.4230/LIPICS.CONCUR.2024.22.
  • [9] Cinzia Di Giusto, Laetitia Laversa, and Kirstin Peters. Synchronisability in mailbox communication. In Proceedings Combined 31st International Workshop onTheoretical Computer Science Expressiveness in Concurrencyand 21st Workshop on Structural Operational Semantics, Calgary, Canada, 9th September 2024, volume 412 of Electronic Proceedings in Theoretical Computer Science, pages 19–34. Open Publishing Association, 2024. doi:10.4204/EPTCS.412.3.
  • [10] Alain Finkel and Étienne Lozes. Synchronizability of communicating finite state machines is not decidable. In Ioannis Chatzigiannakis, Piotr Indyk, Fabian Kuhn, and Anca Muscholl, editors, 44th International Colloquium on Automata, Languages, and Programming, ICALP 2017, July 10-14, 2017, Warsaw, Poland, volume 80 of LIPIcs, pages 122:1–122:14. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2017. doi:10.4230/LIPICS.ICALP.2017.122.
  • [11] Alain Finkel and Étienne Lozes. Synchronizability of communicating finite state machines is not decidable. Logical Methods in Computer Science, 19(4), 2023. doi:10.46298/LMCS-19(4:33)2023.
  • [12] Alain Finkel and Philippe Schnoebelen. Well-structured transition systems everywhere! Theoretical Computer Science, 256(1-2):63–92, 2001. doi:10.1016/S0304-3975(00)00102-X.
  • [13] Xiang Fu, Tevfik Bultan, and Jianwen Su. Synchronizability of conversations among web services. IEEE Transactions on Software Engineering, 31(12):1042–1055, 2005. doi:10.1109/TSE.2005.141.
  • [14] Blaise Genest, Dietrich Kuske, and Anca Muscholl. On communicating automata with bounded channels. Fundamenta Informaticae, 80(1-3):147–167, 2007. URL: http://content.iospress.com/articles/fundamenta-informaticae/fi80-1-3-09.
  • [15] Cinzia Di Giusto, Davide Ferré, Laetitia Laversa, and Étienne Lozes. A partial order view of message-passing communication models. Proceedings of the ACM on Programming Languages, 7(POPL):1601–1627, 2023. doi:10.1145/3571248.
  • [16] Cinzia Di Giusto, Laetitia Laversa, and Étienne Lozes. On the k-synchronizability of systems. In Foundations of Software Science and Computation Structures - 23rd International Conference, FOSSACS 2020, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2020, Dublin, Ireland, April 25-30, 2020, Proceedings, volume 12077 of Lecture Notes in Computer Science, pages 157–176. Springer, 2020. doi:10.1007/978-3-030-45231-5_9.
  • [17] Cinzia Di Giusto, Laetitia Laversa, and Étienne Lozes. Guessing the buffer bound for k-synchronizability. International Journal of Foundations of Computer Science, 34(8):1051–1076, 2023. doi:10.1142/S0129054122430018.
  • [18] Jesper G. Henriksen, Madhavan Mukund, K. Narayan Kumar, Milind A. Sohoni, and P. S. Thiagarajan. A theory of regular MSC languages. Information and Computation, 202(1):1–38, 2005. doi:10.1016/J.IC.2004.08.004.
  • [19] John E. Hopcroft and Jeffrey D. Ullman. Introduction to Automata Theory, Languages, and Computation. Addison-Wesley, 1979.
  • [20] Dietrich Kuske and Anca Muscholl. Communicating automata. In Handbook of Automata Theory, pages 1147–1188. European Mathematical Society Publishing House, Zürich, Switzerland, 2021. doi:10.4171/AUTOMATA-2/9.
  • [21] Leslie Lamport. Time, clocks, and the ordering of events in a distributed system. Communications of the ACM, 21(7):558–565, 1978. doi:10.1145/359545.359563.
  • [22] Elaine Li, Felix Stutz, Thomas Wies, and Damien Zufferey. Complete multiparty session type projection with automata. In Computer Aided Verification - 35th International Conference, CAV 2023, Paris, France, July 17-22, 2023, Proceedings, Part III, volume 13966 of Lecture Notes in Computer Science, pages 350–373. Springer, 2023. doi:10.1007/978-3-031-37709-9_17.
  • [23] Rupak Majumdar, Madhavan Mukund, Felix Stutz, and Damien Zufferey. Generalising projection in asynchronous multiparty session types. In 32nd International Conference on Concurrency Theory, CONCUR 2021, August 24-27, 2021, Virtual Conference, volume 203 of LIPIcs, pages 35:1–35:24. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2021. doi:10.4230/LIPICS.CONCUR.2021.35.
  • [24] Felix Stutz. Asynchronous multiparty session type implementability is decidable - lessons learned from message sequence charts. In 37th European Conference on Object-Oriented Programming, ECOOP 2023, July 17-21, 2023, Seattle, Washington, United States, volume 263 of LIPIcs, pages 32:1–32:31. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2023. doi:10.4230/LIPICS.ECOOP.2023.32.

Appendix A 𝟏-schedulability and related notions

Similar notions to 1-schedulability can be found in several papers [5, 17]. The way unmatched sends are treated in the literature may differ in a significant way. Our notion of 1-schedulable is the same as strongly 1-synchronisable in [5]. The notion of RSC in [15] is more restrictive than 1-schedulable, as it does not allow to permute two unmatched sends to the same process.

Take as an example the trace 0!2(a) 0!1(b) 2!1(c) 2?0(a). It is 1-schedulable since it is equivalent to 2!1(c) 0!2(a) 2?0(a) 0!1(b). But it is not RSC according to [15], since RSC disallows permuting 0!1(b), 2!1(c). Note however that every 1-scheduling is an RSC execution.

Appendix B A necessary and sufficient condition for send-synchronizability

Let 𝒜 be a CFM. Recall that 𝒜 is send-synchronizable if, and only if, for every trace u𝑇𝑟(𝒜), there exists a trace v𝑇𝑟rdv(𝒜) with u|S=v|S. In fact, the trace v is unique if it exists. Indeed, the only candidate for v is 𝑚𝑎𝑡𝑐ℎ(u|S). Recall that 𝑚𝑎𝑡𝑐ℎ:S𝐴𝑐𝑡 is the morphism defined by 𝑚𝑎𝑡𝑐ℎ(p!q(m))=p!q(m)q?p(m). Observe that 𝑚𝑎𝑡𝑐ℎ(u)|S=u for all uS. This leads us to the characterization of send-synchronizability in Lemma B.1 below. The following notations are used in this lemma. For every process p, L(𝒜p) is the language of the LTS 𝒜p (viewed as a non-deterministic automaton with every state final) and u|p is the projection of u𝐴𝑐𝑡 on 𝐴𝑐𝑡p.

Lemma B.1.

A CFM 𝒜 is send-synchronizable if, and only if, for every trace u𝑇𝑟(𝒜), the sequence v=𝑚𝑎𝑡𝑐ℎ(u|S) satisfies v|pL(𝒜p) for every process p.

Proof.

Assume that 𝒜 is send-synchronizable. Let u𝑇𝑟(𝒜) and define v=𝑚𝑎𝑡𝑐ℎ(u|S). Since 𝒜 is send-synchronizable, there exists u𝑇𝑟rdv(𝒜) such that u|S=u|S. We have 𝑚𝑎𝑡𝑐ℎ(u|S)=u since u𝑇𝑟rdv(𝒜). It follows that u=v, hence, v𝑇𝑟rdv(𝒜). This entails that v|pL(𝒜p) for every process p.

Conversely, let u𝑇𝑟(𝒜) and assume that v=𝑚𝑎𝑡𝑐ℎ(u|S) satisfies v|pL(𝒜p) for every process p. The sequence v is clearly rendez-vous, according to the definition of 𝑚𝑎𝑡𝑐ℎ. We derive that v𝑇𝑟rdv(𝒜), since v|pL(𝒜p) for every process p. The observation that v|S=𝑚𝑎𝑡𝑐ℎ(u|S)|S=u|S entails that u|S𝑇𝑟rdv(𝒜)|S, which concludes the proof.

Appendix C Proofs of Section 3

Lemma 3.1. [Restated, see original statement.]

If is a positive instance of Pre-MPCP then there is an initial execution in 𝒯(𝒜()) leading to the configuration (N,N,N;ε,ε,ε).

Proof.

Consider a sequence of indices i1,,ik{1,,K}, with k1, such that i1=1, xi1xik=yi1yik and |xi1xij||yi1yij| for every j{1,,k}. Let us write a1an, with aiΣ, the word xi1xik (or, equivalently, the word yi1yik). Define ej=|xi1xij| and fj=|yi1yij|, for every j{1,,k}. We also put e0=f0=0. Our assumptions on i1,,ik entail, firstly, that ek=fk=n, and, secondly, that ejfj, xij=aej1+1aej and yij=afj1+1afj, for all j{1,,k}.

We show that for every j{1,,k}, there is an execution ρj in 𝒯(𝒜()) from the configuration (N,N,N;ε,vjR,vjV), with vjR=afj1+1aej1 and vjV=a1a1¯afj1afj1¯, to the configuration (N,N,N;ε,wjR,wjV), with wjR=afj+1aej and wjV=a1a1¯afjafj¯. In the execution ρj, the sequence of actions performed by G is G!R(xij)G!V(yij¯), the sequences of receive and send actions performed by R are R?G(yij) and R!V(yij), respectively, and V does not move. These sequences of actions are permitted by the LTSes 𝒜G and 𝒜R (see Figures 2 and 3). To make it clear that such an execution ρj exists, we need to show that these actions can be interleaved in a way that produces an viable sequence (that is, in addition, permitted by the LTS 𝒜R). To reduce clutter, we define b1=afj1+1,,bm=afj, where m=fjfj1. Note that yij=b1bm. Formally, the viable sequence labeling the execution ρj is

G!R(xij)R?G(b1)R!V(b1)G!V(b1¯)R?G(bm)R!V(bm)G!V(bm¯)

This sequence is viable because the contents z of R’s mailbox after G!R(xij) verifies z=vjRxij=afj1+1aej, hence, z admits b1bm as prefix, since b1bm=afj1+1afj and ejfj. It is readily seen that the configuration (N,N,N;ε,wjR,wjV) obtained after ρj verifies wjR=afj+1aej and wjV=a1a1¯afjafj¯.

We also observe that there is an execution ρk+1 in 𝒯(𝒜()) from the configuration (N,N,N;ε,ε,vkV), with vkV=a1a1¯anan¯, to the configuration (N,N,N;ε,ε,ε). The trace of ρk+1 is the viable sequence V?R(a1)V?G(a1¯)V?R(an)V?G(an¯). This sequence of actions is permitted by the LTS 𝒜V (see Figure 4).

By concatenating the executions ρ1,,ρk+1, we get an execution from (N,N,N;ε,ε,ε) to (N,N,N;ε,ε,ε). But this execution does not start from the initial configuration of 𝒯(𝒜()). Along the execution ρ1, G does G!R(x1)G!V(y1¯), since i1=1. So G could as well have started from its initial state. Obviously, the same goes for R and V, since they can move silently from their initial state to the state N. Hence, there exists an execution ρ1 from the initial configuration of 𝒯(𝒜()) to the configuration obtained after ρ1. The concatenation ρ1ρ2ρK provides an initial execution leading to the configuration (N,N,N;ε,ε,ε).

Corollary 3.2. [Restated, see original statement.]

If is a positive instance of Pre-MPCP then there is a trace u𝑇𝑟(𝒜()) containing the action R!V(#), hence, 𝒜() is not send-synchronizable.

Proof.

Starting from the configuration (N,N,N;ε,ε,ε), there is an execution in 𝒯(𝒜()) labelled by

G!R($)R?G($)R!V($)G!V($¯)V?R($)V?G($¯)V!G(#)G?V(#)G!R(#)R?G(#)R!V(#).

If is a positive instance of Pre-MPCP then, according to Lemma 3.1 and the above observation, there is a trace u𝑇𝑟(𝒜()) ending with R!V(#). Obviously, it holds that u|S𝑇𝑟(𝒜())|S. But, as V contains no V?R(#) transition, no trace in 𝑇𝑟rdv(𝒜()) contains the action R!V(#). Hence, u|S𝑇𝑟rdv(𝒜())|S, which entails that 𝒜() is not send-synchronizable.

Lemma 3.3. [Restated, see original statement.]

If there is a trace in 𝑇𝑟(𝒜()) containing the action R!V(#) then is a positive instance of Pre-MPCP.

Proof.

Consider an initial execution ρ in 𝒯(𝒜()) ending with the action R!V(#). By construction, ρ also necessarily contains R?G(#), hence, it also contains G!R(#) and G?V(#), which entails that it contains V!G(#). Therefore, in the execution ρ, the processes R and V have each selected the normal mode, since there is no R!V(#) transition nor V!G(#) transition in the dummy modes. Let π denote the prefix of ρ that ends just before the V!G(#) action, and let u denote the trace labelling π. According to the definition of the LTSes 𝒜G, 𝒜R and 𝒜V (see Figures 2, 3, and 4), the projections u|G, u|R and u|V are as follows:

u|G =G!R(xi1)G!V(yi1¯)G!R(xik)G!V(yik¯)G!R($)G!V($¯)
u|R =R?G(b1)R!V(b1)R?G(bm)R!V(bm)α
u|V =V?R(a1)V?G(a1¯)V?R(an)V?G(an¯)V?R($)V?G($¯)

for some i1,,ik{1,,K} with k1 and i1=1, some a1,,anΣ with n0, some b1,,bm(Σ{$,#}) with m0, and some α that is either ε or a receive action R?G(). The word a1a1¯anan¯$$¯ received by V is a prefix of a shuffle of the word b1bm sent by R to V and of the word yi1¯yik¯$¯ sent by G to V. So a1an$ is a prefix of b1bm and a1¯an¯$¯ is a prefix of yi1¯yik¯$¯. Since $¯ does not occur in yi1¯yik¯, we get that a1an=yi1yik. Similarly, the word b1bm received by R is a prefix of the word xi1xik$ sent by G to R. We derive that a1an$ is a prefix of xi1xik$. Since $ does not occur in xi1xik, this entails that a1an$=b1bm=xi1xik$. We have shown that xi1xik=yi1yik. It remains to prove that |xi1xij||yi1yij| for all j{1,,k}. Before that, we observe that every send action to V is matched in u. Indeed, the length of the word a1a1¯anan¯$$¯ received by V is 2(n+1), and the length of the word sent to V is |b1bm|+|yi1¯yik¯$¯|=2m=2(n+1). This means that the sequence of send actions to V in u is R!V(b1)G!V(b1¯)R!V(bm)G!V(bm¯).

We now show that |xi1xij||yi1yij| for all j{1,,k}. Let j{1,,k} and consider a prefix uj of u such that uj|G=G!R(xi1)G!V(yi1¯)G!R(xij)G!V(yij¯). The projection of uj on 𝐴𝑐𝑡R may be written as uj|R=R?G(b1)R!V(b1)R?G(bh)R!V(bh)β for some h{0,,m} and some β that is either ε or a receive action R?G(). The word b1bh received by R is a prefix of the word xi1xij sent by G to R, so |xi1xij|h. Now, the word sent to V in uj, say z, is a shuffle of the word b1bh sent by R to V and of the word yi1¯yij¯ sent by G to V. The word z is also a prefix of the word b1b1¯bmbm¯ sent to V in u. This entails that |b1bh|=|yi1¯yij¯| or |b1bh|=|yi1¯yij¯|+1. It follows that h|yi1yij| and we conclude that |xi1xij|h|yi1yij|.

Lemma 3.4. [Restated, see original statement.]

For every trace u𝑇𝑟(𝒜()), if u does not contain the action R!V(#) then 𝑚𝑎𝑡𝑐ℎ(u|S)|pL(𝒜p) for every process p{G,R,V}.

Proof.

Let u𝑇𝑟(𝒜()) such that u does not contain the action R!V(#). We consider each process in ={G,R,V} separately. Recall that the LTSes 𝒜G, 𝒜R and 𝒜V of the processes G, R and V are defined in Figures 2, 3, and 4.

Let us start with the guesser process. According to the definition of 𝒜G, there exists a sequence of indices i1,,ik{1,,K}, with k1 and i1=1, such that the sequence of send actions performed by G in u is a prefix of vG!R($)G!V($¯)G!R(#), where v=G!R(xi1)G!V(yi1¯)G!R(xik)G!V(yik¯). According to the definition of 𝒜R and 𝒜V, the sequence of send actions to G in u is either empty or the single action V!G(#). Moreover, if u contains V!G(#) then this action is necessarily after G!V($¯) and before G!R(#). This is due to the receive actions V?G($¯) and G?V(#). We derive that 𝑚𝑎𝑡𝑐ℎ(u|S)|G is a prefix of vG!R($)G!V($¯)G?V(#)G!R(#) and conclude that 𝑚𝑎𝑡𝑐ℎ(u|S)|GL(𝒜G).

We now proceed to the relayer process. According to the definition of 𝒜G and 𝒜V, the sequence of send actions to R in u is a prefix of a sequence of the form G!R(a1)G!R(an)G!R($)G!R(#), with n0 and aiΣ. So the word sent to R in u is a prefix of a1an$#. This entails that the sequence of send actions performed by R in u is in the language {R!V(a)aΣ}{ε,R!V($)}, according to the definition of 𝒜R. Indeed, either R selects the normal mode, in which case the word sent by R to V is a prefix of the word a1an$ (recall that u does not contain the action R!V(#) by assumption), or R selects the dummy mode, in which case the word sent by R to V is in the language Σ{ε,$}. We derive that the projection of u on sends by R, or to R, is in the shuffle of the language {R!V(a)aΣ}{ε,R!V($)} and the language {G!R(m)mΣ{$,#}}. It follows that 𝑚𝑎𝑡𝑐ℎ(u|S)|R is in the shuffle of the language {R!V(a)aΣ}{ε,R!V($)} and the language {R?G(m)mΣ{$,#}}. We conclude that 𝑚𝑎𝑡𝑐ℎ(u|S)|RL(𝒜R), by letting R select the dummy mode.

Let us finally address the verifier process. We consider two cases, depending on whether u contains the action V!G(#) or not. If u does not contain the action V!G(#), then V does not perform any send action in u, according to the definition of 𝒜V. The projection of u on sends to V is in the language ({G!V(m¯)mΣ{$}}{R!V(m)mΣ{$}}), according to the definition of 𝒜G and 𝒜R (recall that u does not contain the action R!V(#) by assumption). It follows that 𝑚𝑎𝑡𝑐ℎ(u|S)|V is in the language ({V?G(m¯)mΣ{$}}{V?R(m)mΣ{$}}). We conclude that 𝑚𝑎𝑡𝑐ℎ(u|S)|VL(𝒜V), by letting V select the dummy mode.

Assume now that u contains the action V!G(#). According to the definition of 𝒜V, this means that u|V is equal to V?R(a1)V?G(a1¯)V?R(an)V?G(an¯)V?R($)V?G($¯)V!G(#) for some a1,,anΣ with n0. The mailbox semantics entails that the word sent to V in u admits a1a1¯anan¯$$¯ as a prefix. When we dealt about the relayer process, we showed that the word sent by R to V is in the language Σ{ε,$}. Moreover, according to the definition of 𝒜G, the word sent by G to V is in the language Σ¯{ε,$¯}. So the word sent to V in u is exactly a1a1¯anan¯$$¯. We derive that the sequence of send actions to V in u is v=R!V(a1)G!V(a1¯)R!V(an)G!V(an¯)R!V($)G!V($¯). Moreover, the single send action performed by V, namely V!G(#), is necessarily after G!V($¯). This is due to the receive action V?G($¯). It follows that 𝑚𝑎𝑡𝑐ℎ(u|S)|V is equal to V?R(a1)V?G(a1¯)V?R(an)V?G(an¯)V?R($)V?G($¯)V!G(#), hence, 𝑚𝑎𝑡𝑐ℎ(u|S)|V=u|V. We conclude that 𝑚𝑎𝑡𝑐ℎ(u|S)|VL(𝒜V).

Corollary 3.5. [Restated, see original statement.]

If is a negative instance of Pre-MPCP then 𝒜() is send-synchronizable.

Proof.

If is a negative instance of Pre-MPCP then we derive from Lemma 3.3 that no trace in 𝑇𝑟(𝒜()) contains the action R!V(#). It follows from Lemma 3.4 that 𝑚𝑎𝑡𝑐ℎ(u|S)|pL(𝒜p) for every trace u𝑇𝑟(𝒜()) and every process p{G,R,V}. We conclude thanks to Lemma B.1 that 𝒜() is send-synchronizable.