Towards Generalised Half-Duplex Systems111This work has been supported by the French government, through the EUR DS4H Investments in the Future project managed by the National Research Agency (ANR) with the reference number ANR-17-EURE- 0004.
Abstract
FIFO automata are finite state machines communicating through FIFO queues. They can be used for instance to model distributed protocols. Due to the unboundedness of the FIFO queues, several verification problems are undecidable for these systems. In order to model-check such systems, one may look for decidable subclasses of FIFO systems. Binary half-duplex systems are systems of two FIFO automata exchanging over a half-duplex channel. They were studied by Cece and Finkel who established the decidability in polynomial time of several properties. These authors also identified some problems in generalising half-duplex systems to multi-party communications. We introduce greedy systems, as a candidate to generalise binary half-duplex systems. We show that greedy systems retain the same good properties as binary half-duplex systems, and that, in the setting of mailbox communications, greedy systems are quite closely related to a multiparty generalisation of half-duplex systems.
1 Introduction
FIFO automata, also known as asynchronous communicating automata (i.e., finite state automata that exchange messages via FIFO queues) are an interesting formalism for modeling distributed protocols. In their most general formulation, these automata are Turing powerful, and in order to be able to model check them it is necessary to reduce their expressiveness.
Binary half-duplex systems, introduced by Cece and Finkel [6], are systems with two participants and a bidirectional channel formed of two FIFO queues, such that communication happens only in one direction at a time. The stereotypical half-duplex device is the walkie-talkie (or the CB). In several applications, in particular when FIFO buffers are bounded and sends may be blocking, half-duplex communications are considered a good practice to avoid send-send deadlocks. Language support for enforcing this discipline of communication includes, for instance, binary session types [15, 16] or Sing# channel contracts [11, 21].
In [6], Cece and Finkel show that (1) whether a system is half-duplex is decidable in polynomial time, (2) the set of reachable configurations is regular, and (3) properties like progress and boundedness are decidable in polynomial time. Cece and Finkel also present two possible notions ‘multiparty half-duplex’ systems generalizing their class to systems of any number of machines for p2p communications (one FIFO queue per pair of machine).
The first generalisation involves assuming that at most one queue over all queues is non-empty at any time. This generalisation preserves decidability but is very restrictive. The second generalisation restricts the communications between each pair of participants to half-duplex communications, that is only one buffer per bidirectional channel can be used simultaneously. This generalisation however does not preserve decidability: the systems captured by this definition form a Turing powerful class. In fact, with just three machines it is possible to mimic the tape of a Turing machine.
It could be believed that these results end the discussion about multi-party half-duplex systems. In this work, we claim conversely that there is another natural and relevant notion of multi-party half-duplex communications that allows us to generalise the results of Cece and Finkel. We introduce greedy systems, which are systems for which all executions can be rescheduled in such a way that all receptions are immediately preceded by their corresponding send. This notion is quite natural, and closely related to other notions like synchronisability [4], -synchronous systems [5], or existentially -bounded system [13] (see Section 6 for a detailed discussion).
In this work, we establish the following results:
-
1.
whether a system is greedy is decidable in polynomial time (when the number of processes is fixed);
-
2.
for greedy systems, all regular safety properties, which includes reachability, absence of unspecified receptions, progress, and boundedness are decidable in polynomial time.
-
3.
we generalize binary half-duplex systems to multiparty mailbox half-duplex systems and we show that (1) mailbox half-duplex systems are greedy, and (2) greedy systems without orphan messages, at least in the binary case, are half-duplex.
The first result follows from techniques developed by Bouajjani et al [5] for -synchronous systems. The main challenge here is that we address a more general model of communicating systems that encompasses both mailbox and p2p communications, but also allows any form of sharing of buffers among processes. The second result is based on an approach that, to the best of our knowledge, is new, although it borrows from some general principles from regular model-checking. The challenge is that, unlike for binary half-duplex systems, the reachability set of greedy systems is not regular, which complicates how automata-based techniques can be used to solve regular safety. The third contribution aims at answering, although incompletely, the question we would like to address with this work: what is a relevant notion of multi-party half-duplex systems?
Outline.
The paper is organised as follows: Section 2 introduces communicating automata and systems. Section 3 defines greedy systems and establishes the decidability of the greediness of a system. Section 4 discusses regular safety for greedy systems. Section 5 compares greedy systems and half-duplex systems, first in the binary setting, then in the multi-party setting, by introducing the notion of mailbox half-duplex systems. Finally, Section 6 concludes with some final remarks and discusses related works.
2 Preliminaries
For a finite set , denotes the set of finite words over , denotes the concatenation of two words, denotes the length of , and denotes the empty word. We assume some familiarity with non-deterministic finite state automata, and we write for the language accepted by the automaton . For two sets and , we write (in bold) for an element of , and for the -th component of , so that .
A FIFO automaton is basically a finite state machine equipped with FIFO queues where transitions are labelled with either queuing or dequeuing actions. More precisely:
Definition 1 (FIFO automaton).
A FIFO automaton is a tuple222 Note that FIFO automata do not have accepting states, therefore they are not a special case of non-deterministic finite state automaton, and there is not such a thing as ”the language of a FIFO automaton”. where (1) is a finite set of control states, (2) is a finite set of messages, (3) is a finite set of buffer identifiers, (4) is a finite set of actions, (5) is the transition relation, and (6) is the initial control state. The size of is .
Actions , for are also denoted by . Given a FIFO automaton , a configuration of is a tuple . The initial configuration is where for all , . A step is a tuple (often written ) where and are configurations and is an action, such that the following holds:
-
•
,
-
•
if , then and for all .
-
•
if , then and for all .
Next, we define systems of FIFO automata. We pick a very general definition, where each FIFO queue might be queued (resp. dequeued) by more than one automaton, and where an automaton might ‘send a message to itself’. Most of the theory can be done in this general setting without extra cost, but we merely have in mind either mailbox systems or p2p systems (defined below).
A FIFO system, later called simply a system, is a family of FIFO automata such that all FIFO automata have disjoint sets of actions: for all , . Each is referred to as a process. The condition on the disjointness of the sets of actions helps to identify the process that is responsible for a given action: for an action , we write to denote the unique (when it exists) such that .
Let us now define mailbox and p2p systems. Informally, a p2p system is a system in which each pair of processes has a dedicated buffer for exchanging messages. Instead, for mailbox communication, each process receives messages from all other processes in a single buffer. Let us now formally define these notions. To this aim, it will be useful to identify what are the buffers an automaton queues in (resp. dequeues from). Hence, for a given FIFO automaton , and for , we write for the set of buffer identifiers such that there exists such that . A system is p2p if for all , , , and . A system is a mailbox system if for all , , and . Thus in a p2p system with processes, there are at most buffers, and in a mailbox system with processes there are at most buffers. A binary system is a system such that and for all , ; note that a binary system is both p2p and mailbox. We sometimes use a more handy notation for actions of a mailbox (resp. p2p) system: if and , we sometimes write instead of and instead of .
Example 1 (FIFO Automata).
Figure 1 shows a graphical representation of a FIFO system, borrowed from [3]. This system represents a protocol between a client, a server and a database logging requests from the client and the server. In this protocol, a client can log something on the database or send requests to the server, when those requests are satisfied the server logs them in a database. Each automaton is equipped with a buffer in which it receives messages from all other participants: this system is an example of a mailbox system. To improve readability of the graphical representation, we refer to the buffers with the initial of the automaton to which they are associated. For example, is the buffer into which the server can receive messages. This simple system will be used as a running example throughout the paper. ∎
The size of is the sum of the . Note that and are independent from the size of . In particular, when we say that an algorithm is in polynomial time, we mean in time for some that may depend on and .
The FIFO automaton associated with is the standard asynchronous product automaton: where and is the set of triples for which there exists such that and for all . We often identify and and write for instance instead of . Similarly, we say that is a configuration of while we mean that is a configuration of . An execution is a sequence of actions. As usual stands for . We write for .
Next, we introduce the definition of reachable configuration:
Definition 2 (Reachable configuration).
Let be a system. A configuration is reachable if there exists such that . The set of all reachable configurations of is denoted .
Given an execution , we say that is a matching pair if there exists a buffer identifier , a message and natural number such that (1) , (2) , (3) is the -th send action on in , and (4) is the -th receive action on in . A communication of is either a matching pair , or a singleton such that does not belong to any matching pair (such a communication is called unmatched). We write to denote the set of communications of .
An execution imposes a total order on the actions. Sometimes, however, it is useful to visualise only the causal dependencies between actions. Message sequence charts [18] are usually used to this aim, as they only depict an order between matched pairs of actions and between actions of the same process. However, message sequence charts do not represent graphically the causal dependencies due to shared buffers, like the ones found in mailbox systems. Here we define action graphs that depict all causal dependencies. When considering p2p communications, action graphs and message sequence charts coincide. We say that two actions commute if and it is not the case that and are two actions of the same type on a same buffer: there is no , and such that and .
Definition 3 (Action graph).
Given an execution , the action graph is the vertex-labeled directed graph where and if (1) and (2) either do not commute, or is a matching pair.
When , we say that happens before . Note that for an execution with , is a partial order. Two executions are causally equivalent, denoted by , if their action graphs are isomorphic. Said differently, are causally equivalent if they are two linearisations of a same happens before partial order. Note that if and , then .
Another graphical tool that we will use to talk about equivalent executions is the conflict graph, which is intuitively obtained from the action graph by merging matching pairs of vertices.
Definition 4 (Conflict graph).
Given an execution , the conflict graph of the execution is the directed graph where for all communications , if there is and such that .
Example 2 (Action and Conflict Graphs).
We go back to the system depicted in Figure 1. One of its executions is
Figure 2(a) shows . Actions of the same process are represented vertically between the same dotted lines. As formally explained in Definition 3, an arc from an action and another means that happens before . To ease readability, the arcs that follow from transitivity are omitted. For example, in a given column, there should be an arc between every pair of actions.
Figure 2(b) shows . To simplify the graph, instead of marking the matching pairs we simply identify them with the message exchanged. Message represent the second send of in the execution above.
∎
3 Greedy systems
In this section we introduce greedy systems. Those systems aim at mimicking rendez-vous or synchronous communications by checking whether each execution can be rescheduled to an equivalent one where all receptions immediately follow their corresponding send.
Definition 5 (Greedy system).
An execution is greedy if all matching pairs are of the form . A system is greedy if for all execution , there exists a greedy execution such that .
Example 3.
The execution is greedy, but the execution is not greedy, although causally equivalent to a greedy execution. ∎
Example 4 (Greedy system).
The system in Figure 1 is greedy. Take for instance execution of the example 2. This execution is not greedy as messages , , and are not received right after their send. Still since those action can commute and by observing that the conflict graph in Figure 2(b) does not present any cycle (see Lemma 6) below), there exists an equivalent greedy execution :
∎
Example 5.
Consider a system with two processes and each sending a message to the other, and whose corresponding receptions only happen after the send (see Figure 3). Then the execution is not causally equivalent to a greedy execution, therefore the whole system is not greedy. ∎
In the remainder of this section, we show that deciding whether a system is greedy is feasible in polynomial time. The proof is in three steps: first, we give a graphical characterisation of the executions that are causally equivalent to greedy executions; second, we show that the non-greediness of a system is revealed by the existence of ‘bad’ executions of a certain shape, called borderline executions. Finally, we show that the graphical characterisation can be exploited to show the regularity of the language of borderline violations, from which we get the decidability of greediness.
Lemma 6.
is causally equivalent to a greedy execution if and only if is acyclic.
Proof.
The left to right implication follows from two observations: first, two causally equivalent executions have isomorphic conflict graphs (because they have isomorphic action graphs), and second, the conflict graph of a greedy execution is acyclic, because for a greedy execution induces . Conversely, let , and assume that is acyclic. Let be a topological order on , be the corresponding greedy execution, and be the permutation such that . The claim is that . Let be two indices of , and let us show that iff . First, is a matching pair of if and only if is a matching pair of , which shows the equivalence in that case. Assume now that is not a matching pair of , and let be the communications of containing and respectively. Assume also that , we show that (the other implication, similar, is omitted). First, implies , which entails because and have the same conflict graph. Moreover, implies that and do not commute, therefore either or . By contradiction let ; then , contradicting the acyclicity of the conflict graph of , which ends the proof. ∎
Definition 7 (Borderline violations).
An execution is a borderline violation if (1) is not causally equivalent to a greedy execution, (2) for some greedy execution and receive action .
Example 6 (Borderline violation).
An example of a borderline violation for the system whose unique maximal execution is the one of Figure 3 is the execution
Figure 3 shows its action and conflict graph. The action graph makes it easy to see that any execution equivalent to will require both the send actions to be done before the first reception, therefore at least one reception will not follow its matching send action. ∎
Lemma 8.
is greedy if and only if contains no borderline violation.
Proof.
Obviously, if contains a borderline violation, is not greedy. Conversely, assume that is not greedy, and let us show that contains a borderline violation. Let be an execution that is not causally equivalent to a greedy execution and of minimal length among all such executions. Then with causally equivalent to a greedy execution. Let be a greedy execution causally equivalent to . Then . Moreover, if is a send action, then is greedy, contradicting the fact that is not causally equivalent to a greedy execution. Therefore, is a borderline violation. ∎
Let denote the set of communications, and let be the set of receive actions. Then a greedy execution can be represented by a word in and a borderline violation is represented by a word in . So now, we define two non-deterministic finite state automata over : the first one accepts all greedy executions of a system, and the second one all borderline violations. We later explain how these automata are used to decide greediness.
Lemma 9.
Let of size and , be fixed. There is a non-deterministic finite state automaton computable in time such that .
Proof.
Let and let be the non-deterministic finite state automaton over with , , , and the transitions defined as follows. First, while reading a letter , if
-
•
for some such that for all , iff , and iff , and
-
•
one of the two following holds
-
–
either ,
-
–
or and and and .
-
–
Second, while reading the letter , if and for some . Then is as announced. Moreover, each transition of can be constructed in constant time, so can be constructed in time as announced. ∎
Lemma 10.
There is a non-deterministic finite state automaton computable in time such that .
Proof.
Let be the non-deterministic finite state automaton over such that , and for all , for all , for all , , (1) (2) , (3) (4) if , and (5) if . Then . Moreover, each transition of can be constructed in constant time, so can be constructed in time as announced. ∎
From the computability of the two previous automata, we deduce the decidability of system greediness.
Theorem 11.
Whether a system of size is greedy is decidable in time .
Proof.
Let and be the two automata defined in Lemmas 9 and 10. By Lemma 6 and by definition of a borderline violation, the set of borderline violations of is . So, by Lemma 8, is greedy if and only if . The claim then directly follows from the fact that emptiness testing for a non-deterministic finite state automaton of size is in time . ∎
4 Model-Checking Greedy Systems
In this section we explore how to verify various safety properties of greedy systems in polynomial time. Since the reachability set of a greedy system is not regular, it is not obvious that regular safety properties are always decidable. We show that this problem actually is decidable, with a polynomial time complexity under mild assumptions. Then, we list a few regular safety properties that were also considered in other works, in particular for approaches based on session types [17, 9, 23].
4.1 Checking Regular Safety Properties
Let with be a system. We identify a word with the configuration . We say that a set of configurations is regular333also called channel recognizable by Cece and Finkel [6, Definition 10] if the corresponding set of words coding these configurations is regular. A property is a function that associates to every system a set of configurations . We say that is regular if is regular for all , and computable in time if a non-deterministic finite state automaton accepting can be computed in time . The safety problem is whether a system is such that . Examples of safety problems are discussed below in Section 4.2.
Cece and Finkel showed that, for a binary half-duplex system , is regular and computable in polynomial time [6, Theorem 26]. Since the emptiness of the intersection of two polynomial time computable regular languages is decidable in polynomial time, for any regular polynomial time property , the safety problem is decidable in polynomial time for binary half-duplex systems.
For greedy systems, however, the situation is a bit different. Indeed, observe that may be non-regular and even context sensitive (it is easy to define a system with one machine and 3 buffers, such that for some control state , ). So it is not obvious how to decide the emptiness of .
Still, the safety problem remains decidable for a computable regular property .
Theorem 12.
Let be a computable regular property. Then, for a given greedy system , the safety problem is decidable. Moreover, if is computable in time for some , then the problem is decidable in time .
Proof.
Let be fixed, with . Let be the polynomial time computable non-deterministic finite state automaton over alphabet such that . We define an automaton over the alphabet of communications such that for all greedy execution , iff there is such that .
Before defining formally, let us give some intuitions about how it works on an example. Assume that reads , and that the final configuration is . While reading , should check the existence of an accepting run of on . When reads a communication, there are two cases. Either the communication is a matched send (like ) and therefore it does not contribute to the final configuration, so merely ignores it. Or the communication is an unmatched send, and it contributes to a piece of the accepting run of on . However, these pieces of the accepting run of are not necessarily consecutive. For instance, in the above execution, and are consecutive in the run of , but reads in between, although contributes only later to the run of . To correctly check the existence of a run of on , uses for each buffer a distinguished ”pebble” placed on a state of . Every time reads an unmatched send , it moves the -th pebble along an transition of . So each pebble checks for a piece of the accepting run of the whole word coding the final configuration. therefore also needs to make sure that all of these pieces of runs can be concatenated to form a run of . Therefore, at the beginning, guesses an initial control state and a final control state for each pebble, and ensures that . While doing so, going back to our example, ensures that can be read by . It remains also to deal with the control state: indeed, should accept . So guesses before reading that the control state will be after executing , and while reading , it computes the current control state of . In the end, it checks that this control state actually is .
Now that we presented the intuitions about , let us define it formally. Let us start with the set of control states. Let . Intuitively, the control state of corresponds to a situation where: (1) the current control state of is , (2) the guessed final control state of is , (3) the -th pebble currently is on state of , and (4) is a copy of the initial positions of the pebbles and will be checked against their final positions in the end to ensure that all pieces of runs can be concatenated.
Let us now define the set of initial control states of . Let us set that if (1) , (2) , and (3) . Intuitively, a control state is initial if (1) is a copy of , (2) the position of the pebble of buffer is on a state that is reachable in after reading and (3) is the initial control state of .
Similarly, let us now define the set of final control states of . Let us set if (1) , (2) for all , , and (3) . Intuitively, a control state is final if (1) the current control state of corresponds to the guessed final one, (2) the -th pebble can be moved along a transition so as to reach the initial position of pebble , and (3) the pebble of the last buffer reached an accepting state of .
Let us now define the set of transitions of . Let us set that
if (1) , (2) , (3) , (4.1) if , then , and (4.2) if , then and for all . Intuitively, when it reads a matched send , only updates according to the sequence of actions , while when it reads an unmatched send it also updates the position of the -th token.
Now that is defined, observe that iff , where is the automaton defined in Lemma 9. The emptiness of this intersection is decidable in time , which shows the claim. ∎
4.2 Examples of Regular Safety Problems
In this section we review a few properties of systems that are polynomial-time computable regular properties and showcase some applications of Theorem 12.
Reachability.
The control state reachability problem is to decide, given a system and a control state , whether there exists and such that . The configuration reachability problem, on the other hand, is to decide, given a system and a configuration , whether . Both problems are safety problems for a regular property computable in polynomial time (and even constant time): for the control state reachability problem, and for the configuration reachability problem.
Unspecified reception.
Unspecified receptions is one of the errors that session types usually forbid. This error makes more sense for mailbox systems, so let us assume for now that is a mailbox system. A configuration is an unspecified reception if one of the participants is in a receiving state, and none of its outgoing transitions can receive the first message in its buffer.
Let us define these notions more formally. A control state of process is a receiving state if for all such that , is a receive action. The set is called the ready set of .
A configuration is said an unspecified reception configuration if there is such that (1) is a receiving state, (2) for some and , and (3) is not in the ready set of . It can be observed that the set of unspecified receptions of defines a regular property that is computable in polynomial time.
Progress.
Another property that is central in session types is progress. A global control state of is final if there is no action and global control state such that . A configuration of satisfies progress if either is final or there is a configuration and an action such that . A system satisfies progress if all reachable configurations satisfy progress. It can be observed that the set of configurations that do not satisfy progress is regular and polynomial time computable.
4.3 Boundedness
There are other examples of properties that are regular and polynomial time, but some interesting ones are not safety properties. To conclude this section, we consider one of these properties.
Definition 13 (Boundedness).
Let be a system and . A channel is -bounded if for all . is -bounded if for all , is -bounded.
Theorem 14.
Whether there exists such that a greedy system is -bounded is decidable in polynomial time. Moreover, is computable in polynomial time.
Proof.
Let be the set of unmatched communications, and the morphism that erase all matched communications. By Lemma 9, and by the closure of regular languages under morphisms, there is a polynomial time computable non-deterministic finite state automaton such that . Then is -bounded for some if and only if is finite, or equivalently if and only if , once pruned (removing states that are not reachable from the initial state and co-reachable from a final state), is acyclic.This is decidable in time , and the maximal length of a word of also is computable in time . ∎
5 Mailbox Half-Duplex Systems
Binary half-duplex systems, (called simply half-duplex by Cece and Finkel [6]) are binary systems such that all reachable configurations are such that either or . In the previous sections, we established that greedy systems enjoy the same decidability and complexity results as binary half-duplex systems. In this section, we defend the claim that greedy systems could also merit the name of multiparty half-duplex systems.
First, observe that binary half-duplex systems are greedy (see [6, Lemma 20]). The converse does not hold in general: some binary greedy systems are not half-duplex. However, under an extra hypothesis, both are equivalent. A system is called without orphan messages if for all reachable configuration containing a message in a buffer, it is possible to reach a configuration where this message has been received. This property is also enforced by session types and is very natural in communicating systems. Then observe that, for a given a binary system without orphan messages, the following two are equivalent: (1) is binary half-duplex, and (2) is greedy.
Let us now consider multiparty systems. Cece and Finkel proposed two notions of multiparty half-duplex systems, but conclude that they were not well behaved (one being too restrictive, and the other Turing powerful). Both of these generalisations relied on peer-to-peer communication. We propose to consider mailbox communication instead.
Definition 15 (Half-duplex execution).
Fix a mailbox system . An execution is half-duplex if for all , if is a send action, then , where .
Intuitively, an execution is half-duplex if every process empties its queue of messages before sending.
Definition 16 (Mailbox half-duplex system).
A mailbox system is mailbox half-duplex if for all execution , there is a half-duplex execution such that .
Example 7.
The system in Figure 1 is half-duplex. Indeed even if execution of Example 2 is not half-duplex, by considering one of its greedy equivalents :
we obtain a half-duplex execution. Notice that execution of Example 4 is greedy but not half-duplex as the send of message is done when the buffer of the Server is filled with message . ∎
Note that a binary system is mailbox half-duplex if and only if it is binary half-duplex. In the remainder, we therefore sometimes say simply half-duplex instead of binary half-duplex or mailbox half-duplex.
Theorem 17.
Mailbox half-duplex systems are greedy.
Proof.
We reason by contradiction. Assume that is not greedy, we show that is not half-duplex. Let be any execution that is not causally equivalent to a greedy execution (for instance, take for a borderline violation). We claim that for all such that , is not half-duplex. Since is not causally equivalent to a greedy execution, we get, by Lemma 6, that contains a cycle of communications where for all , either is a matching pair, or is an unmatched send. We assume that , i.e. is the index of the send action and the index of the receive action. Up to a circular permutation, we can also assume, without loss of generality, that is the first send among them in , i.e. for all . Now, let us reason by case analysis on the nature of the conflict edge .
-
•
case “”: . Then , contradicts the minimality of . Impossible.
-
•
case “”: . Then , impossible.
-
•
case “”: . Then and either (1) or (2) there is , such that and . Because of the mailbox semantics, (1) and (2) are equivalent, so (2) is granted. But then and . Since is a FIFO execution, and , we get that , and again the contradiction.
-
•
case “”: . Then , and . Moreover, by the minimality of . To sum up, let be such that , , and . Then we just showed that , so is not a half-duplex execution.
∎
Notice that the converse of Theorem 17 does not hold: being greedy is not a sufficient condition to be half-duplex. Indeed, an unmatched send can fill the buffer of a process willing to send. More precisely, consider the action graph on the right. It depicts a greedy system that is not half-duplex: in fact the buffer for is not empty when is sent. We conjecture that this is the only pathological situation, and that, like in the binary setting, if a system is greedy and has no orphan messages, then it is half-duplex.
Example 8.
To finish this section we present another small example of a half-duplex system: the classic Client/Seller/Bank protocol. This system is shown in Figure 4. In this protocol a client can ask the price of an item to the seller ( message), and receive the answer. Whenever the client agrees on a price it can place an order (via the message ). Receiving this message the seller initiates a transaction with the bank. The bank asks the client for its credentials, and when it receives them it either authorizes or refuses the transaction, and notifies the seller accordingly. The seller then confirms or cancels the transaction, sending a message to the client. ∎
6 Conclusion
We have introduced greedy systems, a new class of communicating systems, generalising the notion of half-duplex systems to any number of processes, and to an arbitrary model of FIFO communication (encompassing both p2p and mailbox communications). We have shown that the greediness of a system is decidable in polynomial time, and that for greedy systems regular safety properties, such as reachability, progress, and boundedness are decidable in polynomial time. Finally, we defined mailbox half-duplex systems and showed that greedy systems are intimately related to mailbox half-duplex systems.
Still, the picture is a bit incomplete: we did not address liveness properties nor more general temporal properties, and we also did not propose a notion of p2p half-duplex systems that would enjoy all desirable properties. Also, we did not report on experimental evaluation. We leave these questions for future work.
Pachl gave a general decidability result for systems of communicating finite state machines whose reachability set is regular [22]. Although the algorithm is rather brute-force, the MCSCM tool illustrates that it is amenable to an efficient CEGAR optimization [14]. Beyond regularity, and relying on visibly pushdown languages, La Torre et al [27] established that bounded context-switch reachability is also decidable in time exponential in the number of states and doubly exponential in the number of switch. We conjecture that bounded context-switch reachability is complete for greedy systems with a number of switch polynomial in the size of the system.
Several authors considered communicating systems where queues are not plain FIFO but may over-approximate a FIFO behaviour. A representative example of this approach is lossy channels, introduced independently in [7] and [2]. Another example is the bag semantics of buffers where messages are received without loss but out of order. Examples of uses of bag buffers can be found in [26]. Both for lossy and bag systems the reachability problem is decidable but with a high complexity: non primitive recursive for lossy [24, 25]. The exact complexity seems unknown for bag systems, but by reduction to Petri nets it is non-elementary [8].
Aside bounded context-switch model-checking, another form of bounded model-checking has been promoted by Muscholl et al.: the notions of universally and existentially bounded message sequence charts [20]. This leads to two notions of universally/existentially bounded systems (both having unfortunately the same name), depending whether only the MSCs leading to final stable configurations are considered [13] or all MSCs [19]. For the latter definition, reachability and membership are decidable in PSPACE. Greedy systems are existentially -bounded, but the converse does not hold (for instance, the system of Example 5) is existentially -bounded). A system is -synchronous [5] if the message sequence charts of the system are formed of blocks of messages. In particular, a system is -synchronous if the message lines never cross. For systems with p2p communications, greediness is the same as -synchronizability. However, for mailbox communications, some subtle examples are -synchronous but not greedy (see e.g. [10, Example 1.2]). For -synchronous systems, reachability is decidable in PSPACE. Finally, greedy system are synchronizable in the sense of Basu and Bultan [4], but synchronizability is not decidable [12]. We believe that greediness is the notion that Basu and Bultan were aiming at with the notion of synchronizability. It might be wondered if greedy systems were not implicit in Cece and Finkel’s work. Actually, some of their arguments rely on the fact that for half-duplex systems, every execution is ‘reachability equivalent’ to a synchronous execution. This is not exactly the notion of greedy systems we introduced, and our notion of greedy systems is closer to Bouajjani et al notion of -synchronous systems, although, as we just explained, they are not the same in some corner cases.
Session types are intimately related to half-duplex systems in the binary setting [21]. Several multi-party extensions of session types have been proposed, the last proposal being [23]. It seems there are also some similarities between multiparty session types and greedy systems. For instance, the notion of greedy execution shares some similarities with the notion of alternation in [9]. The study of the exact relationship between greedy systems and multi-party session typed systems is left for future work.
Acknowledgements.
We would like to thank all the ICE reviewers for their comments that greatly improved the present paper.
References
- [1]
- [2] Parosh Aziz Abdulla & Bengt Jonsson (1996): Verifying Programs with Unreliable Channels. Inf. Comput. 127(2), pp. 91–101, 10.1006/inco.1996.0053.
- [3] Lakhdar Akroun & Gwen Salaün (2018): Automated verification of automata communicating via FIFO and bag buffers. Formal Methods Syst. Des. 52(3), pp. 260–276, 10.1007/s10703-017-0285-8.
- [4] Samik Basu & Tevfik Bultan (2016): On deciding synchronizability for asynchronously communicating systems. Theor. Comput. Sci. 656, pp. 60–75, 10.1016/j.tcs.2016.09.023.
- [5] Ahmed Bouajjani, Constantin Enea, Kailiang Ji & Shaz Qadeer (2018): On the Completeness of Verifying Message Passing Programs Under Bounded Asynchrony. In Hana Chockler & Georg Weissenbacher, editors: 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, Lecture Notes in Computer Science 10982, Springer, pp. 372–391, 10.1007/978-3-319-96142-2_23.
- [6] Gérard Cécé & Alain Finkel (2005): Verification of programs with half-duplex communication. Inf. Comput. 202(2), pp. 166–190, 10.1016/j.ic.2005.05.006.
- [7] Gérard Cécé, Alain Finkel & S. Purushothaman Iyer (1996): Unreliable Channels are Easier to Verify Than Perfect Channels. Inf. Comput. 124(1), pp. 20–31, 10.1006/inco.1996.0003.
- [8] Wojciech Czerwinski, Slawomir Lasota, Ranko Lazic, Jérôme Leroux & Filip Mazowiecki (2021): The Reachability Problem for Petri Nets Is Not Elementary. J. ACM 68(1), pp. 7:1–7:28, 10.1145/3422822.
- [9] Pierre-Malo Deniélou & Nobuko Yoshida (2012): Multiparty Session Types Meet Communicating Automata. In Helmut Seidl, editor: Programming Languages and Systems - 21st European Symposium on Programming, ESOP 2012, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2012, Tallinn, Estonia, March 24 - April 1, 2012. Proceedings, Lecture Notes in Computer Science 7211, Springer, pp. 194–213, 10.1007/978-3-642-28869-2_10.
- [10] Cinzia Di Giusto, Laetitia Laversa & Étienne Lozes (2020): On the k-synchronizability of Systems. In: FOSSACS 2020, LNCS 12077, pp. 157–176, 10.1007/978-3-030-45231-5_9.
- [11] Manuel Fähndrich, Mark Aiken, Chris Hawblitzel, Orion Hodson, Galen C. Hunt, James R. Larus & Steven Levi (2006): Language support for fast and reliable message-based communication in singularity OS. In Yolande Berbers & Willy Zwaenepoel, editors: Proceedings of the 2006 EuroSys Conference, Leuven, Belgium, April 18-21, 2006, ACM, pp. 177–190, 10.1145/1217935.1217953.
- [12] Alain Finkel & Étienne Lozes (2017): Synchronizability of Communicating Finite State Machines is not Decidable. In Ioannis Chatzigiannakis, Piotr Indyk, Anca Muscholl & Fabian Kuhn, editors: Proceedings of the 44th International Colloquium on Automata, Languages and Programming (ICALP’17), Leibniz International Proceedings in Informatics 80, Leibniz-Zentrum für Informatik, Warsaw, Poland, pp. 122:1–122:14, 10.4230/LIPIcs.ICALP.2017.122.
- [13] Blaise Genest, Dietrich Kuske & Anca Muscholl (2007): On Communicating Automata with Bounded Channels. Fundam. Inform. 80(1-3), pp. 147–167. Available at http://content.iospress.com/articles/fundamenta-informaticae/fi80-1-3-09.
- [14] Alexander Heußner, Tristan Le Gall & Grégoire Sutre (2012): McScM: A General Framework for the Verification of Communicating Machines. In Cormac Flanagan & Barbara König, editors: Tools and Algorithms for the Construction and Analysis of Systems - 18th International Conference, TACAS 2012, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2012, Tallinn, Estonia, March 24 - April 1, 2012. Proceedings, Lecture Notes in Computer Science 7214, Springer, pp. 478–484, 10.1007/978-3-642-28756-5_34.
- [15] Kohei Honda (1993): Types for Dyadic Interaction. In Eike Best, editor: CONCUR ’93, 4th International Conference on Concurrency Theory, Hildesheim, Germany, August 23-26, 1993, Proceedings, Lecture Notes in Computer Science 715, Springer, pp. 509–523, 10.1007/3-540-57208-2_35.
- [16] Kohei Honda, Vasco Thudichum Vasconcelos & Makoto Kubo (1998): Language Primitives and Type Discipline for Structured Communication-Based Programming. In Chris Hankin, editor: Programming Languages and Systems - ESOP’98, 7th European Symposium on Programming, Held as Part of the European Joint Conferences on the Theory and Practice of Software, ETAPS’98, Lisbon, Portugal, March 28 - April 4, 1998, Proceedings, Lecture Notes in Computer Science 1381, Springer, pp. 122–138, 10.1007/BFb0053567.
- [17] Kohei Honda, Nobuko Yoshida & Marco Carbone (2016): Multiparty Asynchronous Session Types. J. ACM 63(1), pp. 9:1–9:67, 10.1145/2827695.
- [18] ITU-TS: ITU-TS Recommendation Z.120: Message Sequence Chart (MSC). ITU-TS (1999).
- [19] Dietrich Kuske & Anca Muscholl (2019): Communicating Automata. In J.-E. Pin, editor: Handbook of Automata: from Mathematics to Applications (AutoMathA), European Science Foundation. Available at https://eiche.theoinf.tu-ilmenau.de/kuske/Submitted/cfm-final.pdf.
- [20] Markus Lohrey & Anca Muscholl (2004): Bounded MSC communication. Inf. Comput. 189(2), pp. 160–181, 10.1016/j.ic.2003.10.002.
- [21] Étienne Lozes & Jules Villard (2011): Reliable Contracts for Unreliable Half-Duplex Communications. In: WS-FM 2011, LNCS 7176, pp. 2–16, 10.1007/978-3-642-29834-9_2.
- [22] Jan K. Pachl (2003): Reachability problems for communicating finite state machines. CoRR cs.LO/0306121. Available at http://arxiv.org/abs/cs/0306121.
- [23] Alceste Scalas & Nobuko Yoshida (2019): Less is more: multiparty session types revisited. Proc. ACM Program. Lang. 3(POPL), pp. 30:1–30:29, 10.1145/3290343.
- [24] Philippe Schnoebelen (2002): Verifying lossy channel systems has nonprimitive recursive complexity. Inf. Process. Lett. 83(5), pp. 251–261, 10.1016/S0020-0190(01)00337-4.
- [25] Philippe Schnoebelen (2021): On Flat Lossy Channel Machines. In Christel Baier & Jean Goubault-Larrecq, editors: 29th EACSL Annual Conference on Computer Science Logic, CSL 2021, January 25-28, 2021, Ljubljana, Slovenia (Virtual Conference), LIPIcs 183, Schloss Dagstuhl - Leibniz-Zentrum für Informatik, pp. 37:1–37:22, 10.4230/LIPIcs.CSL.2021.37.
- [26] Koushik Sen & Mahesh Viswanathan (2006): Model Checking Multithreaded Programs with Asynchronous Atomic Methods. In Thomas Ball & Robert B. Jones, editors: Computer Aided Verification, Springer Berlin Heidelberg, Berlin, Heidelberg, pp. 300–314, 10.1007/11817963_29.
- [27] Salvatore La Torre, P. Madhusudan & Gennaro Parlato (2008): Context-Bounded Analysis of Concurrent Queue Systems. In C. R. Ramakrishnan & Jakob Rehof, editors: Tools and Algorithms for the Construction and Analysis of Systems, 14th International Conference, TACAS 2008, Held as Part of the Joint European Conferences on Theory and Practice of Software, ETAPS 2008, Budapest, Hungary, March 29-April 6, 2008. Proceedings, Lecture Notes in Computer Science 4963, Springer, pp. 299–314, 10.1007/978-3-540-78800-3_21.