The Emptiness Problem for Valence Automata over Graph Monoids

This work studies which storage mechanisms in automata permit decidability of the emptiness problem. The question is formalized using valence automata, an abstract model of automata in which the storage mechanism is given by a monoid. For each of a variety of storage mechanisms, one can choose a (typically infinite) monoid $M$ such that valence automata over $M$ are equivalent to (one-way) automata with this type of storage. In fact, many important storage mechanisms can be realized by monoids defined by finite graphs, called graph monoids. Examples include pushdown stacks, partially blind counters (which behave like Petri net places), blind counters (which may attain negative values), and combinations thereof. Hence, we study for which graph monoids the emptiness problem for valence automata is decidable. A particular model realized by graph monoids is that of Petri nets with a pushdown stack. For these, decidability is a long-standing open question and we do not answer it here. However, if one excludes subgraphs corresponding to this model, a characterization can be achieved. Moreover, we provide a description of those storage mechanisms for which decidability remains open. This leads to a model that naturally generalizes both pushdown Petri nets and the priority multicounter machines introduced by Reinhardt. The cases that are proven decidable constitute a natural and apparently new extension of Petri nets with decidable reachability. It is finally shown that this model can be combined with another such extension by Atig and Ganty: We present a further decidability result that subsumes both of these Petri net extensions.


Introduction
For each storage mechanism in one-way automata, it is an important question whether the emptiness problem is decidable. It therefore seems prudent to aim for general insights into which properties of storage mechanisms are responsible for decidability or undecidability.
Our approach to obtain such insights is the model of valence automata. These feature a finite-state control and a (typically infinite) monoid that represents a storage mechanism. The edge inscriptions consist of an input word and an element of the monoid. Then, a computation is accepting if it arrives in a final state and composing the encountered monoid elements yields the neutral element. This way, by choosing a suitable monoid, one can realize a variety of storage mechanisms. Hence, our question becomes: For which monoids M is the emptiness problem for valence automata over M decidable?
We address this question for a class of monoids that was introduced in [19] and accommodates a number of storage mechanisms that have been studied in automata theory. Examples include pushdown stacks, partially blind counters (which behave like Petri net places), and blind counters (which may attain negative values; these are in most situations interchangeable with reversal-bounded counters), and combinations thereof. See [22,23] for an overview. These monoids are defined by graphs and thus called graph monoids 1 .
A particular type of storage mechanism that can be realized by graph monoids are partially blind counters that can be used simultaneously with a pushdown stack. Automata with such a storage are equivalent to pushdown Petri nets (PPN), i.e. Petri nets where the transitions can also operate on a pushdown stack. This means, a complete characterization of graph monoids with a decidable emptiness problem would entail an answer to the longstanding open question of whether reachability is decidable for this Petri net extension [15]. Partial solutions have recently been obtained by Atig and Ganty [2] and by Leroux, Sutre, and Totzke [12]. Contribution. While this work does not answer this open question concerning PPN, it does provide a characterization among all graph monoids that avoid this elusive storage type. More precisely, we identify a set of graphs, 'PPN-graphs', each of which corresponds precisely to PPN with one Petri net place. Then, among all graphs Γ avoiding PPN-graphs as induced subgraphs, we characterize those for which the graph monoid MΓ results in a decidable emptiness problem. Furthermore, we provide a simple, more mechanical (as opposed to algebraic) description of (i) the storage mechanism emerging as the most general decidable case and (ii) a type of mechanism equivalent to the cases we leave open. The model (i) is a new extension of partially blind counter automata (i.e. Petri nets). While the decidability proof employs a reduction to Reinhardt's priority multicounter machines [15], the model (i) seems to be expressively incomparable to Reinhardt's model. The model (ii) is a class of mechanisms whose simplest instance are the pushdown Petri nets and which also naturally subsumes priority multicounter machines (see also Remark 3.7).
Another recent extension of the decidability of reachability of Petri nets has been obtained by Atig and Ganty [2]. In fact, it is a partial solution to the reachability problem for PPN. Their proof also relies on priority multicounter machines. They show that given a finite-index context-free language K and a language L generated by a Petri net, it is decidable whether the intersection K ∩ L is empty. Note that without the finite-index requirement, this would be equivalent to the reachability problem for PPN. Our final contribution is a decidability result that subsumes both the decidability of model (i) and the result of Atig and Ganty. We present a natural language class that contains both the intersections considered by Atig and Ganty and the languages of model (i) and still has a decidable emptiness problem. To this end, we employ a slightly stronger (and perhaps simpler) version of Atig and Ganty's reduction.
Hence, the perspective of valence automata allows us to identify natural storage mechanisms that (i) push the frontier of decidable emptiness (and hence reachability) and (ii) let us naturally interpret PPN and priority multicounter machines as special cases of a more powerful model that might enjoy decidability, respectively.
The paper is structured as follows. We present the main results in Section 3 and prove them in Sections 4 to 6. Section 4 presents the undecidability part, Section 5 treats the decidable cases, and Section 6 shows the expressive equivalence with the more mechanical descriptions. In Section 7, we present the enhanced decidability result that also subsumes the one by Atig and Ganty. This work is an extended version of the paper [21]. This version provides proofs of the results of [21] and the enhanced decidability result. Moreover, it contains proofs of some results that first appeared in [19,20], but have not yet undergone journal peer review.

Preliminaries
A monoid is a set M together with a binary associative operation such that M contains a neutral element. Unless the monoid at hand warrants a different notation, we will denote the neutral element by 1 and the product of x, y ∈ M by xy. If X is a set of symbols, X * denoted the set of words over X. The length of the word w ∈ X * is denoted |w|. An alphabet is a finite set of symbols. The empty word is denoted by ε ∈ X * . Let P ⊆ X × X is a set of pairs of symbols, then the semi-Dyck language over P , denoted D * P is the smallest subset of X * such that ε ∈ D * P and whenever uv ∈ D * P , then also uaāv ∈ D * P for every (a,ā) ∈ P . If P = {(a i ,ā i ) | i ∈ {1, . . . , n}}, then we also write D * n instead of D * P . Moreover, if P = {(a, b)}, then the words in D * P are called semi-Dyck words over a, b. If w ∈ X * is a word with w = x 1 · · · x n for x 1 , . . . , x n ∈ X, then w R denotes w in reverse, i.e. w R = x n · · · x 1 .
For an alphabet X and languages L, K ⊆ X * , the shuffle product L ¡ K is the set of all words u 0 v 1 u 1 · · · v n u n where u 0 , . . . , u n , v 1 , . . . , v n ∈ X * , u 0 · · · u n ∈ L, and v 1 · · · v n ∈ K. For a subset Y ⊆ X, we define the projection morphism π Y : X * → Y * by π Y (y) = y for y ∈ Y and π Y (x) = ε for x ∈ X \ Y . Moreover, we define |w| Y = |π Y (w)| and for x ∈ X, we set |w| x = |w| {x} . Valence automata. As a framework for studying which storage mechanisms permit decidability of the emptiness problem, we employ valence automata. They feature a monoid that dictates which computations are valid. Hence, by an appropriate choice of the monoid, valence automata can be instantiated to be equivalent to a concrete automata model with storage. For the purposes of this work, equivalent is meant with respect to accepted languages. Therefore, we regard valence automata as language accepting devices.
Let M be a monoid and X an alphabet. A valence automaton over M is a tuple A = (Q, X, M, E, q 0 , F ), in which (i) Q is a finite set of states, (ii) E is a finite subset of Q×X * ×M ×Q, called the set of edges, (iii) q 0 ∈ Q is the initial state, and (iv) F ⊆ Q is the set of final states. For q, q ′ ∈ Q, w, w ′ ∈ X * , and m, m ′ ∈ M , we write (q, w, m) → A (q ′ , w ′ , m ′ ) if there is an edge (q, v, n, q ′ ) ∈ E such that w ′ = wv and m ′ = mn. The language accepted by A is then The class of languages accepted by valence automata over M is denoted by VA(M ). If M is a class of monoids, we write VA(M) for M∈M VA(M ). Graphs. A graph is a pair Γ = (V, E) where V is a finite set and E is a subset of {S ⊆ V | 1 ≤ |S| ≤ 2}. The elements of V are called vertices and those of E are called edges.
we denote a graph that is a cycle (path) on four vertices; see Fig. 1. Moreover, Γ − denotes the graph obtained from Γ by deleting all loops: Finally, a clique is a loop-free graph in which any two distinct vertices are adjacent. Products and presentations. If M , N are monoids, then M × N denotes their direct product, whose set of elements is the cartesian product of M and N and composition is defined component-wise. By M n , we denote the n-fold direct product, i.e. M × · · · × M with n factors. Let A be a (not necessarily finite) set of symbols and R be a subset of A * × A * . The pair (A, R) is called a (monoid) presentation. The smallest congruence of the free monoid A * containing R is denoted by ≡ R and we will write [w] R for the congruence class of w ∈ A * . The monoid presented by (A, R) is defined as A * /≡ R . Note that since we did not impose a finiteness restriction on A, up to isomorphism, every monoid has a presentation. If A = {a 1 , . . . , a n } and R = {(r i ,r i ) | i ∈ {1, . . . , k}}, we also use the shorthand a 1 , . . . , a n | r 1 =r 1 , . . . , r k =r k to denote the monoid presented by (A, R).
Furthermore, for monoids M 1 , M 2 we can find presentations (A 1 , R 1 ) and (A 2 , R 2 ) such that A 1 ∩ A 2 = ∅. We define the free product M 1 * M 2 to be presented by (A 1 ∪ A 2 , R 1 ∪ R 2 ). Note that M 1 * M 2 is well-defined up to isomorphism. In analogy to the n-fold direct product, we write M (n) for the n-fold free product of M . Graph monoids. A presentation (A, R) in which A is a finite alphabet is a Thue system. To each graph Γ = (V, E), we associate the Thue system T Γ = (X Γ , R Γ ) over the alphabet In particular, we have (a vāv ,ā v a v ) ∈ R Γ whenever {v} ∈ E. To simplify notation, the congruence ≡ RΓ is then also denoted by ≡ Γ . We are now ready to define graph monoids. To each graph Γ, we associate the monoid The monoids of the form MΓ are called graph monoids. Storage mechanisms as graph monoids. Let us briefly discuss how to realize storage mechanisms by graph monoids. First, suppose Γ 0 and Γ 1 are disjoint graphs. If Γ is the union of Γ 0 and Γ 1 , then MΓ ∼ = MΓ 0 * MΓ 1 by definition. Moreover, if Γ is obtained from Γ 0 and Γ 1 by drawing an edge between each vertex of Γ 0 and each vertex of Γ 1 , then MΓ ∼ = MΓ 0 × MΓ 1 .
If Γ consists of one vertex v and has no edges, the only rule in the Thue system is (a vāv , ε). In this case, MΓ is also denoted as B and we will refer to it as the bicyclic monoid. The generators a v andā v are then also written a andā, respectively. It is not hard to see that B corresponds to a partially blind counter, i.e. one that attains only non-negative values and has to be zero at the end of the computation. Moreover, if Γ consists of one looped vertex, then MΓ is isomorphic to Z and thus realizes a blind counter, which can go below zero and is zero-tested in the end.
If one storage mechanism is realized by a monoid M , then the monoid B * M corresponds to the mechanism that builds stacks: A configuration of this new mechanism consists of a sequence c 0 ac 1 · · · ac n , where c 0 , . . . , c n are configurations of the mechanism realized by M . We interpret this as a stack with the entries c 0 , . . . , c n . One can open a new stack entry on top (by multiplying a ∈ B), remove the topmost entry if empty (by multiplyingā ∈ B) and operate on the topmost entry using the old mechanism (by multiplying elements from M ). In particular, B * B describes a pushdown stack with two stack symbols. See [22] for more examples and [23] for more details.
As a final example, suppose Γ is one edge short of being a clique, then MΓ ∼ = B (2) × B n−2 , where n is the number of vertices in Γ. Then, by the observations above, valence automata over MΓ are equivalent to Petri nets with n − 2 unbounded places and access to a pushdown stack. Hence, for our purposes, a pushdown Petri net is a valence automaton over B (2) × B n for some n ∈ N.

Results
As a first step, we exhibit graphs Γ for which VA(MΓ) includes the recursively enumerable languages.
Theorem 3.1. Let Γ be a graph such that Γ − contains C4 or P4 as an induced subgraph. Then VA(MΓ) is the class of recursively enumerable languages. In particular, the emptiness problem is undecidable for valence automata over MΓ.
This unifies and slightly strengthens a few undecidability results concerning valence automata over graph monoids. The case that all vertices are looped was shown by Lohrey and Steinberg [14] (see also the discussion of Theorem 3.4). Another case appeared in [19]. We prove Theorem 3.1 in Section 4. It is not clear whether Theorem 3.1 describes all Γ for which VA(MΓ) exhausts the recursively enumerable languages. For example, as mentioned above, if Γ is one edge short of being a clique, then valence automata over MΓ are pushdown Petri nets. In particular, the emptiness problem for valence automata is equivalent to the reachability problem of this model, for which decidability is a long-standing open question [15]. In fact, it is already open whether reachability is decidable in the case of B (2) × B, although Leroux, Sutre, and Totzke have recently made progress on this case [12]. Therefore, characterizing those Γ with a decidable emptiness problem for valence automata over MΓ would very likely settle these open questions 2 .
However, we will show that if we steer clear of pushdown Petri nets, we can achieve a characterization. More precisely, we will present a set of graphs that entail the behavior of pushdown Petri nets. Then, we show that among those graphs that do not contain these as induced subgraphs, the absence of P4 and C4 already characterizes decidability. PPN-graphs. A graph Γ is said to be a PPN-graph if it is isomorphic to one of the following three graphs: We say that the graph Γ is PPN-free if it has no PPN-graph as an induced subgraph. Observe that a graph Γ is PPN-free if and only if in the neighborhood of each unlooped vertex, any two vertices are adjacent.
Of course, the abbreviation 'PPN' refers to 'pushdown Petri nets'. This is justified by the following fact. It is proven in Section 5 (page 13). Transitive forests. In order to exploit the absence of P4 and C4 as induced subgraphs, we will employ a characterization of such graphs as transitive forests. The comparability graph of a tree t is a simple graph with the same vertices as t, but has an edge between two vertices whenever one is a descendant of the other in t. A graph Γ is a transitive forest if the simple graph Γ − is a disjoint union of comparability graphs of trees. For an example of a transitive forest, see Fig. 2.
Let DEC denote the smallest isomorphism-closed class of monoids such that 1. for each n ≥ 0, we have B n ∈ DEC and 2. for M, N ∈ DEC, we also have M * N ∈ DEC and M × Z ∈ DEC. Our main result characterizes those PPN-free Γ for which valence automata over MΓ have a decidable emptiness problem. 2 Strictly speaking, it is conceivable that there is a decision procedure for each B (2) × B n , but no uniform one that works for all n. However, this seems unlikely. We present the proof in Section 5. Note that this generalizes the fact that emptiness is decidable for pushdown automata (i.e. graphs with no edges) and partially blind multicounter automata (i.e. cliques), or equivalently, reachability in Petri nets.
Note that if Γ has a loop on every vertex, then MΓ is a group. Groups that arise in this way are called graph groups. In general, if a monoid M is a group, then emptiness for valence automata over M is decidable if and only if the rational subset membership problem is decidable for M [11]. The latter problem asks, given a rational set R over M and an element m ∈ M , whether m ∈ R; see [13] for more information. Therefore, Theorem 3.3 extends the following result of Lohrey and Steinberg [14], which characterizes those graph groups for which the rational subset membership problem is decidable.
Theorem 3.4 (Lohrey and Steinberg [14]). Let Γ be a graph in which every vertex is looped. Then the rational subset membership problem for the group MΓ is decidable if and only if Γ is a transitive forest.
Lohrey and Steinberg show decidability by essentially proving that in their case, the languages in VA(MΓ) have semilinear Parikh images (although they use different terminology). Here, we extend this argument by showing that in the equivalent cases of Theorem 3.3, the Parikh images of VA(MΓ) are those of languages accepted by priority multicounter machines. The latter were introduced and shown to have a decidable reachability problem by Reinhardt [15]. Intuition for decidable cases. In order to provide an intuition for those storage mechanisms (not containing a pushdown Petri net) with a decidable emptiness problem, we present an equally expressive class of monoids for which the corresponding storage mechanisms are easier to grasp. Let SC ± be the smallest isomorphism-closed class of monoids with 1. for each n ∈ N, we have B n ∈ SC ± , 2. for each M ∈ SC ± , we also have B * M ∈ SC ± and M × Z ∈ SC ± .
Thus, SC ± realizes those storage mechanisms that can be constructed from a finite set of partially blind counters (B n ) by building stacks (M → B * M ) and adding blind counters (M → M × Z). Then, in fact, the monoids in SC ± produce the same languages as those in DEC. Proposition 3.5 is proven in Section 6. While our decidability proof for SC ± will be a reduction to priority multicounter machines (see Section 5 for a definition), it seems likely that these two models are incomparable in terms of expressiveness (see the remarks after Theorem 5.12). Intersections with finite-index languages. This work exhibits valence automata over SC ± as an extension of Petri nets that features a type of stack but retains decidability of the emptiness problem. Another recent result of this kind has been obtained by Atig and Ganty [2]. They showed that given a finite-index context-free language K and a Petri net language L, it is decidable whether K ∩ L is empty. Moreover, they also employ a reduction to priority multicounter machines. This raises the question of how the two results relate to each other. In Section 7, we present a natural language class that subsumes both the languages of Atig and Ganty and those of VA(SC ± ) and prove that emptiness is still decidable. Intuitively, this class is obtained by taking languages of Atig and Ganty and then applying operators corresponding to building stacks and adding blind counters. The precise definition and the result can be found in Section 7.
Intuition for open cases. We also want to provide an intuition for the remaining storage mechanisms, i.e. those defined by monoids MΓ about which Theorems 3.1 and 3.3 make no statement. To this end, we describe a class of monoids that are expressively equivalent to these remaining cases. The remaining cases are given by those graphs Γ where Γ − does not contain C4 or P4, but Γ contains a PPN-graph. Let REM denote the class of monoids MΓ, where Γ is such a graph. Let SC + be the smallest isomorphism-closed class of monoids with 1. B (2) × B ∈ SC + and 2. for each M ∈ SC + , we also have B * M ∈ SC + and M × B ∈ SC + . This means, SC + realizes those storage mechanisms that are obtained from a pushdown stack, together with one partially blind counter (B  We prove Proposition 3.6 in Section 6. Of course, SC + generalizes pushdown Petri nets, which correspond to monoids B (2) × B n for n ∈ N. Moreover, SC + also subsumes priority multicounter machines (see p. 14 for a definition) in a straightforward way: Every time we build stacks, we can use the new pop operation to realize a zero test on all the counters we have added so far. Let M 0 = 1 and M k+1 = B * (M k × B). Then, priority k-counter machines correspond to valence automata over M k where the stack heights never exceed 1.
Remark 3.7. Priority multicounter machines are already subsumed by pushdown Petri nets alone: Atig and Ganty [2, Lemma 7] show implicitly that for each priority multicounter machine, one can construct a pushdown Petri net that accepts the same language. Hence, valence automata over SC + are not the first perhaps-decidable generalization of both pushdown Petri nets and priority multicounter machines, but they generalize both in a natural way.

Undecidability
In this section, we prove Theorem 3.1. It should be mentioned that a result similar to Theorem 3.1 was shown by Lohrey and Steinberg [14]: They proved that if every vertex in Γ is looped and Γ − contains C4 or P4 as an induced subgraph, then the rational subset membership problem is undecidable for MΓ. Their proof adapts a construction of Aalbersberg and Hoogeboom [1], which shows that the disjointness problem for rational sets of traces is undecidable when the independence relation has P4 or C4 as an induced subgraph. An inspection of the proof presented here, together with its prerequisites (Theorems 4.2 and 4.3), reveals that the employed ideas are very similar to the combination of Lohrey and Steinberg's and Aalbersberg and Hoogeboom's proof.
A language class is a collection of languages that contains at least one non-empty language. In this work, for each language class, there is a way to finitely represent each member of the class. Moreover, an inclusion C ⊆ D between language classes C and D is always meant to be effective, in other words: Given a representation of a language in C, we can compute a representation of that language in D. The same holds for equalities between language classes. Let X and Y be alphabets. A relation T ⊆ X * × Y * is called a rational transduction if there is an alphabet W , a regular language R ⊆ W * , and morphisms g : [3]). For a language L ⊆ X * , we define T L = {v ∈ Y * | ∃u ∈ L : (u, v) ∈ T }. A language class C is a full trio if for every language L in C, the language T L is effectively contained in C as well. Here, "effectively" means again that given a representation of a language L from C and a description of T , one can effectively compute a representation of T L. For a language L, we denote by T (L) the smallest full trio containing L. Note that if L = ∅, the class T (L) contains precisely the languages T L for rational transductions T . For example, it is well-known that for every monoid M , the class VA(M ) is a full trio [6]. A full AFL is a full trio that is also closed under Kleene iteration, i.e. for each member L, the language L * is effectively a member as well.
Here, we use the following fact. We denote the recursively enumerable languages by RE.
Lemma 4.1 is essentially due to Hartmanis and Hopcroft, who stated it in slightly different terms: Theorem 4.2 (Hartmanis and Hopcroft [9]). Let C be the smallest full AFL containing {a n b n | n ≥ 0}. Every recursively enumerable language is the homomorphic image of the intersection of two languages in C.   [8]). Let L ⊆ X * and c / ∈ X. The smallest full AFL containing L equals T ((Lc) * ).
As announced, Lemma 4.1 now follows.
Using a product construction, it is now easy to obtain a rational transduction T with T B 2 = L 1 ∩ L 2 .
The proof of Theorem 3.1 will require one more auxiliary lemma. In the following, [w] Γ denotes the congruence class of w ∈ X * Γ with respect to ≡ Γ . Lemma 4.4. Let Γ = (V, E) be a graph, let W ⊆ V be a subset of vertices, and let Y ⊆ X Γ be defined as Proof. An inspection of the rules in the Thue system Since ≡ Γ is a congruence and π Y a morphism, this implies the lemma.
Note that the foregoing lemma does not hold for arbitrary alphabets Y ⊆ X Γ . For We are now ready to prove Theorem 3.1.
Theorem 3.1. Observe that w ≡ Γ ε if and only if w can be transformed into ε by finitely many times replacing an infix u with an infix v for some (u, v) ∈ R Γ . Since R Γ is finite, this implies that the set of all w ∈ X * Γ with w ≡ Γ ε is recursively enumerable. (In fact, whether w ≡ Γ ε can be decided in polynomial time [19,23].) In particular, one can recursively enumerate runs of valence automata over VA(MΓ) and hence VA(MΓ) ⊆ RE. For the other inclusion, recall that VA(M ) is a full trio for any monoid M . Furthermore, if ∆ is an induced subgraph of Γ, then M∆ embeds into MΓ, meaning VA(M∆) ⊆ VA(MΓ). Hence, according to Lemma 4.1, it suffices to show that Fig. 3. We construct a valence automaton A over MΓ for B 2 ⊆ X * as follows. First, A reads a word in R = ((a * 1ā * Here, when reading a i orā i , it multiplies [a i ] or [ā i ], respectively, to the storage monoid. When reading b 1 or b 2 , it multiplies [a 4 ] or [a 3 ], respectively. After this, A switches to another state and nondeterministically multiplies an Dotted lines represent edges that may or may not exist in Γ.
Then it changes into an accepting state. We shall prove that A accepts B 2 . Let the morphism h : for some n 1 , . . . , n k ,n 1 , . . . ,n k , m ∈ N. Again, by projecting to R ] Γ into the storage, this establishes B 2 ⊆ L(A). Suppose π {b1,b2} (w) ends in b 1 . Then w = rsb 1 for some r ∈ X * , s ∈ (a n 1 )] Γ . Moreover, since g deletes a 1 andā 1 , we have g(s) = g(t). Therefore, Γ completely analogously. This proves B 2 ⊆ L(A) and hence the theorem.

Decidability
In this section, we prove Theorem 3.3 and Proposition 3.2. First, we mention existing results that are ingredients to our proofs.
Let C be a class of languages. A C-grammar is a quadruple G = (N, T, P, S) where N and T are disjoint alphabets and S ∈ N . P is a finite set of pairs The class of all languages that are generated by C-grammars is called the algebraic extension of C and is denoted Alg(C). Of course, if C ⊆ D, then Alg(C) ⊆ Alg(D). Moreover, it is easy to see that if C ⊆ Alg(D), then Alg(C ∪ D) = Alg(D).
The following is easy to show in the same way one shows that the context-free languages constitute a full trio [3]. A proof can be found in [23].
Lemma 5.1. If C is a full trio, then Alg(C) is a full trio as well.
A monoid M is called finitely generated if there is a finite subset F ⊆ M such that every element of M can be written as a product of elements of F . A language I ⊆ X * is called an identity language for M if there is a surjective morphism ϕ : X * → M with I = ϕ −1 (1). We will also use the following well-known fact about valence automata. A proof can be found, e.g., in [23,10]. The well-known theorem of Chomsky and Schützenberger [3], expressed in terms of valence automata, states that VA(Z * Z) is the class of context-free languages. This formulation, along with a new proof, is due to Kambites [10]. Let Reg and CF denote the class of regular and context-free languages, respectively. Then we have Reg = VA(1) and CF = Alg(Reg).
Here, 1 denotes the trivial monoid {1}. Moreover, notice that Alg(Alg(C)) = Alg(C) for every language class C. Since furthermore valence automata over B * B are equivalent to pushdown automata, we have in summary: In order to work with general free products, we use the following result, which expresses the languages in VA(M 0 * M 1 ) in terms of VA(M 0 ) and VA(M 1 ). It was first shown in [19]. In [4], it was extended to more general products. For the convenience of the reader, we include a proof. For Consider the binary relation ⇀ on It is now easy to see that w ≡ R0∪R1 ε if and only if ε ⇀ * w.
This allows us to construct a VA(M 0 )∪VA(M 1 )-grammar for L. Let G = (N, A 0 ∪A 1 , P, S), where N = {S}. In order to describe the productions, we need to define two languages. For i ∈ {0, 1}, let K i = {Sa 1 S · · · a n S | a 1 , . . . , a n ∈ A i , a 1 · · · a n ∈ L i }. Then K i can be obtained from L i using full trio operations and is thus contained in VA(M i ). Our grammar contains only three productions: S → K 0 , S → K 1 , and S → {ε} (recall that as a regular language, {ε} belongs to each VA(M i )). Then, it is immediate that w ∈ L(G) if and only if ε ⇀ * w and hence L(G) = L.   [20]. We include a proof for the convenience of the reader. Observe that then for any f, g ∈ ({r,r} ∪ X) * , we have [f rvrg] = 1: By induction on the number of rewriting steps, one can show that every word in [f rvrg] is of the form f ′ rv ′r g ′ for f ′ , g ′ ∈ ({r,r} ∪ X) * and v ′ ∈ X * with v ′ ≡ R v. By the same argument, we have [f rurg] = 1 for any f, g ∈ ({r,r} ∪ X) * .
We show by induction on |w| that [ϕ(w)] = 1 implies [w] = 1. Since this is trivial for w = ε, we assume |w| ≥ 1. As a partial converse to Proposition 5.3, we have the following. It was first shown in [20]. Since valence automata over B * B are essentially pushdown automata and since Alg(VA(1)) = Alg(Reg) = CF, the equality VA(B * B * M ) = Alg(VA(M )) generalizes the equivalence between pushdown automata and context-free grammars. Observe that if C is a language class with C ⊆ CF, then Alg(C ∪ VA(N )) = Alg(VA(N )) for every monoid N : For each production A → L in a (C ∪ VA(N ))-grammar G with L from C, we can take a context-free grammar G ′ generating L (with fresh non-terminals) and replace the production A → L with the productions of G ′ . This is yields a VA(N )-grammar because all singleton sets are contained in VA(N ). We may clearly assume that Q B ∩ Q C = ∅ for B = C and that for each (p, w, m, q) ∈ E B , we have |w| ≤ 1.
In order to simplify the correctness proof, we modify G. Let ⌊ and ⌋ be new symbols and let G ′ be the grammar G ′ = (N, T ∪ {⌊, ⌋}, P ′ , S), where P ′ consists of the productions B → ⌊L⌋ for B → L ∈ P . Moreover, let We claim that with by induction on n. For n = 0, we have v ∈ L S and can use transitions of type (2) Then v ′ ∈ L(A ′ ) and v ′ = xBy, v = x⌊w⌋y for some B ∈ N , w ∈ L B . The run for v ′ uses a transition (p, B, m, q) ∈ E. Instead of using this transition, we can use (p, ⌊, mq, q B 0 ), then execute the (2)-type transitions for w ∈ L B , and finally use (f, ⌋,q, q), where f is the final state in the run for w. This has the effect of reading ⌊w⌋ from the input and multiplying mq1q = m to the storage monoid. Hence, the new run is valid and accepts v. Hence, v ∈ L(A ′ ). This proves K ⊆ L(A ′ ).
Let v ∈ L(A ′ ) and let n = |w| ⌊ . We show v ∈ K by induction on n. If n = 0, then the run for v only used transitions of type (2) and hence v ∈ L S . If n ≥ 1, since π {⌊,⌋} (v) is a semi-Dyck word, we can write v = x⌊w⌋y for some w ∈ (N ∪ T ) * . Since ⌊ and ⌋ can only be produced by transitions of the form (3) and (4), respectively, the run for v has to be of the form N , (p, B, m, q) ∈ E, f, f ′ ∈ F , r, t ∈ M ′ , and s ∈ M and with rmqsq ′ t = 1. This last condition implies s = 1 and q = q ′ , which in turn entails rmt = 1. This also means (p, B, m, q ′ ) = (p, B, m, q) ∈ E and (q B 0 , ε, 1) → * A ′ (f, w, s) = (f, w, 1) and hence w ∈ L B . Using the transition (p, B, m, q ′ ) ∈ E, we have . Hence xBy ∈ L(A ′ ) and |xBy| ⌊ < |v| ⌊ . Thus, induction yields xBy ∈ K and since xBy ⇒ G ′ x⌊w⌋y, we have v = x⌊w⌋y ∈ K. This proves L(A ′ ) = K.
For two language classes C and D, we will consider the languages obtained by intersecting a language from C with a language in D. Since the class of these intersections might not be well-behaved, we use a slight extension. By C ⊓ D, we denote the class of all languages h(K ∩ L) where K ⊆ X * belongs to C and L ⊆ X * is a member of D and h : X * → Y * is a morphism. This allows us to state the following characterization of VA(M × N ) in terms of VA(M ) and VA(N ) by Kambites [10].  We shall now prove Theorem 3.3. Note that the implication "1 ⇒ 2" immediately follows from Theorem 3.1. The implication "2 ⇒ 3" is an old graph-theoretic result of Wolk. Proof. Let Γ = (V, E). We proceed by induction on |V |. If Γ is empty, then MΓ ∼ = 1 ∼ = B 0 ∈ DEC. Hence, we assume that Γ is non-empty. If Γ is not connected, then Γ is the disjoint union of PPN-free transitive forests Γ 1 , Γ 2 , for which MΓ 1 , MΓ 2 ∈ DEC by induction. Hence, Suppose Γ is connected. Since Γ is a transitive forest, there is a vertex v ∈ V such that Γ \ v is a PPN-free transitive forest and v is adjacent to every vertex in V \ {v}. We distinguish two cases. For establishing Theorem 3.3, our remaining task is to prove the implication "4 ⇒ 1". In light of Theorems 3.1 and 5.8 and Lemma 5.9, this amounts to showing that emptiness is decidable for valence automata over monoids in DEC. This will involve two facts (Theorem 5.10 and Proposition 5.11) about the languages arising from monoids in DEC.
The following generalization of Parikh's theorem by van Leeuwen will allow us to exploit our description of free products by algebraic extensions. If X is an alphabet, X ⊕ denotes the set of maps α : X → N. The elements of X ⊕ are called multisets. The Parikh map is the map Ψ : X * → X ⊕ where Ψ (w) (x) is the number of occurrences of x in w. By P(S), we denote the power set of the set S. A substitution is a map σ : X → P(Y * ), where X and Y are alphabets. Given L ⊆ X * , we write σ(L) for the set of all words v 1 · · · v n , where v i ∈ σ(x i ), 1 ≤ i ≤ n, for x 1 · · · x n ∈ L and x 1 , . . . , x n ∈ X. If σ(x) belongs to C for each x ∈ X, then σ is a C-substitution. The class C is said to be substitution closed if σ(L) ∈ C for every member L of C and every C-substitution σ.
For α, β ∈ X ⊕ , let α + β ∈ X ⊕ be defined by (α + β)(x) = α(x) + β(x). With this operation, X ⊕ is a monoid. For a subset S ⊆ X ⊕ , we write S ⊕ for the smallest submonoid of X ⊕ containing S. A subset of the form µ + F ⊕ for µ ∈ X ⊕ and a finite F ⊆ X ⊕ is called linear. A finite union of linear sets is called semilinear. By SLI(C) we denote the class of languages h(L ∩ Ψ −1 (S)), where h : X * → Y * is a morphism, L belongs to C, and S ⊆ X ⊕ is semilinear. We will prove decidability for DEC by reducing the problem to the reachability problem of priority multicounter machines, whose decidability has been established by Reinhardt [15]. Priority multicounter machines are an extension of Petri nets with one inhibitor arc. Intuitively, a priority multicounter machine is a partially blind multicounter machine with the additional capability of restricted zero tests: The counters are numbered from 1 to k and for each ℓ ∈ {1, . . . , k}, there is a zero test instruction that checks whether counters 1 through ℓ are zero. Let us define priority multicounter machines formally.
A priority k-counter machine is a tuple A = (Q, X, E, q 0 , F ), where (i) X is an alphabet, (ii) Q is a finite set of states, (iii) E is a finite subset of Q×X * ×{0, . . . , k}×Z k ×Q, and its elements are called edges or transitions, (iv) q 0 ∈ Q is the initial state, and (v) F ⊆ Q is the set of final states. For ℓ ∈ {0, . . . , k}, let We are now ready to defines the semantics of priority counter machines. A configuration of A is a pair (q, µ) ∈ Q × N k . For configurations (q, µ) and (q ′ , µ ′ ), we write (q, µ) (q 0 , µ 0 ), . . . , (q n , µ n ) ∈ Q × N k such that (i) (q, µ) = (q 0 , µ 0 ) and (q ′ , µ ′ ) = (q n , µ n ), (ii) for each i ∈ {1, . . . , n}, there is a transition (q i−1 , w i , ℓ, ν, q i ) ∈ E such that µ i−1 ∈ N k ℓ and µ i = µ i−1 + ν, and w = w 1 · · · w n . The language accepted by A is defined as A priority multicounter machine is a priority k-counter machine for some k ∈ N. The class of languages accepted by priority multicounter machines is denoted by Prio. Reinhardt has shown that the reachability problem for priority multicounter machines is decidable [15], which can be reformulated as follows.
Although the decidability proof for the emptiness problem for valence automata over SC ± employs a reduction to priority multicounter machines, it should be stressed that the mechanisms realized by SC ± are quite different from priority counters and very likely not subsumed by them in terms of accepted languages. For example, SC ± contains pushdown stacks (B * B)-if the priority multicounter machines could accept all context-free languages (or even just the semi-Dyck language D * 2 ), this would easily imply decidability of the emptiness problem for pushdown Petri nets. Indeed, SC ± can even realize stacks where each entry consists of n partially blind counters (since B * (B n ) ∈ SC ± ). On the other hand, priority multicounter machines do not seem to be subsumed by SC ± either: After building stacks once, SC ± only allows adding blind counters (and building stacks again). It therefore seems unlikely that a mechanism in SC ± can accept the languages even of a priority 2-counter machine.
The idea of the proof of "4 ⇒ 1" is, given a valence automaton over some M ∈ DEC, to construct a Parikh-equivalent priority multicounter machine. This construction makes use of the following simple fact. A full trio C is said to be Presburger closed if SLI(C) ⊆ C. Proof. The fact that Prio is a full trio can be shown by standard automata constructions. Given a priority multicounter machine A and a semilinear set S ⊆ X ⊕ , we add |X| counters to A that ensure that the input is contained in L(A) ∩ Ψ −1 (S). This proves that Prio is Presburger closed.
Suppose σ : X → P(Y * ) is a Prio-substitution. Furthermore, let A be a priority k-counter machine and let σ(x) be given by a priority ℓ-counter machine for each x ∈ X. We construct a priority (ℓ+k)-counter machine B from A by adding ℓ counters. B simulates A on counters ℓ + 1, . . . , ℓ + k. Whenever A reads x, B uses the first ℓ counters to simulate the priority ℓ-counter machine for σ(x). Using the zero test on the first ℓ counters, it makes sure that the machine for σ(x) indeed ends up in a final configuration. Then clearly L(B) = σ(L(A)).
Proof. We proceed by induction with respect to the definition of DEC. In the case M = B n , we have VA(M ) ⊆ Prio, because priority multicounter machines generalize partially blind multicounter machines.
The following lemma is a direct consequence of Lemma 5.14 and Theorem 5.12: Given a valence automaton over M with M ∈ DEC, we construct a priority multicounter machine accepting a Parikh-equivalent language. The latter can then be checked for emptiness. This completes the proof of "4 ⇒ 1" of Theorem 3.3 and hence concludes the proof of Theorem 3.3.

Expressive equivalences
We now turn to the proof of Propositions 3.5 and 3.6, which characterize the expressiveness of valence automata over SC ± and REM, respectively. Proposition 3.6. By induction, it is easy to see that each M ∈ SC + is isomorphic to some MΓ where Γ contains a PPN-graph and Γ − is a transitive forest. By Theorem 5.8, this means Γ − contains neither C4 nor P4. This proves the inclusion "⊇".
Because of Theorem 5.8, for the inclusion "⊆", it suffices to show that if Γ − is a transitive forest, then there is some M ∈ SC + with VA(MΓ) ⊆ VA(M ). We prove this by induction on the number of vertices in Γ = (V, E). As in the proof of Lemma 5.9, we may assume that for every induced proper subgraph ∆ of Γ, we find an M ∈ SC + with VA(MΓ) ⊆ VA(M ). If Γ is empty, then MΓ ∼ = 1 and VA(MΓ) ⊆ VA(B (2) × B). Hence, we may assume that Γ is non-empty.

Finite-index languages and Petri nets
We have seen in the previous sections that valence automata over SC ± constitute a model that (strictly) subsumes Petri nets and has a decidable emptiness problem. Moreover, they feature a type of pushdown stack. A similar result has been obtained by Atig and Ganty [2]. They proved that given a finite-index context-free language and a Petri net language, it is decidable whether their intersection is empty. Here, we present a common generalization of these facts: We provide a language class that contains the languages considered by Atig and Ganty and those in VA(SC ± ) and enjoys decidability of the emptiness problem.
Definitions. If C is the class of finite languages, a C-grammar is also called a context-free grammar. For a context-free grammar G = (N, T, P, S), we may assume that for each production (A, M ), the set M is a singleton and instead of (A, {w}), we write A → w for the production. The grammar is said to be in Chomsky normal form (CNF) if for every production A → w, we have w ∈ N 2 ∪ T ∪ {ε}.
The finite-index restriction considered by Atig and Ganty places a budget constraint on the nonterminal occurrences in sentential forms. This leads to a restricted derivation For k ≥ 1, we use CF k to denote the class of languages of the form L k (G) for context-free grammars G. The languages in CF k are called index-k context-free languages. It will later be convenient to let CF 0 denote the regular languages. Moreover, fiCF is the union k≥1 CF k . Its members are called finite-index context-free languages. Note that although clearly L(G) = k≥1 L k (G) for every individual grammar G, the class fiCF is strictly contained in CF: Salomaa has shown that D * 1 , the semi-Dyck language over one pair of parentheses, is not contained in fiCF [16].
A d-dimensional (labeled) Petri net 3 is a tuple N = (X, E, µ 0 , F ), where X is an alphabet, T is a finite subset of (X ∪ {ε}) × Z d whose elements are called transitions, µ 0 ∈ N d is the initial marking, and F ⊆ N d is a finite set of final markings. For µ, µ ′ ∈ N d and w ∈ X * , we write µ w − → N µ ′ if there are µ 0 , . . . , µ n ∈ N d and transitions (x 1 , ν 1 ), . . . , (x n , ν n ) ∈ T such that w = x 1 · · · x n , µ 0 = µ, µ n = µ ′ , and µ i = µ i−1 + ν i for i ∈ {1, . . . , n}. Moreover, we define The language L(N ) is said to be generated by N . A languages is a Petri net language if it is generated by some labeled Petri net. By P, we denote the class of all Petri net languages. Observe that we have P = n≥0 VA(B n ).
The main result of this section involves the language class fiCF ⊓ P. We will use the fact that this is a full trio, which follows from the following classical result. See [7, Theorem 3.6.1] for a proof.
Proposition 7.1. If C and D are full trios, then C ⊓ D is a full trio as well.
In our notation, the result of Atig and Ganty can be stated as follows.
Here, we present a language class including both fiCF ⊓ P and VA(SC ± ) where emptiness is still decidable. First, consider the following hierarchy. Let The class F captures the expressive power of valence automata over monoids in SC ± : Proof. For the inclusion "⊆", we prove that for every M ∈ SC ± , we have in which the first inclusion follows from Proposition 5.11. Finally, if VA(M 0 ) ⊆ F i and VA(M 1 ) ⊆ F j , then VA(M 0 ), VA(M 1 ) ⊆ F k for k = max{i, j} and thus where the first inclusion is due to Proposition 5.3. This completes the proof of the inclusion "⊆". For the inclusion "⊇", we show by induction on i that F i ⊆ VA(DEC) for every i ≥ 0. Since VA(DEC) = VA(SC ± ) by Proposition 3.5, this is sufficient. Clearly, the inclusion F 0 = n≥0 VA(B n ) ⊆ VA(DEC) holds. Now suppose F i ⊆ VA(DEC) and let L be a member of F i+1 = SLI(Alg(F i )). This means we have L = h(K ∩ Ψ −1 (S)) for some homomorphism h, a language K from Alg(F i ), and a semilinear set S. As a member of Alg(F i ), the language K is generated by an F i -grammar G. Each right-hand side in G is contained in F i and thus, by induction, in VA(DEC). Hence, suppose the right-hand sides of G are K 1 , . . . , K n with K i ∈ VA(M i ) for M 1 , . . . , M n ∈ DEC. Consider the monoid M = M 1 * · · · * M n . Since each M i embeds into M , the languages K 1 , . . . , K n belong to VA(M ). Thus, K is a member of Alg(VA(M )), which equals VA(B * B * M ) according to Proposition 5.6. According to Proposition 5.11, this implies that L belongs to VA((B * B * M ) × Z k ) for some k ≥ 0. Since (B * B * M ) × Z k is a member of DEC, we know that L belongs to VA(DEC). We have thus shown F i+1 ⊆ VA(DEC), which establishes the inclusion "⊆".
Our new class is defined as follows. Let Then clearly F i ⊆ G i for i ≥ 0 and hence VA(SC ± ) = F ⊆ G. Moreover, we obviously have fiCF ⊓ P ⊆ G. We shall prove the following.
Theorem 7.4. The class G has a decidable emptiness problem.
We show Theorem 7.4 by proving a slightly stronger version of Theorem 7.2: Atig and Ganty reduce the emptiness problem of fiCF ⊓ P to the emptiness problem for priority multicounter machines. We strengthen this slightly and show that for each language L in fiCF ⊓ P, one can construct a priority multicounter machine A with Ψ (L(A)) = Ψ (L), in other words: Ψ (fiCF ⊓ P) ⊆ Ψ (Prio). This allows us to apply Theorem 5.10 and Lemma 5.13 to conclude that Ψ (G) ⊆ Ψ (Prio).
The following observation provides a decomposition of languages in fiCF. A context-free grammar G = (N, T, P, S) is called linear if every production A → w in G satisfies |w| N ≤ 1. A language is called linear context-free if it is generated by a linear context-free grammar. Note that CF 1 is precisely the class of linear context-free languages.
Proposition 7.5. Suppose k ≥ 1. A language belongs to CF k if and only if it can be written as σ(L) for a linear context-free language L and a CF k−1 -substitution σ.
Proof. We prove the statement by induction on k. For k = 1, it essentially states that linear context-free languages are closed under regular substitutions, which is clearly true. For the induction step, we use a result of Atig and Ganty. Let G = (N, T, P, S) be a context-free grammar in CNF. For each i ≥ 0, let A [i] be a fresh symbol. For each ℓ ≥ 0, we define a grammar G [ℓ] as follows. We have is the smallest set of productions such that For each nonterminal A of G, we define w}. Atig and Ganty [2] show that for every i ∈ {0, . . . , ℓ}, one has where G is in CNF. According to (5), we have L(G [k] ) = K. We now construct a (linear) context-free grammar G ′ = (N ′ , T ′ , P ′ , S ′ ) (that is not necessarily in CNF) as follows. It has terminal symbols As productions, it contains all those productions of G whose left-hand side belongs to N ′ . Moreover, the substitution σ : T ′ * → P(T * ) is defined as follows: For a ∈ T , we set σ(a) = {a}. For Moreover, an inspection of the definition of G [ℓ] yields that G ′ is clearly linear. Finally, we have K = σ(L(G ′ )), so that with L = L(G ′ ), we have proven the "only if" direction of the proposition. The other direction is obvious.
We now turn to the key lemma (Lemma 7.6) of our slightly stronger version of Atig and Ganty's result. We want to show that given an index-k context-free language K and a Petri net language L, one can construct a priority multicounter machine A with Ψ (L(A)) = Ψ (K ∩ L). The proof proceeds by induction on the index k, which warrants a strengthening of the statement.
We need some terminology. For a vector µ = (m 1 , . . . , m d ) ∈ N d and k ≥ d, we denote by 0|µ the vector (0, . . . , 0, m 1 , . . . , m d ) ∈ N k . The dimension k will always be clear from the context. In order to make the induction work, we need to construct priority counter machines with the additional property that for a particular d, they never zero-test their d topmost counters. Therefore, for a priority k-counter machine A = (Q, X, E, q 0 , F ) and d ≤ k, we define A d to be the machine obtained from A removing all transitions (q, x, ℓ, ν, q ′ ) with ℓ > d. In other words, we remove all transitions that perform a zero-test on a counter other than 1, . . . , d. We define the language For a language K ⊆ X * and a d-dimensional Petri net N = (X, E, µ 0 , F ), we say that a priority k-counter machine A is a (K, N )-simulator if k ≥ d and there are two states p and p ′ in A such that for every µ, µ ′ ∈ N d , we have (6) Ψ (L d (A, p, µ, p ′ , µ ′ )) = Ψ (K ∩ L(N, µ, µ ′ )) .
In this case, p and p ′ are called source and target, respectively.
Lemma 7.6. Given a language K in fiCF and a labeled Petri net N , one can construct a (K, N )-simulator.
Proof. Let N = (X, E, µ 0 , F ) be a d-dimensional Petri net and let K belong to CF k . We proceed by induction on k. If k = 0, then K is accepted by some finite automaton B. We may assume that B has an initial state p and one final state p ′ . One can construct a priority d-counter machine A by a product construction from N and B such that A has the same state set as B and meaning it is indeed a (K, N )-simulator.
For the induction step, suppose k ≥ 1. According to Proposition 7.5, there is a linear context-free language L ⊆ Y * and a CF k−1 -substitution σ : Y → P(X * ) with K = σ(L). Let us begin with some explanation. Since L is linear context-free, it is given by a grammar G = (N , Y, P, S) where every production is of the form A → x 1 Bx 2 or A → ε with A, B ∈N and x 1 , x 2 ∈ Y ∪ {ε}. Let D ⊆ P * be the regular language of production sequences that correspond to derivations in G and let g 1 , g 2 : P * → Y * be the morphisms where for π = Therefore, if τ i is the CF k−1 -substitution with τ i (π) = σ(g i (π)) for i = 1, 2, then K = σ(L) consists of all words in τ 1 (w)τ 2 (w R ) for w ∈ D. In other words, K contains precisely those words of the form such that there is a word w = π 1 · · · π n ∈ D, π 1 , . . . , π n ∈ P with u i ∈ τ 1 (π i ) and v i ∈ τ 2 (π i ) for i ∈ {1, . . . , n}.
Our task is to construct a (K, N )-simulator A ′ . This means, using a priority counter machine, we have to simulate-up to Parikh image-all runs of N with labels as in Eq. (7). By induction, we have a (τ i (π), N )-simulator A π,i for each π ∈ P and i ∈ {1, 2}. Each of the machines A π,i has ≥ d counters, so we may clearly assume that for some ℓ ≥ 0, they all have ℓ + d counters. Moreover, by definition of a (τ i (π), N )-simulator, these machines never perform a zero-test on the d top-most counters. Moreover, using a zero-test, we can guarantee that when A π,i reaches its target state, its first ℓ counters are zero.
The basic idea is that A ′ performs a run of an automaton for D, which reads a word w = π 1 · · · π n . For each j = 1, . . . , n, it executes a computation of A πj ,1 (reading u j ) and a computation of A πj ,2 (reading v j ). Hence, A ′ reads the word u 1 v 1 u 2 v 2 · · · u n v n , which is clearly Parikh-equivalent to u 1 · · · u n v n · · · v 1 .
We have to make sure that all these runs of the machines A πj ,i are compatible in the sense that they can be executed in the order prescribed by Eq. (7). To this end, all the executions of A π1,1 , . . . , A πn,1 share one set of ℓ + d counters. The executions of A π1,2 , . . . , A πn,2 also share a set of counters, but they are executed backwards. The counters for the backward execution are also ℓ+d many, but since each execution of some A π,i leaves the first ℓ counters empty, the forward and the backward simulation can share the first ℓ counters between them. This leaves us with ℓ + 2d counters: We use counters 1, . . . , ℓ + d to simulate A πj ,1 and we use counters 1, . . . , ℓ and ℓ + d + 1, . . . , ℓ + 2d to simulate A πj ,2 (backwards). Therefore, we call counters 1, . . . , ℓ auxiliary counters, whereas the counters ℓ + 1, . . . , ℓ + d are called forward counters. The counters ℓ + d + 1, . . . , ℓ + 2d are dubbed backward counters.
In addition, we have to make sure that the executions of N corresponding to v n · · · v 1 can be executed after the executions corresponding to u 1 · · · u n . Therefore, after executing the run of the automaton for D, A ′ simultaneously counts down the forward and the backward counters and then performs a zero-test on the counters 1, . . . , ℓ + 2d.
The global counters are used as follows. The machine A ′ starts with counters 0|µ ∈ N ℓ+3d . First, it nondeterministically subtracts some vector ν 1 ∈ N d from the global counters and simultaneously adds it to the forward counters. Then, it nondeterministically adds a vector ν ′ 2 ∈ N d to both the global counters and the backward counters. After performing the simulation of the A π1,1 , . . . , A πn,1 and the A π1,2 , . . . , A πn,2 , suppose the forward counters contain ν ′ 1 ∈ N d and the backward counters contain ν 2 ∈ N d . As described above, A ′ afterwards compares the forward and backward counters, ensuring that ν ′ 1 = ν 2 and thus: Observe that this guarantees that the global counters of A ′ reflect the counters of the simulated computation of N : In the end, they are precisely 0|µ ′ ∈ N ℓ+3d , where µ ′ = µ − ν 1 + ν ′ 2 , which means µ u1···unvn···v1 − −−−−−−−− → N µ ′ . Let us make the description of A ′ more precise.
(i) A ′ has a state p, where it nondeterministically subtracts tokens from the global counters and simultaneously adds them to the forward counters. (ii) Note that D ⊆ P * can be accepted by a finite automaton with state setN , the non-terminals of G. Therefore, from the state p, A ′ can enter the state S ∈N to start simulating the automaton for D. (iii) In a state A ∈N , A ′ selects a production π = A → x 1 Bx 2 ∈ P and then executes a computation of A π,1 in the auxiliary and the forward counters. Then, it executes a computation of A π,2 backwards on the auxiliary and backward counters. Then, it switches to state B ∈N . (iv) If A ′ is in state A ∈N and there is a production A → ε ∈ P , then A ′ switches to a state p ′′ , in which it simultaneously counts down the forward and the backward counters. From p ′′ it non-deterministically switches to p ′ while performing a zerotest on all counters 1, . . . , ℓ + 2d. In conclusion, it is clear that for µ, µ ′ ∈ N d , we have (p, 0|µ) w − → A ′ (p ′ , 0|µ ′ ) if and only if w = u 1 v 1 u 2 v 2 · · · u n v n such that there is a word π 1 · · · π n ∈ D, π 1 , . . . , π n ∈ P , such that u j ∈ τ 1 (π j ) and v j ∈ τ 2 (π j ). Thus, A ′ is a (K, N )-simulator.
We are now ready to prove the slightly stronger version of the decidability result of Atig and Ganty.
Proof. Since the languages of priority multicounter machines are closed under morphisms, we may assume that K = C ∩ P , where C is in CF k and P = L(N ) for a d-dimensional labeled Petri net N = (X, T, µ 0 , F ). Lemma 7.6 allows us to construct a (C, N )-simulator A with source p and target p ′ . This means, for each µ ∈ N d , we have Ψ (L d (A, p, µ 0 , p ′ , µ)) = Ψ (C ∩ L(N, µ 0 , µ)) and in particular Since we can clearly construct a priority multicounter machine for L, the proof of the theorem is complete.
This allows us to prove Theorem 7.4.
Theorem 7.4. Given a language in G i , we can recursively construct a Parikh equivalent priority multicounter machine. According to Theorem 7.7, this is true of G 0 = fiCF ⊓ P. Furthermore, Theorem 5.10 and Lemma 5.13 tell us that if we can carry out such a construction for G i , we can also do it for G i+1 .

Conclusion
Of course, an intriguing open question is whether the storage mechanisms corresponding to SC + have a decidable reachability problem. First, since their simplest instance are pushdown Petri nets, this extends the open question concerning the latter's reachability. Second, they naturally subsume the priority multicounter machines of Reinhardt. This makes them a candidate for being a quite powerful model for which reachability might be decidable.
Observe that if these storage mechanisms turn out to exhibit decidability, this would mean that the characterization of Lohrey and Steinberg (Theorem 3.4) remains true for all graph monoids. This can be interpreted as evidence for decidability.