Bounded Reachability Problems are Decidable in FIFO Machines

The undecidability of basic decision problems for general FIFO machines such as reachability and unboundedness is well-known. In this paper, we provide an underapproximation for the general model by considering only runs that are input-bounded (i.e. the sequence of messages sent through a particular channel belongs to a given bounded language). We prove, by reducing this model to a counter machine with restricted zero tests, that the rational-reachability problem (and by extension, control-state reachability, unboundedness, deadlock, etc.) is decidable. This class of machines subsumes input-letter-bounded machines, flat machines, linear FIFO nets, and monogeneous machines, for which some of these problems were already shown to be decidable. These theoretical results can form the foundations to build a tool to verify general FIFO machines based on the analysis of input-bounded machines.

recognizable and effectively computable), but the natural extension to three processes leads to undecidability. Lossy FIFO systems (where the channels can lose messages) [ACBJ04,Fin94] have been shown to be well-structured and have a decidable (but nonelementary) reachability problem [CS08]. In [MP11,AGK14], uniform criteria for decidability of reachability and model-checking questions are established for communicating recursive systems whose restricted architecture or communication mechanism gives rise to behaviours of bounded tree-width.
Input-bounded FIFO machines. Many papers, starting in the 80s until today, have studied FIFO machines in which the input-language of a channel (i.e. the set of words that record the messages entering a channel) is included in the set Pref (w * 1 w * 2 . . . w * n ) of prefixes of a bounded language w * 1 w * 2 . . . w * n . We call this class of FIFO machines input-bounded. If the set of letters that may enter a channel c is reduced to a unique letter a c , then the input-language of c is included in a * c and this subclass trivially reduces to VASS and Petri nets [YG83]. Also note that, in general, the behaviour of those FIFO machines does not have bounded tree-width. Monogeneous FIFO nets [Fin82,MF85,FS01] (input-languages of channels c are included in Pref (u c v * c ) where u c , v c are two words associated with c) and linear FIFO nets [FC87] (input-languages are included in Pref (a * 1 a * 2 . . . a * n ) where each a i is a letter and a i = a j iff i = j) both generalize Petri nets with still a decidable reachability problem. A variant of the reachability problem, the deadlock problem, is shown decidable for input-letter -bounded FIFO systems in [GGLR87] by reducing to reachability for VASS, but the extension to general input-bounded machines was left open.
Flat machines are another subclass of input-bounded machines in which the language of their control-graph, considered as a finite automaton, is a bounded language. For flat FIFO machines, control-state reachability is NP-complete [EGM12]; this result has recently been extended to reachability, channel unboundedness, and other classical properties [FP19].
To the best of our knowledge, the decidability status of control-state reachability, reachability, deadlock, and termination was not known for input-bounded FIFO machines, which strictly include all the classes discussed above such as flat, input-letter-bounded, monogeneous, and linear FIFO machines (the last three types contain VASS and they are all incomparable). The unboundedness problem of input-bounded FIFO machines was shown decidable in [JJ93] by using the well-structured concepts but with no extension to decidability of reachability.
Contributions. Our contributions can be summarized as follows: • We solve a problem that was left open in [GGLR87], the decidability of the reachability problem for input-bounded FIFO machines. We present a simulation of input-bounded FIFO machines by counter machines with restricted zero tests. The main idea is to associate a counter with each word in the bounded language, and to ensure that the counters are incremented and decremented in a way that corresponds to the FIFO order.
Since we can have repeated letters, and ambiguities in the FIFO machine, we first need to construct a normal form of the FIFO machine. Furthermore, we ensure that for every run in the FIFO machine, we can construct an equivalent run in the counter machine and vice-versa. • As we actually solve the general rational-reachability problem, we can deduce the decidability of other verification properties like control-state reachability, deadlock, unboundedness, and termination. • We unify various definitions from the literature, survey the (not well-known) results, and generalize them. • We study the natural dual of the input-bounded reachability problem, which are systems of output-bounded languages in which the set of words received by each channel is constrained to be bounded, and are able to deduce the reachability, unboundedness, termination and control-state reachability for the same. • We obtain better upper bounds for the input-bounded reachability of FIFO machines with a single channel (reachability is still undecidable for FIFO machines with a single channel). This is done by reducing it to reachability in unary ordered multi-pushdown systems (a class that was previously analyzed in [ABH17]). It is, hence, solvable in EXPTIME. • Following the bounded verification paradigm, applied to FIFO machines (for instance in [EGM12,FP19]), we open the way to a methodology that would apply existing results on input-bounded FIFO machines to general FIFO machines.
Plan. In Section 2, we present counter and FIFO machines, with the connection-deconnection protocol as an example. Section 3 contains the main result, which states the decidability of rational-reachability for FIFO machines restricted to input-bounded languages. Sections 4 and 5 consider variants of the rational reachability problem such as deadlock, unboundedness and termination. In Section 6, we consider the output-bounded reachability problem, and other variants such as boundedness and termination. We look at the input-bounded problems FIFO machines with a single channel, and obtain some lower bounds in Section 7. Finally, in Section 8, we mention further results, state some open problems, and discuss a possible theory of boundable FIFO machines. A preliminary version of this work has been presented at the 31st International Conference on Concurrency Theory (CONCUR '20). Our contributions extend the conference version as follows: This work additionally considers the symmetric case of output-bounded languages in which the set of words received by each channel is constrained to be bounded. We are able to deduce the reachability, unboundedness, termination and control-state reachability for the same. It also studies the special case of input-bounded FIFO machines with a single channel (reachability is still undecidable for general FIFO machines with a single channel). This is done by reducing it to reachability in unary ordered multi-pushdown systems (a class that was previously analyzed). It is, hence, solvable in EXPTIME. We also expand on the proof idea for boundedness and termination for input-bounded FIFO machines, and provide the explicit construction for the decidability of the same.

Preliminaries
Words and Languages. Let A be a finite alphabet. As usual, A * is the set of finite words over A, and A + the set of non-empty finite words. We let |w| denote the length of w ∈ A * . For the empty word ε, we have |ε| = 0. Given a ∈ A, let |w| a denote the number of occurrences of a in w. With this, we let Alph(w) = {a ∈ A | |w| a ≥ 1}. The concatenation of two words u, v ∈ A * is denoted by u · v or u.v or simply uv. The sets of prefixes, suffixes, and infixes of w ∈ A * are denoted by Pref (w), Suf (w), and Infix (w), resp. Note that {ε, w} ⊆ Pref (w) ∩ Suf (w) ∩ Infix (w). For a set X, any mapping f : A * → 2 X Semi-Linear Sets. A linear set X (of dimension d ≥ 1) is defined as a subset of N d for which there exist a basis b ∈ N d and a finite set of periods {p 1 , . . . , p m } ⊆ N d such that . . , λ m ∈ N}. A semi-linear set is defined as a finite union of linear sets.
Transition Systems. A labeled transition system is a quadruple T = (S, A, →, init) where S is the (potentially infinite) set of configurations 1 , A is a finite alphabet, init ∈ S is the initial configuration, and → ⊆ S × A × S is the transition relation.
For s, s ∈ S, let s → s if s a − → s for some a ∈ A. For w ∈ A * , we write s Given w ∈ A * , we let Reach T (w) = {s ∈ S | init w − → s}. Moreover, for L ⊆ A * , Reach T (L) = w∈L Reach T (w) is the set of configurations that are reachable via a word from L. Finally, the reachability set of T is defined as Reach T = Reach T (A * ). We call T finite if Reach T is finite (and this is the case if S is finite). Otherwise, T is called infinite.
FIFO Machines. We consider FIFO machines having a sequential control graph rather than systems of communicating processes that are distributed systems. It is clear that, given a distributed system, one may compute the Cartesian product of all processes to obtain a FIFO machine (the converse is not always true).
Definition 2.2. A FIFO machine is a tuple M = (Q, Ch, Σ, T, q 0 ) where Q is a finite set of control states, q 0 ∈ Q is an initial control state, and Ch is a finite set of channels. Moreover, Σ is a finite message alphabet. It is partitioned into Σ = c∈Ch Σ c where Σ c contains the messages that can be sent through channel c.
Ch and a ∈ Σ c } is the set of send and receive actions.
Example 2.3 (Connection-Deconnection Protocol). A model for the (simplified) connectiondeconnection protocol, CDP, between two processes is described as follows (see Figure 1): We model the protocol with two automata (representing the two processes) and two (infinite) channels. The first processes (on the left) can open a session (this is denoted by sending the message "a" through channel c 1 to the other process). Once a session is open, the first process can close it (by sending message "b" to the other process), or on the demand of the second process (if it receives the message "e"). This protocol has been studied in [Jér91]. 1 We say configurations rather than states to distinguish them from the control states used in FIFO and counter machines. In the example, it is natural to have two separate processes. However, following Definition 2.2, we formalize this in terms of the Cartesian product of the two processes. That is, the CDP is modeled as the FIFO machine M = (Q, Ch, Σ, T, q 0 ) where Q = {0, 1} × {0, 1} (the Cartesian product of the local state spaces) with initial state q 0 = (0, 0), Ch = {c 1 , c 2 }, Σ = Σ c 1 Σ c 2 with Σ c 1 = {a, b} and Σ c 2 = {e}. Moreover, the transition relation T contains, amongst others, ((0, 0), c 1 !a , (1, 0)) and ((1, 0), c 1 ?a , (1, 1)).
Counter Machines. We next recall the notion of counter machines, where multiple counters can take non-negative integer values, be incremented and decremented, and be tested for zero (though in a restricted fashion).
Definition 2.5. A counter machine (with zero tests) is a tuple C = (Q, Cnt, T, q 0 ). Like in a FIFO machine, Q is the finite set of control states and q 0 ∈ Q is the initial control state. Moreover, Cnt is a finite set of counters and T ⊆ Q × A C × Q is the transition relation where The counter machine C induces a transition system T C = (S C , A C , → C , init C ) with set of configurations S C = Q×N Cnt . In (q, v) ∈ S C , q is the current control state and v = (v x ) x∈Cnt represents the counter values. The initial configuration is init C = (q 0 , 0) where 0 maps all counters to 0. For op ∈ {inc, dec}, x ∈ Cnt, and Z ⊆ Cnt (the counters tested for zero), The reachability set of C is defined as Reach C = Reach T C . For L ⊆ A * C , we also let Reach C (L) = Reach T C (L). Moreover, Traces(C) = Traces(T C ). To get decidability of reachability in counter machines, we impose the restriction that, once a counter has been tested for zero, it cannot be incremented or decremented anymore. This is clearly an extension of VASS. To define this, let L zero C be the set of words (op 1 (x 1 ), Theorem 2.6. The following problem is decidable (though inherently non-elementary): Given a counter machine C = (Q, Cnt, T, q 0 ), a regular language L ⊆ A * C , a control state q ∈ Q, and a semi- Proof sketch. Reachability in presence of a semi-linear target set and restricted zero tests straightforwardly reduces to configuration-reachability in counter machines without zero tests (i.e., VASS and Petri nets). The latter is decidable [May84], though inherently nonelementary [CLL + 19]. First, zero tests are postponed to the very end of an execution and, to this aim, stored in the control-state. Second, to check whether a counter valuation is contained in V , we can branch, whenever we are in the given control-state q, into a new component that decrements counters accordingly and eventually checks whether they are all zero.

The Input-Bounded Rational-Reachability Problem
It is very well known that the following reachability problem is undecidable: Given a FIFO machine M = (Q, Ch, Σ, T, q 0 ), a configuration (q, w) ∈ S M , and a regular language L ⊆ A * M , do we have (q, w) ∈ Reach M (L)? Of course, the problem is already undecidable when we impose L = A * M . Motivated by this negative result, we are looking for language classes C that render the problem decidable under the restriction that L ∈ C.
We say that a FIFO machine M = (Q, Ch, Σ, T, q 0 ) has a bounded reachability set if there is a tuple (L c ) c∈Ch of regular bounded languages L c ⊆ Σ * c such that, for all (q, w) ∈ Reach M , we have w ∈ c∈Ch L c . We observe that restricting the reachability set to be bounded is not sufficient to obtain a decidable reachability problem. We show this by simulating any two counter Minsky machine by a FIFO machine with fixed languages L c .
Theorem 3.1. The reachability problem is undecidable for FIFO machines with a (given) bounded reachability set.
Proof. We prove this by simulating a (two) counter Minsky machine by a FIFO machine with a bounded reachability set. Intuitively, if the two counters have values x 1 and x 2 at a state q, the FIFO machine is at state q with channel contents $a x 1 #b x 2 &.
Consider a Minsky machine C = (Q, Cnt, T, q 0 ), where Q is the set of states, Cnt = {x 1 , x 2 } is the set of counters, q 0 the initial state, and T = {δ 1 , . . . , δ n } is the set of transition rules, which can be of two types from any stateq ∈ Q: • δ i : x j := x j + 1; goto q; • δ i : if x j > 0 then (x j := x j − 1; goto q) else goto q ; for j = {1, 2} and q, q ∈ Q.
We can construct a FIFO machine M = (Q , Ch, Σ, T, q 0 ) with a bounded reachability set as follows: There is a single channel, hence |Ch| = 1. We consider the language L = $ * a * # * b * & * $ * a * # * b * & * , and we start with queue contents as $#&, where the letters #, $, & are used as markers during the test for zero. The number of occurrences of the letter a (resp. b) corresponds to the counter valuations for x 1 (resp. x 2 ) in the configurations of the Minsky machine, and we rotate the tape contents in such a way that the contents always belong to L. For every state q ∈ Q and every transition from it with the rule δ i : x 1 := x 1 + 1; goto q; for some q ∈ Q, we create the following transition sequence. We ensure that we read the markers, and add an additional letter a to the channel. We see that at every intermediate configuration, the channel contents still belongs to L. can be constructed as show in Figure 3. Here, in the first case (x 1 > 0) we ensure that at least one letter a is read from the channel contents, and rewrite the rest of the contents as is. If x 1 = 0, then we read only the end markers (and letters b, if any) and rewrite them once again. Similar constructions can be made for all transitions, and the queue contents are always contained in $ * a * # * b * & * $ * a * # * b * & * . Hence, the reachability set of the FIFO machine is letter-bounded (but it is not distinct-letter).
Remark 3.2. We see, in the previous proof, that the input language of the above machine is not bounded: If we have a transition from q in the original machine of the kind δ i : x j := x j + 1; goto q; (a loop), the input language of the machine would be ($ * a * #b * &) * for this transition, which is not bounded. Furthermore, the machine is not flat either, since there can be control states that are in more than one elementary loop.
We therefore consider a different restriction to obtain decidability. For a given FIFO machine M = (Q, Ch, Σ, T, q 0 ), we are interested in Reach M (L) where L ⊆ A * M is inputbounded in the following sense: For every channel c, the sequence of messages that are sent through channel c is from a given regular bounded language L c ⊆ Σ * c . Let us be more formal. For c ∈ Ch, we let proj c! : A * M → Σ * c be the homomorphism defined by proj c! ( c!a ) = a for all a ∈ Σ c , and proj c! (β) = ε if β ∈ A M is not of the form c!a for some a ∈ Σ c . We define proj c? : We observe that, if all L c are regular, then so are ℒ ! and ℒ ? .
Example 3.4. Let us come back to the protocol CDP M from Example 2.3 and Figure 1, which is neither monogeneous nor linear nor flat. Since the "input-languages" of the two channels (i.e. the languages of words that record the messages entering a channel) contain {a, ab} * and e * , resp., and since {a, ab} * is not a bounded language, we have Traces(M ) ⊆ ℒ ! for every pair of bounded languages ℒ. In other words, M is not input-bounded. However, when we look at the reachability set obtained by considering the tuple of bounded languages ℒ = (L c 1 , L c 2 ) where L c 1 = (ab) * (a + ε)(ab) * is a bounded language over (ab, a, ab), and L c 2 = e * is a bounded language over (e), we still obtain the entire reachability set. That is, we have Reach M = Reach M (ℒ ! ). Hence, even though the input-languages of the system are not all bounded, we can still compute the reachability set by restricting our exploration to a tuple of (regular) bounded languages ℒ.
Actually, instead of reachability of a single configuration as stated in Definition 3.3, we study a more general problem, called the input-bounded rational-reachability problem. It asks whether a configuration (q, w) is reachable for some channel contents w from a given rational relation. So let us define rational relations.
Rational and Recognizable Relations. Consider a relation ℛ ⊆ c∈Ch Σ * c . We say that ℛ is rational if there is a regular word language R ⊆ Θ * over the alphabet Θ = c∈Ch (Σ c ∪ {ε}) such that ℛ = {(a 1 c · · · · · a n c ) c∈Ch | a 1 · · · a n ∈ R with n ∈ N and a i = (a i c ) c∈Ch ∈ Θ for i ∈ {1, . . . , n}}. Here, a 1 c · · · · · a n c ∈ Σ * c is the concatenation of all a i c ∈ Σ c ∪ {ε} while ignoring the neutral element ε. For example, in the presence of two channels, ℛ = {(a m , b n ) | m ≥ n} is a rational relation, witnessed by R = ((a, b) + (a, ε)) * . In the following, we will always assume that a rational relation is given in terms of a finite automaton for the underlying regular language R. A relation ℛ ⊆ c∈Ch Σ * c is called recognizable if it is the finite union of relations of the form c∈Ch R c where all R c ⊆ Σ * c are regular languages. Note that every recognizable relation is rational while the converse is, in general, false.
We define the Parikh image of a relation ℛ ⊆ c∈Ch Σ * c as Parikh(ℛ) = {(π a ) a∈Σ ∈ N Σ | ∃w = (w c ) c∈Ch ∈ ℛ : π a = |w c | a for all c ∈ Ch and a ∈ Σ c }. It is well known that, if ℛ is rational, then Parikh(ℛ) is semi-linear.
For more background on rational relations and their subclasses, we refer to [Ber79,Cho06].
The IB Rational-Reachability Problem. We are now prepared to define the inputbounded (IB) rational-reachability problem and to state its decidability: Definition 3.5. The IB rational-reachability problem is defined as follows: Given a FIFO machine M = (Q, Ch, Σ, T, q 0 ), a tuple ℒ = (L c ) c∈Ch of non-empty regular bounded languages L c ⊆ Σ * c (each given in terms of a finite automaton), a control state q ∈ Q, and a rational relation ℛ ⊆ c∈Ch Σ * c . Do we have (q, w) ∈ Reach M (ℒ ! ) for some w ∈ ℛ? Theorem 3.6. IB rational-reachability is decidable for FIFO machines.
The remainder of this section is devoted to the proof of Theorem 3.6. Let M = (Q, Ch, Σ, T, q 0 ) and let ℒ = (L c ) c∈Ch be a tuple of non-empty regular bounded languages L c ⊆ Σ * c over (w c,1 , . . . , w c,nc ). We proceed by reduction to counter machines. The rough idea is to represent the contents of channel c in terms of several counters, one for every component w c,i . To have a faithful simulation, we rely on a normal form of M and its bounded languages, which can be achieved at the expense of an exponential blow-up of the FIFO machine.
Definition 3.7. We say that M and ℒ are in normal form if the following hold: (1) For all c ∈ Ch, Σ c ⊆ Alph(L c ) and L c is distinct-letter.
Given a FIFO machineM = (Q, Ch,Σ,T ,q 0 ) and the tupleL = (L c ) c∈Ch of nonempty regular bounded languagesL c ⊆Σ * c , we now construct M = (Q, Ch, Σ, T, q 0 ) and ℒ = (L c ) c∈Ch in normal form such that a reachability query in the former can be transformed into a reachability query in the latter (made precise in Lemma 3.10 below).
Distinct-Letter Property. Consider the bounded languageL c over (ŵ c,1 , . . . ,ŵ c,nc ). For i ∈ {1, . . . , n c }, let m i = |ŵ c,1 | + . . . + |ŵ c,i | be the number of letters in the first i words. Moreover, m = m nc . Let Σ c denote the alphabet {a c 1 , . . . , a c m }. It contains the "distinct" letters for the bounded language L c over (w c,1 , . . . , w c,nc ), where we let w c,1 = a c 1 . . . a c m 1 and In other words, the letters in (w c,1 , . . . , w c,nc ) are numbered consecutively. In order to obtain the language L c , we first consider the homomorphism h c : Σ * c →Σ * c where h c (a c i ) is the i-th letter in the wordŵ c,1 . . .ŵ c,nc . We obtain L c as h −1 c (L c ) ∩ (w c,1 ) * . . . (w c,nc ) * , hence preserving regularity and boundedness. We then remove those words from (w c,1 , . . . , w c,nc ) (and their letters from Σ c ) whose letters do not occur in L c . We have Σ c ⊆ Alph(L c ).

BOUNDED REACHABILITY PROBLEMS ARE DECIDABLE IN FIFO MACHINES
Vol. 18:1 Example 3.8. For example, suppose we have one channel c andL c = (ab) * bb * over (ab , b).
We determine the language L c over (a 1 a 2 , a 3 ) (omitting the superscript c in the letters). The homomorphism h c : We thus get the regular bounded language L c = (a 1 a 2 ) * a 3 a * 3 over (a 1 a 2 , a 3 ). All letters from {a 1 , a 2 , a 3 } occur in L c so that we are done.
Trace Property. In the next step, we build the FIFO machine To continue our above example, a transition (q, c!b , q ) would be replaced with the two transitions (q, c!a 2 , q ) and (q, c!a 3 , q ), and similarly for (q, c?b , q ).
To guarantee trace inclusion in Pref ( ), we will consider a deterministic (not necessarily complete) finite automaton and where, from every state, a final state is reachable in the finite graph (Q A , T A ). With this, we define M as the product of the FIFO machine h −1 (M ) = (Q, Ch, Σ, h −1 (T ),q 0 ) and A in the expected manner. In particular, the set of control states of M isQ × Q A , and its initial state is the pair (q 0 , q 0 A ). Example 3.9. Figure 4 illustrates the result of the normalization procedure for a FIFO machineM with one single channel c (which is therefore omitted) and its bounded languagê L c = (ab) * bb * over (ab , b). Recall from Example 3.8 that the corresponding homomorphism h c maps a 1 to a and both a 2 and a 3 to b, and that we obtain L c = (a 1 a 2 ) * a 3 a * 3 . Moreover, M is the product of h −1 (M ) (depicted in the top center) and a finite automaton A for = ℒ ! ∩ Pref (ℒ ? ) (obtained as the shuffle of the two finite automata on the top right). The state names in M reflect the states ofM and A they originate from. We depict only accessible states of M from which we can still complete the word read so far to a word in . For example, (q 1 , M, L) and (q 1 , L, R) would no longer allow us to reach the final state R of the ℒ ! -component. Now suppose we are given a reachability query forM in terms ofq ∈Q and a rational relationR ⊆ c∈ChΣ * c . The lemma below shows how to reduce it to a reachability query in for all c ∈ Ch and a ∈ Σ c , and we extend this to h : A * M → A * M in the expected manner.
Proof. Let us assume we have (q,ŵ) ∈ ReachM (L ! ) for someŵ ∈R. Hence, there existŝ There is a unique σ ∈ A * M such that h(σ) =σ and proj c! (σ) = w c and proj c? (σ) ∈ Pref (w c ) for all c ∈ Ch. Here, h : Σ * →Σ * is defined by h(a) = h c (a) for all c ∈ Ch and a ∈ Σ c , and  we extend this to h : A * M → A * M in the expected manner. Note that σ ∈ ℒ ! ∩ Pref (ℒ ? ). Hence, we know that in the FIFO machine h −1 (M ), one has (q 0 , ε) σ − → (q, w) for some w (by construction of h −1 (T )), and that σ ∈ L(A). Therefore, since M is a product of the two machines, we can deduce that there is a run in M of the kind ((q 0 , q 0 Conversely, let us assume that ((q, q A ), w) ∈ Reach M (ℒ ! ) for some q A ∈ Q A and channel contents w ∈ h −1 (R). Then, we know that there exists σ ∈ ℒ ! such that ((q 0 , q 0 We deduceσ ∈L ! . Furthermore, we can executeσ inM (by construction) to reach configuration (q,ŵ) for someŵ. Byσ = h(σ), we haveŵ = h(w). Therefore,ŵ ∈R.
Reduction of Normal Form to Counter Machine. Henceforth, we suppose that M = (Q, Ch, Σ, T, q 0 ) and ℒ = (L c ) c∈Ch are in normal form, where L c is a bounded language over (w c,1 , . . . , w c,nc ). In particular, for every letter a ∈ Σ c , there is a unique index i ∈ {1, . . . , n c } such that a ∈ Σ c,i where Σ c,i = Alph(w c,i ). We denote this index i by i a .
We build a counter machine C such that the IB rational-reachability problem for M can be solved by answering a reachability query in C, using Theorem 2.6. Each run in C will simulate a run in M . In particular, we want a configuration of C to allow us to draw conclusions about the simulated configuration in M . The difficulty here is that counter values are just natural numbers and a priori store less information than channel contents with their messages. To overcome this, the idea is to represent each word w c,i of a tuple (w c,1 , . . . , w c,nc ) 19:12

BOUNDED REACHABILITY PROBLEMS ARE DECIDABLE IN FIFO MACHINES
Vol. 18:1 as a counter x (c,i) . Since the set of possible action sequences is "guided" by a bounded language, we can replace send actions with increments and receive actions with decrements. More precisely, c!a becomes (inc(x (c,ia) ), ∅), thus incrementing the counter associated with the unique word w c,i in which a occurs. Similarly, c?a translates to (dec(x (c,ia) ), Z) (for suitable Z). This alone does not put us in a position yet where, from a counter valuation, we can infer a unique channel contents. However, when we additionally keep track of the last messages that have been sent for each channel, we can reconstruct a unique channel contents.
There is one more thing to consider here. While the counters x (c,i) for a given channel c are kind of independent, the FIFO policy would not allow us to receive a letter from w c,j while a letter from w c,i with i < j is in transit. Translated to the counter setting, this means that performing dec(x (c,j) ) should require all counters x (c,i) with i < j to be 0, so this is where zero tests come into play. As the L c are bounded languages and thanks to the normal form, however, a counter that has been tested for zero does not need to be modified anymore.
We can directly implement these ideas formally and define C = (Q, Cnt, T , q 0 ) as follows (note that Q and q 0 remain unchanged): Example 3.11. Figure 4 illustrates the construction of C from a FIFO machine M in normal form (cf. Example 3.9). Recall that we have one channel c and the bounded language L c = (a 1 a 2 ) * a 3 a * 3 over (a 1 a 2 , a 3 ). Thus, C will have two counters, say x for a 1 a 2 and y for a 3 . Note that performing dec(y) indeed comes with a test of x for zero.
Let us first observe that it is actually important that the FIFO machine satisfies the trace property. Suppose that, rather than from M , we constructed the counter machine directly from h −1 (M ). Then, configuration (q 1 , (1, 0)) would be reachable in the counter machine via inc(x)inc(x)dec(x), which arises from c!a 1 c!a 2 c?a 2 . However the only corresponding trace from Pref ( ) is c!a 1 c!a 2 c?a 1 , which in the FIFO machine h −1 (M ) leads to q 0 .
So consider M and its counter machine C. A channel contents w ∈ Σ * c (here, we have one channel) has a natural counter analogue ⟪w⟫ = (|w| a 1 + |w| a 2 , |w| a 3 ). In fact, if (q, w) is reachable in M , then following the corresponding transitions in C will lead us to (q, ⟪w⟫). For example, ((q 0 , R, L), a 2 a 3 a 3 ) is reachable in M along the trace c!a 1 c!a 2 c?a 1 c!a 3 c!a 3 , and so is ((q 0 , R, L), (1, 2)) in C along inc(x)inc(x)dec(x)inc(y)inc(y) (all zero tests are empty).
But how about the converse? In general, one may associate with a counter valuation such as (4, 0) several channel contents. Actually, both a 1 a 2 a 1 a 2 and a 2 a 1 a 2 a 1 seem suitable. However, if we know the most recent message that has been sent, say a 1 , then this leaves only one option, namely a 2 a 1 a 2 a 1 . In this way, we can associate with each counter valuation v and message a i ∈ Σ c a unique (if it exists at all) possible channel contents v a i . Suppose that τ is a trace in C arising from a trace σ in M whose last sent message is a i . If (q, v) is reachable in C via τ , then (q, v a i ) is reachable in M via σ. For example, τ = inc(x)inc(x)dec(x) allows us to go to configuration ((q 0 , M, L), (1, 0)). It arises from σ = c!a 1 c!a 2 c?a 1 ∈ Pref ( ), whose last sent message is a 2 . We have (1, 0) a 2 = a 2 . Indeed, σ leads to ((q 0 , M, L), a 2 ). Relation between FIFO Machine and Counter Machine. Recall that the FIFO machine M = (Q, Ch, Σ, T, q 0 ) and ℒ = (L c ) c∈Ch are in normal form, where L c is a bounded language over (w c,1 , . . . , w c,nc ). Let C = (Q, Cnt, T , q 0 ) be the associated counter machine.
We will now formalize the tight forth-and-back correspondence that allows us to solve reachability queries in M in terms of reachability queries in C.
We start with a simple observation concerning the traces of M and C.
For the second statement, consider and let τ = α 1 . . . α n . Thus, τ ∈ Traces(C). Suppose that we apply a zero test at position ∈ {1, . . . , n}, i.e., α = (dec(x (c,j) ), Z) for some (c, j), where Z contains the counters x (c,i) with i < j. Then, there is k < such that α k = (inc(x (c,j) ), ∅). By the construction of C, we have transitions (q k−1 , c!a , q k ) and (q −1 , c?b , q ) in M for some a, b ∈ Σ c,j . By the trace property of M , none of the actions "reachable" from q in M employs a message from Σ c,i , for all i < j. Thus, none of the actions α m with ≤ m modifies a counter from Z. We deduce that τ ∈ L zero C . With every channel contents w ∈ c∈Ch Σ * c of the FIFO machine M , we associate a counter valuation ⟪w⟫ = v ∈ N Cnt where, for each counter x (c,i) , we let v x (c,i) = a∈Σ c,i |w c | a . Furthermore, abusing notation, we define a homomorphism ⟪ . ⟫ : which maps a sequence of actions of M to a sequence of actions of C. It is defined by Conversely, we will associate, with counter values and traces of C the corresponding objects in the FIFO machine. Because of the inherent ambiguity, this is, however, less straightforward. First, we define a partial mapping . : A * C → A * M (that is not a homomorphism). For τ ∈ A * C , we let τ be the unique (if it exists) word σ ∈ Pref ( ) such that ⟪σ⟫ = τ .
Next, we associate with a counter valuation a corresponding channel contents. As explained above, there is no unique choice unless we make an assumption on the last messages that have been sent. For c ∈ Ch, we set Σ ⊥ c = Σ c {⊥}. Let a ∈ Σ ⊥ c and w ∈ Σ * c . We say that a is good for w if w ∈ Infix (L c ) and either w = ε or w = u.a for some u ∈ Σ * c . Intuitively, it may be possible to obtain contents w in channel c when a is the last message sent (no message was sent yet through c if a = ⊥). Note that the set of words w ∈ Σ * c such that a is good for w is a regular language. Moreover, with w ∈ c∈Ch Σ * c , we associate the finite set G(w) ⊆ c∈Ch Σ ⊥ c of tuples a = (a c ) c∈Ch such that, for all c ∈ Ch, a c is good for w c .
Let v ∈ N Cnt and a ∈ c∈Ch Σ ⊥ c . Abusing notation, we will associate with v and a the channel contents v a ∈ c∈Ch Σ * c (if it exists). We let v a = w if ⟪w⟫ = v and a ∈ G(w). There is at most one such w so that this is well-defined. Note that ⟪ v a ⟫ = v.
Example 3.13. If we have one channel c and our bounded language is L c = (a 1 a 2 a 3 ) * (a 4 ) * , then (4, 0) a 2 = a 2 a 3 a 1 a 2 and (2, 1) a 4 = a 2 a 3 a 4 , whereas (3, 1) a 3 is undefined. Moreover,  G(a 2 a 3 ) = {a 3 } and G(ε) = {a 1 , a 2 , a 3 , a 4  Given v and a, we can easily compute v a since there are only finitely many words w for a given v such that ⟪w⟫ = v. Furthermore, we can also compute G(w) for a given w as we have finitely many possibilities of a.
Finally, for a ∈ c∈Ch Σ ⊥ c , we let L last a ⊆ A * M be the set of words σ such that, for all c ∈ Ch, a c is the last message sent to c in σ (no message was sent if a c = ⊥). We are now ready to state that runs in the FIFO machine are faithfully simulated by runs in the counter machine (the proof is by induction on the length of the trace): Proposition 3.14. Let σ ∈ A * M . For all (q, w) ∈ S M and a ∈ c∈Ch Σ ⊥ c such that σ ∈ L last a , we have: ⟪w⟫) and a ∈ G(w) .
We suppose that the statement is true for all σ ∈ A * M such that |σ| = n. We will now show that it is true for σ ∈ A * M where |σ | = n + 1. Let a ∈ c∈Ch Σ ⊥ c and suppose σ ∈ Pref ( ) ∩ L last a . We write σ = σ.β such that σ ∈ Pref ( ) ∩ L last a for some a ∈ c∈Ch Σ ⊥ c , |σ| = n, and β ∈ A M . There exists such a σ since the set Pref ( ) is prefix-closed. w ). Hence, there exists t = (q, β, q ) ∈ T in the FIFO machine.
Case (1): Suppose β = c!a , for some c ∈ Ch and a ∈ Σ c . Hence, we have w c = w c .a, and w d = w d for all d ∈ Ch \ {c}. Moreover, since σ = σ.β and β = c!a , we can deduce that a c = a and a d = a d for all d = c. This is because the only change in the last sent letters between σ and σ is in the channel c.
By construction of C, we know that there is a transition t = (q, inc(x (c,ia) ), ∅, q ) ∈ T in C, and by the definition of ⟪ . ⟫, we also have ⟪β⟫ = (inc(x (c,ia) ), ∅). By induction hypothesis, we have (q 0 , 0) and v y = v y for all y ∈ Cnt \ {x}. Hence, ⟪w ⟫ = v and we have (q 0 , 0) Note that, by Lemma 3.12, we have ⟪σ.β⟫ ∈ L zero C . From the induction hypothesis, we know that a ∈ G(w). In order to show that a ∈ G(w ), we only need to address the case of the channel c, since the values of a d , w d remain unchanged for all d = c. We know that w c = w c .a c . By induction hypothesis, w c ∈ Infix (L c ). Since σ ∈ Pref (ℒ ! ), we also have w c .a c ∈ Infix (L c ). Hence, a ∈ G(w ).
Case (2): Suppose β = c?a , for some c ∈ Ch and a ∈ Σ c . We have w c = a.w c , and w d = w d for all d ∈ Ch \ {c}. Since σ = σ.β and β = c?a , we can deduce that a = a. This is because there is no change in the last letter sent between σ and σ .
By construction of C, we know that there is a transition t = (q, dec(x (c,ia) ), Z, q ) ∈ T in C where Z = {(x (c,j) ) | j < i a }. By the definition of ⟪ . ⟫, we also have ⟪β⟫ = (dec(x (c,ia) ), Z). By the induction hypothesis, we have (q 0 , 0) ⟪σ⟫ − − → (q, ⟪w⟫). Furthermore, recall that w c = a.w c . This implies that a is at the head of the channel c in the configuration (q, w). Hence, all the letters b such that i b < i a are not present in the channel. Therefore, in the configuration (q, ⟪w⟫), all the counters x (c,i b ) are equal to zero for i b < i a . Hence, we can execute the transition t from (q, ⟪w⟫), and we have (q 0 , 0) ⟪σ⟫ − − → (q, ⟪w⟫) ⟪β⟫ − − → (q , v ) for some counter valuation v . By Lemma 3.12, we have ⟪σ.β⟫ ∈ L zero C . We write v = ⟪w⟫, and from the counter machine transition relation, we know that v From the induction hypothesis, we know that a ∈ G(w). In order to show that a ∈ G(w ), we only need to address the case of the channel c, since the values of a d , w d remain unchanged for all d = c. We know from the induction hypothesis that w c ∈ Infix (L c ). Hence, we can immediately deduce that w c ∈ Suf (w c ) ⊆ Infix (L c ).
Furthermore, we know that w c = u.a c for some u ∈ Σ * c . If u = ε, then we can deduce that w c = ε. If u = ε, then we have w c = u .a c such that a.u = u. Hence, a ∈ G(w ).
Conversely, we can show that runs of the counter machine can be retrieved in the FIFO machine (again, the proof proceeds by induction on the length of the trace): Proof. We proceed by induction on the length of τ . In the base case, |τ | = 0. The only value of τ such that |τ | = 0 is τ = ε. Furthermore, ε ∈ ⟪Pref ( ) ∩ L last a ⟫ where a c = ⊥ for all c ∈ Ch. The only configuration reachable via ε is (q 0 , 0). In the FIFO machine, the configuration (q 0 , ε) is the only configuration reachable via ε = ε. We know that the initial contents is ε = 0 a . Hence, the base case is valid.
By construction of C, we know that there is a transition t = (q, γ, q ) ∈ T in M with γ = c!a for some a ∈ Σ c such that i a = i. Thanks to the trace property (Definition 3.7 (2.)), we have β = γ. Let w be given by w c = w c .a and w d = w d for all d ∈ Ch \ {c}. Then, (q, w) β − → M (q , w ). Furthermore, since i a = i and ⟪w⟫ = v, we can deduce that ⟪w ⟫ = v . Moreover, recall that ⟪σ.β⟫ = τ.α, hence, σ = σ.β = τ .
Since σ = σ.β and β = c!a , we can deduce that a c = a and a d = a d for all d = c. This is because the only change in the last sent letters between σ and σ is in the channel c.

BOUNDED REACHABILITY PROBLEMS ARE DECIDABLE IN FIFO MACHINES
Vol. 18:1 We recall that ⟪w ⟫ = v . From the induction hypothesis, we know that v a = w. Hence, in order to show that v a = w , we only need to address the case of the channel c, since the values of a d , w d remain unchanged for all d = c. We know that w c = w c .a c . Since σ ∈ Pref (ℒ ! ), we have w c .a c ∈ Infix (L c ). Therefore, w = v a .
By construction of C, we know that there is a transition t = (q, γ, q ) ∈ T in M with γ = c?a for some a ∈ Σ c such that i a = i. Again, by the trace property (Definition 3.7 (2.)), we get β = γ. In order to execute t from (q, w), it is necessary that we have w c = a.u for some word u.
Since σ.β ∈ Pref (ℒ ? ) and proj c? (σ).w c = proj c! (σ), we can deduce that w c = a.u for some word u. Hence, the transition t can be executed to reach a configuration (q , w ) such that w c = a · w c , and w d = w d for all d ∈ Ch \ {c}. Furthermore, since i a = i and ⟪w⟫ = v, we can deduce that ⟪w ⟫ = v . Moreover, recall that ⟪σ.β⟫ = τ.α, hence, σ = σ.β = τ .
Since σ = σ.β and β = c?a , we can deduce that a = a. This is because no letters are sent between σ and σ .
We also know from the induction hypothesis that w = v a . Also recall that ⟪w ⟫ = v . In order to show that w = v a , we only need to address the case of the channel c, since the values of a d , w d remain unchanged for all d = c.
We know from the induction hypothesis that w c is contained in Infix (L c ) and, thus, so is w c . Furthermore, we know that w c = u.a c for some u ∈ Σ * c . If u = ε, then we can deduce that w c = ε. On the other hand, if u = ε, then we know that w c = u .a c such that a.u = u. We also recall that ⟪w ⟫ = v . Hence, w = v a .
From Propositions 3.14 and 3.15 and Lemma 3.12, we obtain the following corollary.
Corollary 3.16. For all (q, w) ∈ S M , we have: (q, w) ∈ Reach M (ℒ ! ) ⇐⇒ (q, ⟪w⟫) ∈ Reach C (L zero C ∩ ⟪ ∩ a∈G(w) L last a ⟫) . From Theorem 2.6, we know that verifying whether (q, ⟪w⟫) ∈ Reach C (L zero C ∩ L) where L = ⟪ ∩ a∈G(w) L last a ⟫ is decidable. Hence, we can already deduce decidability of the (configuration-)reachability problem. In fact, using Propositions 3.14 and 3.15, we can solve the more general IB rational-reachability problem. For this, it is actually enough to check, in the counter machine, the reachability of a counter value that belongs to a semi-linear set. For a ∈ c∈Ch Σ ⊥ c and a rational relation Proof. For c ∈ Ch, let G c be the set of words w ∈ Σ * c such that a c is good for w. Moreover, let = c∈Ch G c .
Using this property, we finally reduce the IB rational-reachability problem to a reachability problem in counter machines: Corollary 3.18. For every q ∈ Q, we have: There are a ∈ c∈Ch Σ ⊥ c and σ ∈ ∩ L last a such that (q 0 , ε) σ − → M (q, w). By Proposition 3.14 and Lemma 3.12, we have (q 0 , 0) ⟪σ⟫ − − → C (q, ⟪w⟫) and ⟪σ⟫ ∈ L zero C and a ∈ G(w). By definition, the latter implies w = ⟪w⟫ a and hence ⟪w⟫ ∈ V a (ℛ).

Reachability and Deadlock
We now address some other commonly studied reachability problems, which, as it turns out, can be reduced to the IB rational-reachability problem studied in the previous section.
A configuration (q, w) of a FIFO machine M is a deadlock if there is no (q , w ) such that (q, w) → M (q , w ). In [FP19], it was shown that reachability reduces to control-state reachability for flat FIFO machines but the converse is not true. However, using the same reductions as in [FP19], we obtain the following results: Proposition 4.2. IB reachability is (a) recursively equivalent to IB control-state reachability for FIFO machines, and (b) recursively reducible to IB deadlock for FIFO machines.
Proof. We show both parts of the lemma. . . w nc c . We first reduce IB reachability to IB control-state reachability. Another machine M (q,w) = (Q , Ch, Σ , T , q 0 ) is constructed as follows. We set Q = Q ∪ {q end } such that q end / ∈ Q, and Σ = Σ ∪ {$} such that $ ∈ Σ. Moreover, a "path" q σ − → q end with σ = σ 1 . . . σ m is added from the control state q as follows. For c ∈ Ch, we have Furthermore, ℒ is bounded if ℒ is bounded, since concatenation of a finite word with a bounded language results in a bounded language. Therefore, IB reachability reduces to IB control-state reachability for FIFO machines.
Conversely, in order to show that IB control-state reachability is reducible to IB reachability, we construct M q as follows. To M , we add |Σ| × m self-loops from and to the control state q as follows: q for some channel contents w. Let us append to σ a sequence of actions σ = σ 1 . . . σ m such that σ c = c?w c for all c ∈ Ch, where c?w c is to be understood as a sequence of transitions whose effect is to consume the string w c from the channel c. By construction, we have, (q 0 , ε) σ·σ −−→ Mq (q, ε). Furthermore, proj c! (σ) = proj c! (σ · σ ) for all c ∈ Ch. Hence, σ · σ ∈ Pref (ℒ ! ) and we can conclude that (q, w) ∈ Reach M (ℒ ! ) iff (q, ε) ∈ Reach Mq (ℒ ! ).
Therefore, IB control-state reachability reduces to IB reachability for FIFO machines.
Part (b): Given a FIFO machine M = (Q, Ch, Σ, T, q 0 ), a configuration (q, w), and a tuple ℒ = (L c ) c∈Ch of non-empty regular bounded languages L c ⊆ Σ * c , we construct M (q,w) as in the case of reducing reachability to control-state reachability (see proof of Proposition 4.2(a)). We then modify M (q,w) to M as follows. We add a new channel d to the existing set of channels Ch (the set of channels is now Ch ). For all q = q end , we add the following transition: (q, d!$ , q). Hence, except for q end , every control state has at least one send action. Finally, we also construct a new tuple ℒ = (L c ) c∈Ch such that L c = L c .$ for all c ∈ Ch and L d = $ * .
We claim that (q, w) ∈ Reach M (ℒ ! ) iff Reach M (ℒ ! ) contains a deadlock. To see this, first, we observe that, if there is a deadlock in Reach M (ℒ ! ), then the associated control state would be q end since if we are in any configuration s such that the associated control state q is not q end , the transition (q , d!$ , q ) can always be taken, and hence, there will never be a deadlock.
Let us now suppose that the configuration (q, w) is in Reach M (ℒ ! ). We can execute the same set of transitions as in M and reach the control state q with the channel contents w via an execution σ in M . Having done that, we can then execute the path q σ − → q end as described in T in order to reach q end . Also observe that σ · σ ∈ ℒ ! . Since there are no transitions from this control state, we reach a deadlock.
Suppose now that (q, w) is not in Reach M (ℒ ! ). Hence, we cannot reach (q, w) in M and thus, cannot execute q σ − → q end . Furthermore, as we saw previously, we can never be in a deadlock as we can always send $ to the channel d.
If, for a given q ∈ Q, we set ℛ to be the universal relation c∈Ch Σ * c , IB rationalreachability captures IB control-state reachability, and if we set ℛ = {w}, we can decide if the configuration (q, w) is reachable. In order to reduce IB deadlock to IB rationalreachability, we first explore the control states in order to find the set of states Q ⊆ Q which allow only receptions (no control states with sends can be part of a deadlock). This set can easily be computed from the set of transitions of the machine. Then, for each q ∈ Q , we can see if there exists a reachable configuration (q, w) such that, for all c, we have w c ∈ K c = {ε} ∪ {a.u | u ∈ Σ * c and a ∈ Σ c such that there is no transition (q, c?a , q ) in M }. Note that ℛ q = c∈Ch K c is recognizable and, therefore, rational. Furthermore, if there exists such a reachable (q, w) with w ∈ ℛ q , then it is a deadlock. Hence, using the fact that generalized IB rational-reachability is decidable (Theorem 3.6), we immediately deduce the following corollary: Corollary 4.3. The problems IB reachability, IB control-state reachability, and IB deadlock are decidable for FIFO machines.
Remark 4.4. Since input-bounded FIFO machines subsume VASS (a VASS can be seen as an input-bounded FIFO machine with an alphabet reduced to a unique letter), the complexity of IB reachability is not elementary, which is inherited from the lower bound for VASS [CLL + 19].

Unboundedness and Termination
We now introduce two new decision problems, as follows.
Decidability of the unboundedness and termination problems can be deduced from the reachability decision problems. We detail the construction in the sections below.
Unboundedness. IB unboundedness in FIFO machines reduces to an equivalent problem in counter machines. Given a FIFO machineM andL, the associated FIFO machine M in normal form (with the corresponding tuple ℒ of distinct-letter languages), as well as the associated counter machine C, the following result can be derived. Proof. We first show that unboundedness is preserved by the normal-form construction. This essentially follows from Lemma 3.10 and the fact that h is length-preserving. If (q,ŵ) ∈ ReachM (L ! ), then ((q, q A ), w) ∈ Reach M (ℒ ! ) for some q A and w such that Now, let us assume that Reach M (ℒ ! ) is infinite. Hence, there are infinitely many configurations (q, w) ∈ S M which are reachable from (q 0 , ε). From Corollary 3.16, for each of these configurations, (q, ⟪w⟫) ∈ Reach C (L), where L = L zero . Furthermore, there are only finitely many configurations (q, w) ∈ S M that correspond to a configuration (q, ⟪w⟫) For the converse direction, let us assume that Reach C (L zero C ∩ ⟪ℒ ! ∩ Pref (ℒ ? )⟫) is infinite. Hence, there are infinitely many configurations (q, v) reachable from (q 0 , 0) via some τ such that τ ∈ L zero C ∩ ⟪ℒ ! ∩ Pref (ℒ ? )⟫. Pick one such (q, v) and τ . There exists a unique σ such that ⟪σ⟫ = τ . Consider the vector a such that σ ∈ L last a and let w = v a . Thus, ⟪w⟫ = v.
. From Corollary 3.16, we can deduce that (q, w) ∈ Reach M (ℒ ! ). Therefore, for every v such that (q, v) is reachable, there is a corresponding configuration (q, w) reachable in Reach M (ℒ ! ).
In particular, this statement applies to prefix-closed languages, i.e., we can reduce checking whether ReachM (Pref (L ! )) is infinite to checking whether Reach C (L zero C ∩ ⟪ ⟫) is infinite for some C and prefix-closed language . The latter is decidable as we establish in the following. Recall that, by the construction of C, we then have The main idea that follows is the reduction of unboundedness of the counter machine to reachability in a modified counter machine. It is not immediate that we can use the results in the literature (for example [DF97]) which reduce boundedness to reachability in Petri nets/VASS. This is because the property of monotonicity does not extend to zero tests; if one can execute a zero test at (q, v), it is not necessarily the case that it can be executed at However, we show that, for the counter machine that we construct from the FIFO machine, this property does hold. If we are able to show this, the constructions used in the case of VASS can be adapted.
The only counters that are tested to zero during σ already evaluate to zero at (q, v), and do not change their value throughout the execution of σ .
Proof. Let us assume to the contrary that there is at least one counter which is incremented or decremented during σ and also tested to zero during the execution. Without loss of generality, let us consider x (c,i) to be the first counter along the execution σ that is tested to zero during σ and also incremented/decremented before it was tested to zero.
• Case (1): It has a non-zero value at (q, v), and is then either decremented, or first incremented and then decremented, and finally tested to zero. Since we know that σ.σ ∈ L zero C , no counter tested to zero can then be incremented. Hence, its value will remain zero. But this is a contradiction to our assumption that v ≤ v . Hence, all the counters with non-zero values at (q, v) cannot be tested to zero during σ . • Case (2): It has value zero in (q, v), and is incremented, then decremented, then tested to zero during σ . This implies that it first has to be incremented. Consider now some sub-execution σ ∈ Pref (σ ) where (q, v) σ −→ (q 1 , v 1 ) such that the value of x (c,i) in the configuration (q 1 , v 1 ) is non-zero. Since there are no "new" zero-tests along the execution σ (by our assumption), we can execute σ from (q, v ) (by the monotonicity and trace property). However, we cannot increment the counter x (c,i) along σ , because it was tested to zero during the run (q 0 , 0) σ.σ −−→ (q, v ). Hence, we once again have a contradiction. Now, we can use results from [FS01] to show the following: Proof. Let us assume that Reach C is infinite. As in [FS01], we consider the tree of all prefixes of computations. We prune this tree by removing all prefixes where there is at least a loop, i.e., containing two nodes that are labeled by the same configuration. Since every reachable configuration can be reached without a loop, we still have an infinite number of prefixes in the pruned tree. For every configuration (q, v) in the tree, there are finitely many successors (as the transition system is finitely branching). Hence, in order for the tree to be infinite, there is at least one infinitely long execution (by König's lemma). This execution has no loop. Therefore, by Dickson's lemma, there is an infinite subsequence of configurations (q 1 , v 1 ), (q 2 , v 2 ), . . . such that v 1 < v 2 < . . .. Once we extract this sequence, since there are only finitely many control states in Q, we know that there is at least one pair (q, v), (q, v ) such that (q 0 , 0) Conversely, let us assume that there is an execution (q 0 , 0) We know from Lemma 5.3 that the only counters which may be tested for zero during σ already evaluate to zero at (q, v), and do not change their value throughout the execution of σ . Therefore, all the transitions of the counter system in σ can be considered as VASS operations. Hence, the property of monotonicity holds, i.e., if (q, v) σ − → (q, v ) and (q, v) < (q, v ), then we know there exists an infinite sequence v 1 < v 2 < . . . reachable from configuration (q, v ).
Construction of modified counter system. We modify the counter system C and construct a new counter system C such that Reach C is infinite iff a specific configuration is reachable in C . The construction is loosely based on the reduction of boundedness to reachability for Petri Nets in [DF97].
Proposition 5.5. We can effectively construct a counter machine C (with bounded zero tests) and a finite set of configurations R ⊆ S C such that Reach C is infinite iff some configuration from R is reachable in C .
Proof. We modify the counter machine C and construct a new counter machine C such that Reach C is infinite iff a configuration belonging to a finite set is reachable in C . The construction is loosely based on the reduction of boundedness to reachability for Petri Nets in [DF97]. Since we do not know the values of v and v a priori, we will try to characterize the general condition. The difference v − v is a non negative vector, with at least one strictly 19:22

BOUNDED REACHABILITY PROBLEMS ARE DECIDABLE IN FIFO MACHINES
Vol. 18:1 positive component. We add a duplicate set of counters for every counter in the system. The intuition is that the counter machine non-deterministically moves from operating on both sets to a configuration from where it only operates on this second set. The first set will remain unchanged (with the value v), and the second set will keep track of the values (until it reaches v ). From this configuration (which represents (q, v )), we move to a new control state, q reach . Here, we check for the condition v − v > 0 by first decrementing each counter in the first set which has a non-zero value in tandem with the corresponding counter in the second set. We do this until all the counters in the first set are equal to zero. If v − v > 0, then there is at least one counter in the second set with a non-zero counter value. We non-deterministically decrement all the counters in the second set until we reach a configuration that has some counter c in the second set with a value of 1, and all other counters evaluate to zero. Since there are finitely many such configurations, we can just check every case.
From the above results, we have the following theorem.
Theorem 5.6. The IB unboundedness problem is decidable for FIFO machines.
Remark 5.7. Gouda et al, stated that unboundedness is in EXPSPACE for letter-bounded systems [GGLR87]. However, they only give an idea of the proof, stating that it can be done in a similar fashion as for the deadlock problem. In the construction for solving the deadlock problem, they reduce the input language to tally letter-bounded languages (tally means that the input-language is included in a * where a is a letter). They add as many channels as letters in the original letter-bounded-language. Furthermore, in order to ensure that no channel is non-empty before the next channel is read, they ensure that in all control states where a later channel is being read, there are reception transitions of previous channel contents which lead to a sink state (where there is never a deadlock). Notice that it is still possible to leave a channel non-empty before the next channel is read. But one never reaches a deadlock in such an "incorrect" run, since there is always the option of reading the unread channel contents of the previous channels and reach the sink state. However, when we consider this model for unboundedness, there may exist unbounded "incorrect" runs since we can leave a channel non-empty and proceed to the next and may have an unbounded run there. Hence, it seems that one still needs some reachability test to check if the runs are correct because we cannot ensure that some channels are zero in an unbounded run.
Termination. For termination, we take a similar approach as for unboundedness. Suppose again that we are givenM andL, the associated FIFO machine M in normal form (with the corresponding tuple ℒ of distinct-letter languages), and the associated counter machine C. We first show that the normal form preserves the (non-)termination property. In the following, β i will denote a send or receive action and α i will denote an increment or decrement action.
We obtain the following equivalence.
Proposition 5.8. The following statements are equivalent: • There is an infinite execution of the form initM Proof. Assume that there is an infinite execution of the form initMβ 1 − →Mŝ 1β . . inM such that, for all i ∈ N, we haveβ 1 . . .β i ∈ Pref (L ! ). Hence, there are β 1 , β 2 , β 3 , . . . ∈ A M such that, for all i ∈ N, letting σ i = β 1 . . . β i , we have h(σ i ) =β 1 . . .β i and σ i ∈ Pref ( ). Hence, we know that, in the FIFO machine h −1 (M ), one has (q 0 , ε) . . for suitable (q i , w i ) (by construction of h −1 (T )), and that σ i ∈ Pref (L(A)). Therefore, since M is a product of the two machines, we can deduce that there is an infinite Conversely, assume that there is an infinite execution of the form init M ) and, therefore, h c (proj c! (β 1 . . . β i )) = proj c! (h(β 1 . . . β i )) ∈ Pref (L c ). We deduceσ i ∈ Pref (L ! ). Furthermore, we can executeσ inM (by construction) for all i ∈ N. Hence, we can build an infinite execution inM , such thatσ i ∈ Pref (L ! ) for all i ∈ N.
The latter property can be reduced to checking a decidable property in the counter machine as follows: • There exist σ ∈ A * C , σ ∈ A + C , (q, v) ∈ S C , and v such that (q 0 , 0) Proof. The equivalence of the first two items is obtained as a corollary of Propositions 3.14 and 3.15. So let us show that the latter two are equivalent.
Consider a non-terminating execution as described above. By Dickson's lemma, there is an infinite subsequence of configurations (q 1 , v 1 ), (q 2 , v 2 ), . . . such that v 1 ≤ v 2 ≤ . . .. Once we extract this sequence, since there are only finitely many control states in Q, we know that there is at least one pair (q, v), (q, v ) such that (q 0 , 0) ) and v ≤ v . From the same argument as for boundedness, we can deduce that no counter is being tested to zero for the first time in σ and all the counters previously tested stay unchanged. Hence, all the transitions of the counter system in σ can be considered as VASS operations. Therefore, we know there exists v such that (q, v ) σ − → (q, v ) and v ≤ v . Repeating this reasoning, we can build an infinite sequence starting from (q, v ).
Finally, we construct a modified counter machine as in the case for boundedness (Proposition 5.5) and get the following: Proposition 5.10. We can effectively construct a counter machine C (with bounded zero tests) and a configuration s ∈ S C such that the following statements are equivalent: • There exist σ ∈ A * C , σ ∈ A + C , (q, v) ∈ S C , and v such that (q 0 , 0) Proof. We can adapt the construction of C for unboundedness. The difference is that we now allow for v = v . Hence, there is no need anymore to check that, after decrementing both sets of counters in tandem, there is still a positive counter left in the second set. We can therefore also empty the second set of counters in a new control-state q and check whether (q, 0) is reachable.
Thus, we have the following theorem.
Theorem 5.11. The IB termination problem is decidable for FIFO machines.

Output-Bounded Problems
We consider the dual case of input-bounded languages in which the set of words that may be received by each channel (the output-language) is constrained to be bounded. The OB problems are defined as follows: Theorem 6.2. OB reachability is decidable for FIFO machines.
Proof. Given a configuration (q, w) in M , and a tuple of bounded languages ℒ, the outputbounded reachability problem asks if (q, w) ∈ Reach M (ℒ ? ). Since the output language is in ℒ ? , we know that the contents of the channels which have already been read is in the corresponding input-language, i.e., ℒ ! . Therefore, (q, w) ∈ Reach M (ℒ ? ) iff (q, w) ∈ Reach M (ℒ ! ) where ℒ = (L c ) c∈Ch and L c = L c .w c . Hence, the OB reachability problem is decidable for FIFO machines.
Theorem 6.3. OB control-state reachability is decidable for FIFO machines.
Proof. In order to show that OB control-state reachability is decidable for FIFO machines, we first convert it to the normal form. This construction is similar to that as specified in Section 3, however we make a few changes. Firstly, when we change the alphabet to distinct letter, we add an additional letter, say $, to represent all the letters which are not present in the bounded language, but are present in the transitions of the FIFO system. Then, in addition to the transitions we already add to the new FIFO system as in Section 3, for every send action in the original FIFO system, we add a send action with this new letter $. However, for the reception, we leave it as before. This new FIFO system can now only read letters in the output language, however, it can potentially send any letter. Hence, we have only restricted the output language.
Next, to the automata that is constructed to accept the bounded language for send actions, we add to all the states a transition that enables the automata to send $ and go to a sink state which loops with send actions sending $. Hence, once again, we have ensured that the input language is not restricted. To the reception automata, we make no such changes. Hence, the reception automata only accept the bounded language.
In this new machine, we can solve for control state reachability, over the input-language ℒ = (L c ) c∈Ch such that L c = L c .$ * (but we let the output-language remain ℒ when we construct the trimmed automata). If a configuration (q, w) is reachable in this new machine, then there exists a path which can be taken in the original machine to reach control state q via σ ∈ ℒ ? . Furthermore, if there is a path which can be taken in the original machine, it can also be taken in the new machine. Hence, we can decide if there exists a w such that (q, w) is reachable.
Theorem 6.4. OB unboundedness and OB termination problems are decidable for FIFO machines.
Proof. We can decide the OB unboundedness and termination problems as well. We can construct a counter system for the normal form described in the proof of Theorem 6.3. Note that the counter corresponding to $ will only have increments and no decrements, which is in line with the fact that the contents corresponding to this counter do not belong to the output-language. The FIFO machine has an infinite run iff this newly constructed counter machine has also an infinite run. We then construct the modified counter machine, as is the case for boundedness (see Section 5), and test if there is a run (q 0 , 0) Since this modified counter system has bounded zero tests (the added counter has no decrements or zero tests associated to it), we can decide the reachability of the configuration, and hence, decide if the FIFO machine is unbounded. A similar explanation can be made for termination.
Remark 6.5. The rational reachability problem cannot be directly reduced to the inputbounded case. For the output bounded case, we do not know precisely the reachability set, since we only restrict the output-language. Hence, in order to check if some w ∈ ℛ is reachable, we need to be able to compute the reachability set. Similarly, unlike the input-bounded case, we cannot determine the deadlock problem a priori, since the deadlock problem is reduced to rational reachability for the input-bounded case. Hence, these two problems have been left open.

FIFO Machines with a Single Channel
When we restrict the communication to a single channel, we obtain better upper bound for reachability.
Upper bound for reachability: EXPTIME. We consider the model of ordered multipushdown systems, studied in [ABH17]. We define it using our counter systems. A counter system can be seen as a multi-pushdown system with a unary alphabet. Unary ordered multi-pushdown systems (UOMPDSs) are multi-pushdown systems which impose a total order on the counters and limit decrements to the lowest non-empty counter. We use the following result of reachability of UOMPDS. Consider the counter machine C with the semantic restriction L zero C which can be built from a single channel FIFO machine M . We see that a counter x i can only be decremented if the previous counters x j such that j < i are equal to zero. Therefore, the counter system C is a UOMPDS, where the order of the counters is defined as x i < x j iff i < j. Hence, we have the following proposition.
Proposition 7.2. IB reachability in single channel FIFO machines is polynomially reducible to reachability in UOMPDS.
In [AKS14], it was also shown that repeated reachability for UOMPDS is solvable in EXPTIME. We know that a system is non-terminating if and only if we can reach any control state infinitely often. Therefore, we can guess a control state and verify if it is reachable repeatedly in order to verify if the system is non-terminating. Furthermore, we see that even for FIFO machines with a single channel, using the same construction as in Proposition 4.2, reachability and control state reachability are recursively equivalent.
We then have the following corollary.
Corollary 7.3. The IB reachability, termination and control-state reachability problems are in EXPTIME for FIFO machines with a single channel.
However, for the unboundedness result in Section 5, we use the reachability for counter systems with bounded zero tests. Furthermore, the set of all counters in the modified counter system do not have a total order anymore. Hence, following our constructions, we may only say that the unboundedness problem in FIFO machines with a single channel (over a bounded language) is solvable by using the Petri net reachability (which is tower-hard).
Remark 7.4. In the case of a single channel, we have a total order on the counters, and therefore we are able to use results from Ordered Multipushdown Systems. However, even when we consider two channels, we cannot immediately extend these results since there is no longer a total order in the decrement of counters.
Lower bound for reachability: NP-hard. We consider a sub-problem of the IB reachability, unboundedness, and termination problems as follows. Recall that, given a bounded language L = w * 1 . . . w * n , if |w 1 | = · · · = |w n | = 1, i.e., w 1 , . . . , w n ∈ A, then L is called a letter-bounded language. We see that most of the properties are NP-hard for FIFO machines with a single channel over a letter-bounded language. This is proved by simulating 3-CNF formula with such machines. Our simulation follows the same ideas as the proof of NP-hardness for flat FIFO machines with multiple channels [EGM12,FP19], except that we use a unique channel. Theorem 7.6. ILB-reachability, ILB-unboundedness, and ILB-non-termination are NP-hard for machines with a single channel, even when the input language is letter bounded.
Proof. We reduce from 3SAT. Given a 3-CNF formula C 1 ∧. . .∧C m over variables x 1 , . . . , x n , we construct a FIFO machine with one channel. The message alphabet has 2n + 1 letters and is as follows Σ # = Σ {#}, where Σ = {1, . . . , n} {1, . . . ,n}. The FIFO machine consists of the gadgets shown below. The gadget for variable x k adds either k (in the top transition) ork (in the bottom edge) to the channel. At the end of this gadget, the channel will have either k ork. We will sequentially compose the gadgets for all variables. Starting from the initial control state of the gadget for variable x 1 , we reach the final control state of the gadget for variable x n , such that for every variable x k we either have k ork in the channel -and this determines the truth valuation. We then add the gadget that adds the stop symbol to the channel, as shown in Figure 5. Next, we add gadgets for the clauses. The gadget for the example clause C 1 = x 1 ∨ ¬x 2 ∨ ¬x 3 (gadgets for other clauses follow similar pattern) is shown in Figure 6. The gadget checks that the channel has either 1 (in the top path) or has2 (in the middle path) or has3 (in the bottom path). We append the clause gadgets to the end of the variable gadgets one after the other. All clauses are satisfied by the truth valuation determined by the contents of channels x 1 , . . . , x n iff we can reach the last control state of the last clause.
The gadget for cleaning up all the variables is shown below (it receives all the letters from the channel). We append the cleanup gadget to the end of the clause gadget for C m .  Note that in the FIFO machine given above, every gadget can only be visited once, and the input language of each gadget for a variable x k is equal to {k,k} which is included in the letter-bounded language k * k * . Hence, for every execution σ along the sequence of variable gadgets, we have σ ∈ ℒ ! where ℒ = 1 * 1 * . . . n * n * # * . For every clause gadget, we have, once again, an execution σ ∈ ℒ ! . Hence, we see that the input-language of every run can be restricted to the bounded language (1 * 1 * . . . n * n * # * ) m+1 . Furthermore, while there are loops in the FIFO machine, it can be seen that no loop can be executed infinitely often. We can also see that along every run, the channel is bounded and the size of the channel does not exceed n + 1.
The given 3-CNF formula is satisfiable iff the control state of the cleanup gadget can be reached with the channel being empty. Hence, this constitutes a reduction to the reachability problem. Furthermore, if we add a self loop to the state of the cleanup gadget, such that it sends the letter # to the channel, then this loop can be iterated infinitely often to add unboundedly many occurrences of the letter # to the channel. Now, the given 3-CNF formula is satisfiable iff the constructed FIFO machine is unbounded iff channel is unbounded iff there is a non-terminating run. Hence reachability, unboundedness and non-termination are all NP-hard.
Remark 7.7. We can remove the ε-transitions in the above construction by instead nondeterministically choosing one of the three variables per clause. This would eliminate all ε-transitions, and corresponds to the model we define, which does not have them.
We can adapt the proof above to the more restrictive case of FIFO machines whose input language is restricted to a distinct-letter-bounded language, by modifying the transitions in the gadget for clause C i as follows: For every transition sequence of the form ?a!a, we replace it by ?a i−1 !a i , thereby ensuring that we write different letters to the channel in every gadget. The transitions for the gadgets for each variable x k (when it is set initially) would be modified by !k 0 and ?k 0 . Furthermore, we can modify gadgets for the clauses (see Figure 7) in order to have the following corollary, which improves a similar result for flat FIFO machines with multiple channels in [FP19].
Corollary 7.8. For flat FIFO machines with a single channel, reachability, unboundedness, and non-termination are NP-hard, hence, they are also NP-complete.
Remark 7.9. When considering FIFO systems of communicating processes with two FIFO channels (and not FIFO machines with a single channel), the deadlock and the unboundedness are PSPACE for systems of two processes with two one-directional FIFO channels if (at least) one channel is letter-input-bounded [GGLR87]. We conjecture that this result can be upgraded to input-bounded FIFO systems.

Conclusion and Perspectives
We extend recent results of the bounded verification of communicating finite-state machines (equivalently FIFO machines) [EGM12] and of flat FIFO machines [FP19] by using bounded languages for controlling the input-languages of FIFO channels (and not for controlling the runs of the machine). We extend old and recent results about input-bounded FIFO machines (see Table 1). In particular, we introduce the rational-reachability problem, which subsumes    most of the well-known variants of reachability problems like: the (classical) reachability problem, the control-state reachability problem, and the deadlock problem. We also unify the terminology to facilitate the comparison between results. Moreover, note that, for most problems (except general/rational reachability), we can reduce output-bounded reachability to an equivalent input-bounded problem. There are still many open problems and challenges: • What is the precise complexity of the five problems for input-bounded FIFO machines with a fixed number of channels? • What is the precise complexity of control-state reachability, deadlock, unboundedness, and termination for input-bounded FIFO machines? • The size of the counter machine associated with a FIFO machine and a tuple of bounded languages is exponential, but only polynomial when we start from a normal form. It will be interesting to see whether the use of existing tools for counter machines is feasible for the verification of FIFO machines from case studies. Case studies shall also reveal how many FIFO machines/systems are actually boundable and/or flattable. Hence, we deduce that reachability is decidable for ℒ-boundable FIFO machines, which is a strictly larger class than input-bounded machines. CDP is not input-bounded but it is ℒ CDP -boundable with ℒ CDP = ((ab) * (a + ε)(ab) * , e * ). Let us also remark that CDP is flattable by using the bounded set of runs (!a!b) * !a!e?e(!a!b) * + (!a!b) * (where we omit channel information for readability), because it covers the reachability set which is equal to (ab) * (a + ε)(ab) * on control-state (0, 0). It is not clear whether reachability is decidable for boundable machines. A strategy that would fairly enumerate all regular bounded families ℒ 1 , ℒ 2 , . . . , ℒ n , . . . will necessarily find the good one, if M is boundable, but this is not sufficient because we must be able to recognize Reach M . Observe that boundable machines are more robust than flat machines. Consider a system S = (A 1 , A 2 , . . . , A n ) of n flat finite automata A i communicating peer to peer (P2P) through one-directional FIFO channels. Let M S denote FIFO the machine obtained as the Cartesian product of all automata A i of S; there is no reason to assume that M S is flattable but it is input-bounded and thus M S is ℒ-boundable where ℒ is easily computable from S.